From 123260b69dd8b251e7dfe82bd050ac7e66e9c4e8 Mon Sep 17 00:00:00 2001 From: rustmailer Date: Sun, 10 May 2026 04:22:35 +0800 Subject: [PATCH] update --- web/package.json | 1 - web/src/components/ui/sidebar.tsx | 6 ++---- web/src/routes/_authenticated/route.tsx | 4 +--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/web/package.json b/web/package.json index 6ac2ec2..d11d631 100644 --- a/web/package.json +++ b/web/package.json @@ -57,7 +57,6 @@ "file-saver": "^2.0.5", "handlebars": "^4.7.8", "i18next": "^25.6.3", - "js-cookie": "^3.0.5", "lucide-react": "^0.468.0", "radix-ui": "^1.4.3", "react": "^18.3.1", diff --git a/web/src/components/ui/sidebar.tsx b/web/src/components/ui/sidebar.tsx index 48bd737..40bb012 100644 --- a/web/src/components/ui/sidebar.tsx +++ b/web/src/components/ui/sidebar.tsx @@ -22,8 +22,7 @@ import { TooltipTrigger, } from '@/components/ui/tooltip' -const SIDEBAR_COOKIE_NAME = 'sidebar:state' -const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7 +const SIDEBAR_COOKIE_NAME = 'sidebar_state' const SIDEBAR_WIDTH = '14rem' const SIDEBAR_WIDTH_MOBILE = '16rem' const SIDEBAR_WIDTH_ICON = '3rem' @@ -86,8 +85,7 @@ const SidebarProvider = React.forwardRef< _setOpen(openState) } - // This sets the cookie to keep the sidebar state. - document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}` + localStorage.setItem(SIDEBAR_COOKIE_NAME, openState.toString()); }, [setOpenProp, open] ) diff --git a/web/src/routes/_authenticated/route.tsx b/web/src/routes/_authenticated/route.tsx index 9cf4f9d..b434c02 100644 --- a/web/src/routes/_authenticated/route.tsx +++ b/web/src/routes/_authenticated/route.tsx @@ -16,8 +16,6 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . - -import Cookies from 'js-cookie' import { createFileRoute, Outlet } from '@tanstack/react-router' import { cn } from '@/lib/utils' import { SearchProvider } from '@/context/search-context' @@ -29,7 +27,7 @@ export const Route = createFileRoute('/_authenticated')({ }) function RouteComponent() { - const defaultOpen = Cookies.get('sidebar:state') !== 'false' + const defaultOpen = localStorage.getItem('sidebar_state') === 'true'; return (