import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { ArrowLeft, ListChecks } from "lucide-react"; import AccountCard from "../../components/settings/AccountCard"; import LicenseCard from "../../components/settings/LicenseCard"; import DocsContent from "../../components/settings/DocsContent"; import { getPreference } from "../../services/userPreferenceService"; import { ONBOARDING_CHECKLIST_HIDDEN_KEY, showChecklist, } from "../../services/onboardingService"; import { logError } from "../../services/logService"; // Re-show button of the getting-started checklist (#352). `hidden` = the // preference was "1" at mount; `shown` = the button was clicked and the // preference removed, so a confirmation line replaces the button. type ChecklistButtonState = "unknown" | "visible" | "hidden" | "shown"; export default function UsersSettingsPage() { const { t } = useTranslation(); const [checklistButton, setChecklistButton] = useState("unknown"); useEffect(() => { let cancelled = false; (async () => { try { const value = await getPreference(ONBOARDING_CHECKLIST_HIDDEN_KEY); if (!cancelled) setChecklistButton(value === "1" ? "hidden" : "visible"); } catch (e) { // Informational control: without the preference, keep it out of the way. if (!cancelled) setChecklistButton("visible"); logError("Settings: failed to read the checklist preference", e); } })(); return () => { cancelled = true; }; }, []); const handleShowChecklist = async () => { try { await showChecklist(); setChecklistButton("shown"); } catch (e) { logError("Settings: failed to show the checklist", e); } }; return (
{t("settings.backToHome")}

{t("settings.users.title")}

{t("settings.users.sections.accounts")}

{t("settings.users.sections.licenses")}

{t("settings.users.sections.userGuide")}

{(checklistButton === "hidden" || checklistButton === "shown") && (
)}
); }