From 3245613a889d43d419d83503df82c5c4cba60485 Mon Sep 17 00:00:00 2001 From: Copilot <175728472+Copilot@users.noreply.github.com> Date: Sun, 12 Oct 2025 18:58:37 +0800 Subject: [PATCH] chore: cleanup components naming --- .../{BrandBanner.tsx => MemosLogo.tsx} | 4 ++-- web/src/components/Navigation.tsx | 8 ++++---- .../{UserBanner.tsx => UserMenu.tsx} | 19 +++++++++++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) rename web/src/components/{BrandBanner.tsx => MemosLogo.tsx} (92%) rename web/src/components/{UserBanner.tsx => UserMenu.tsx} (82%) diff --git a/web/src/components/BrandBanner.tsx b/web/src/components/MemosLogo.tsx similarity index 92% rename from web/src/components/BrandBanner.tsx rename to web/src/components/MemosLogo.tsx index 4746fef4f..603de7a79 100644 --- a/web/src/components/BrandBanner.tsx +++ b/web/src/components/MemosLogo.tsx @@ -8,7 +8,7 @@ interface Props { collapsed?: boolean; } -const BrandBanner = observer((props: Props) => { +const MemosLogo = observer((props: Props) => { const { collapsed } = props; const workspaceGeneralSetting = workspaceStore.state.generalSetting; const title = workspaceGeneralSetting.customProfile?.title || "Memos"; @@ -24,4 +24,4 @@ const BrandBanner = observer((props: Props) => { ); }); -export default BrandBanner; +export default MemosLogo; diff --git a/web/src/components/Navigation.tsx b/web/src/components/Navigation.tsx index 6991a3aee..d715ac7d8 100644 --- a/web/src/components/Navigation.tsx +++ b/web/src/components/Navigation.tsx @@ -8,8 +8,8 @@ import { cn } from "@/lib/utils"; import { Routes } from "@/router"; import { userStore } from "@/store"; import { useTranslate } from "@/utils/i18n"; -import BrandBanner from "./BrandBanner"; -import UserBanner from "./UserBanner"; +import MemosLogo from "./MemosLogo"; +import UserMenu from "./UserMenu"; interface NavLinkItem { id: string; @@ -67,7 +67,7 @@ const Navigation = observer((props: Props) => {
- + {navLinks.map((navLink) => ( {
{currentUser && (
- +
)}
diff --git a/web/src/components/UserBanner.tsx b/web/src/components/UserMenu.tsx similarity index 82% rename from web/src/components/UserBanner.tsx rename to web/src/components/UserMenu.tsx index a20c5598c..4eacbaf9d 100644 --- a/web/src/components/UserBanner.tsx +++ b/web/src/components/UserMenu.tsx @@ -12,7 +12,7 @@ interface Props { collapsed?: boolean; } -const UserBanner = (props: Props) => { +const UserMenu = (props: Props) => { const { collapsed } = props; const t = useTranslate(); const navigateTo = useNavigateTo(); @@ -20,6 +20,21 @@ const UserBanner = (props: Props) => { const handleSignOut = async () => { await authServiceClient.deleteSession({}); + + // Clear user-specific localStorage items (e.g., drafts) + // Preserve app-wide settings like theme + const keysToPreserve = ["memos-theme", "tag-view-as-tree", "tag-tree-auto-expand", "viewStore"]; + const keysToRemove: string[] = []; + + for (let i = 0; i < localStorage.length; i++) { + const key = localStorage.key(i); + if (key && !keysToPreserve.includes(key)) { + keysToRemove.push(key); + } + } + + keysToRemove.forEach((key) => localStorage.removeItem(key)); + window.location.href = Routes.AUTH; }; @@ -65,4 +80,4 @@ const UserBanner = (props: Props) => { ); }; -export default UserBanner; +export default UserMenu;