From 5f3e84089260698eb3455e57f81605e88a5a62c1 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 28 Jul 2026 01:57:52 +0800 Subject: [PATCH] fix: clarify desktop local profile (#1095) * fix: clarify desktop local profile * cover the AccordionSection hidden branch The desktop build hides the Security section because the embedded profile signs in automatically and has no login password, so the controls there would imply a protection that does not exist. Nothing asserted that hidden actually keeps the children out of the DOM rather than merely collapsing them. Export the component and cover both states, including that an expanded hidden section still renders nothing. --- src/ui/locales/en.json | 2 + src/ui/sidebar/UserProfilePanel.tsx | 161 ++++++++++-------- .../tests/sidebar/UserProfilePanel.test.tsx | 101 +++++++++++ 3 files changed, 194 insertions(+), 70 deletions(-) create mode 100644 src/ui/tests/sidebar/UserProfilePanel.test.tsx diff --git a/src/ui/locales/en.json b/src/ui/locales/en.json index 8fc2d478..cd910144 100644 --- a/src/ui/locales/en.json +++ b/src/ui/locales/en.json @@ -3323,6 +3323,8 @@ "resetToDefaultsSuccess": "Settings reset to defaults.", "storageModeSwitch": "Preference Storage", "sectionAccount": "Account", + "desktopProfileTitle": "Automatic local desktop profile", + "desktopProfileDescription": "This profile is restricted to the embedded backend and signs in automatically. It has no login password; Remote Sync below uses a separate server account.", "sectionAppearance": "Appearance", "sectionSecurity": "Security", "sectionApiKeys": "API Keys", diff --git a/src/ui/sidebar/UserProfilePanel.tsx b/src/ui/sidebar/UserProfilePanel.tsx index fa0a4870..feffde02 100644 --- a/src/ui/sidebar/UserProfilePanel.tsx +++ b/src/ui/sidebar/UserProfilePanel.tsx @@ -144,12 +144,13 @@ const LANGUAGES = [ { code: "vi", label: "Tiếng Việt" }, ]; -function AccordionSection({ +export function AccordionSection({ id, label, icon, open, onToggle, + hidden = false, children, }: { id: string; @@ -157,8 +158,11 @@ function AccordionSection({ icon: React.ReactNode; open: boolean; onToggle: () => void; + hidden?: boolean; children: React.ReactNode; }) { + if (hidden) return null; + return (
- - + )} @@ -2032,8 +2050,11 @@ export function UserProfilePanel({ - {/* Security */} + {/* The embedded desktop backend auto-authenticates its machine-local + profile, so server login controls would imply protection they do + not provide. Remote Sync owns its separate account UI above. */}