From 3f3531392ec5934113ae64d628a374092860a4ad Mon Sep 17 00:00:00 2001 From: le king fu Date: Sat, 3 Oct 2026 19:34:24 -0400 Subject: [PATCH] refactor(onboarding): name the checklist preference states after what they hold (#352) Co-Authored-By: Claude Fable 5.1 --- src/pages/settings/UsersSettingsPage.tsx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/pages/settings/UsersSettingsPage.tsx b/src/pages/settings/UsersSettingsPage.tsx index ec9f057..de75c2e 100644 --- a/src/pages/settings/UsersSettingsPage.tsx +++ b/src/pages/settings/UsersSettingsPage.tsx @@ -12,24 +12,25 @@ import { } 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"; +// Getting-started checklist preference, for its re-show button (#352). +// `dismissed` = the preference was "1" at mount, the button is offered; +// `restored` = the button was clicked and the preference removed, so a +// confirmation line replaces it; `shown` = nothing to offer. +type ChecklistPreference = "unknown" | "shown" | "dismissed" | "restored"; export default function UsersSettingsPage() { const { t } = useTranslation(); - const [checklistButton, setChecklistButton] = useState("unknown"); + const [checklistPref, setChecklistPref] = useState("unknown"); useEffect(() => { let cancelled = false; (async () => { try { const value = await getPreference(ONBOARDING_CHECKLIST_HIDDEN_KEY); - if (!cancelled) setChecklistButton(value === "1" ? "hidden" : "visible"); + if (!cancelled) setChecklistPref(value === "1" ? "dismissed" : "shown"); } catch (e) { // Informational control: without the preference, keep it out of the way. - if (!cancelled) setChecklistButton("visible"); + if (!cancelled) setChecklistPref("shown"); logError("Settings: failed to read the checklist preference", e); } })(); @@ -41,7 +42,7 @@ export default function UsersSettingsPage() { const handleShowChecklist = async () => { try { await showChecklist(); - setChecklistButton("shown"); + setChecklistPref("restored"); } catch (e) { logError("Settings: failed to show the checklist", e); } @@ -77,11 +78,11 @@ export default function UsersSettingsPage() {

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

- {(checklistButton === "hidden" || checklistButton === "shown") && ( + {(checklistPref === "dismissed" || checklistPref === "restored") && (