import { useEffect, useState } from 'react'; import type { Health, SessionUser } from '../lib/api'; interface Props { health: Health | null; user: SessionUser | null; busy: boolean; note: string | null; error: string | null; onLogin: (email: string, password: string) => void; onRegister: (input: { email: string; password: string; name: string; invite: string }) => void; onLogout: () => void; onSync: () => void; onClose: () => void; } function fmtBytes(bytes: number) { if (bytes > 1024 ** 3) return `${(bytes / 1024 ** 3).toFixed(1)} GB`; if (bytes > 1024 ** 2) return `${(bytes / 1024 ** 2).toFixed(0)} MB`; return `${Math.round(bytes / 1024)} KB`; } export default function CloudPanel({ health, user, busy, note, error, onLogin, onRegister, onLogout, onSync, onClose, }: Props) { const [mode, setMode] = useState<'signin' | 'signup'>('signin'); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [name, setName] = useState(''); const [invite, setInvite] = useState(''); useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key !== 'Escape') return; e.preventDefault(); e.stopImmediatePropagation(); if (!busy) onClose(); }; window.addEventListener('keydown', onKey, true); return () => window.removeEventListener('keydown', onKey, true); }, [busy, onClose]); const submit = () => { if (busy) return; if (mode === 'signin') onLogin(email.trim(), password); else onRegister({ email: email.trim(), password, name: name.trim(), invite: invite.trim() }); }; return (
e.target === e.currentTarget && onClose()}>

Team server

{!health ? (
No server detected

The library is running fully in this browser. To share photos with the team, start the server and reload:

npm run server

Originals, edits and ratings are then stored on disk under server/data.

) : user ? (
{(user.name || user.email).slice(0, 1).toUpperCase()}
{user.name || user.email}
{user.email} · {user.role}
Photos on server
{health.photos}
Storage used
{fmtBytes(health.bytes)}
Raw engine
{health.raw.libraw ? 'LibRaw demosaic' : 'Embedded previews'}
Server version
{health.version}
{note &&
{note}
}
) : ( <>
{mode === 'signup' && ( )} {mode === 'signup' && !health.needsSetup && ( )} {mode === 'signup' && health.needsSetup && (

The first account becomes the team admin. Share the invite code you set in{' '} LUMENROOM_INVITE with everyone else.

)} )} {error &&
{error}
} {health && (

Server sharing the folder server/data · raw formats:{' '} {health.raw.formats.length} · {health.raw.sharp ? 'JPEG encoder ready' : 'PNG fallback'}

)}
); }