diff --git a/src/routes/archive.index.tsx b/src/routes/archive.index.tsx index 2b7ede3..b5d8b1a 100644 --- a/src/routes/archive.index.tsx +++ b/src/routes/archive.index.tsx @@ -62,6 +62,24 @@ function ArchivePage() { const [totalCount, setTotalCount] = useState(0); const [uploadOpen, setUploadOpen] = useState(false); const [newCatOpen, setNewCatOpen] = useState(false); + const [lockedTabs, setLockedTabs] = useState>(() => { + if (typeof window === "undefined") return {}; + try { + return JSON.parse(localStorage.getItem("archive-locked-tabs") || "{}"); + } catch { + return {}; + } + }); + const isLocked = activeId ? lockedTabs[activeId] !== false : true; // default locked + const toggleLock = () => { + if (!activeId) return; + const next = { ...lockedTabs, [activeId]: !isLocked }; + setLockedTabs(next); + try { + localStorage.setItem("archive-locked-tabs", JSON.stringify(next)); + } catch {} + toast.success(next[activeId] ? "Tab locked" : "Tab unlocked"); + }; // Debounce search input (300ms) useEffect(() => {