import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Lock, Plus } from "lucide-react"; import { useProfile } from "../contexts/ProfileContext"; import { APP_NAME } from "../shared/constants"; import PinDialog from "../components/profile/PinDialog"; import ProfileFormModal from "../components/profile/ProfileFormModal"; export default function ProfileSelectionPage() { const { t } = useTranslation(); const { profiles, switchProfile } = useProfile(); const [pinProfileId, setPinProfileId] = useState(null); const [showCreate, setShowCreate] = useState(false); const handleSelect = (profileId: string) => { const profile = profiles.find((p) => p.id === profileId); if (!profile) return; if (profile.pin_hash) { setPinProfileId(profileId); } else { switchProfile(profileId); } }; const handlePinSuccess = () => { if (pinProfileId) { switchProfile(pinProfileId); setPinProfileId(null); } }; const pinProfile = profiles.find((p) => p.id === pinProfileId); return (

{APP_NAME}

{t("profile.select")}

{profiles.map((profile) => ( ))}
{pinProfileId && pinProfile && ( setPinProfileId(null)} /> )} {showCreate && ( setShowCreate(false)} /> )}
); }