fix(nav): restore sidebar collapse state from cookie; cmd+k search shows tools only while typing; mobile header search
Build & Push Docker Image / build (push) Successful in 3m22s

This commit is contained in:
opencode
2026-08-02 15:08:37 +02:00
parent c6755b586b
commit ab24f99b90
3 changed files with 73 additions and 48 deletions
@@ -53,6 +53,15 @@ function useSidebar() {
return context
}
function getSidebarCookie(): boolean | null {
if (typeof document === "undefined") return null;
const match = document.cookie.match(
new RegExp(`(?:^|; )${SIDEBAR_COOKIE_NAME}=([^;]*)`)
);
if (!match) return null;
return match[1] === "true";
}
function SidebarProvider({
defaultOpen = true,
open: openProp,
@@ -71,7 +80,10 @@ function SidebarProvider({
// This is the internal state of the sidebar.
// We use openProp and setOpenProp for control from outside the component.
const [_open, _setOpen] = React.useState(defaultOpen)
const [_open, _setOpen] = React.useState(() => {
const stored = getSidebarCookie()
return stored !== null ? stored : defaultOpen
})
const open = openProp ?? _open
const setOpen = React.useCallback(
(value: boolean | ((value: boolean) => boolean)) => {