- Persist last visited path via Zustand persist, restore on login/root - Sidebar: exact match for active state (issue detail no longer highlights Issues) - Sidebar header: increase vertical padding - Inbox unread count: simplified to text-xs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
644 B
TypeScript
29 lines
644 B
TypeScript
"use client";
|
|
|
|
import { create } from "zustand";
|
|
import { persist } from "zustand/middleware";
|
|
|
|
const EXCLUDED_PREFIXES = ["/login", "/pair/"];
|
|
|
|
interface NavigationState {
|
|
lastPath: string;
|
|
onPathChange: (path: string) => void;
|
|
}
|
|
|
|
export const useNavigationStore = create<NavigationState>()(
|
|
persist(
|
|
(set) => ({
|
|
lastPath: "/issues",
|
|
|
|
onPathChange: (path: string) => {
|
|
if (!EXCLUDED_PREFIXES.some((prefix) => path.startsWith(prefix))) {
|
|
set({ lastPath: path });
|
|
}
|
|
},
|
|
}),
|
|
{
|
|
name: "multica_navigation",
|
|
partialize: (state) => ({ lastPath: state.lastPath }),
|
|
}
|
|
)
|
|
);
|