"use client"; import Image from "next/image"; import { FullScreenShell } from "@/modules/shell/components/full-screen-shell"; import { ArrowRight, Eye, EyeOff, Lock, Power, } from "@/components/icons/platform-icons"; import { type FormEvent, useState } from "react"; type LockScreenProps = { onUnlock: (password: string) => Promise; onLogout: () => Promise; username: string; wallpaper?: string; }; export function LockScreen({ onUnlock, onLogout, username, wallpaper = "/images/1.jpg", }: LockScreenProps) { const displayUsername = username.replace( /\b([a-z])/gi, (letter) => letter.toUpperCase(), ); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const [isUnlocking, setIsUnlocking] = useState(false); const [isLoggingOut, setIsLoggingOut] = useState(false); const [isPasswordVisible, setIsPasswordVisible] = useState(false); async function handleUnlock(event: FormEvent) { event.preventDefault(); if (!password.trim()) return; setError(null); setIsUnlocking(true); try { await onUnlock(password); setPassword(""); } catch (unlockError) { setError( unlockError instanceof Error ? unlockError.message : "Unlock failed", ); } finally { setIsUnlocking(false); } } async function handleLogout() { setIsLoggingOut(true); try { await onLogout(); } finally { setIsLoggingOut(false); } } return (
} center={
Homeio
Home server

{displayUsername}

Locked session

setPassword(event.target.value)} placeholder="Enter your password" className="h-10 w-full border-0 bg-transparent px-1 text-[15px] text-foreground outline-none placeholder:text-muted-foreground/52" autoFocus />
{error ? (

{error}

) : null}

Press{" "} Command + L {" "} anytime to lock

} />
); }