From 929a658d67de2c8c7a4ac2a87446baa98df39ebd Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 18:27:39 +0000 Subject: [PATCH 1/5] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/archive.index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/archive.index.tsx b/src/routes/archive.index.tsx index 2e32482..2b7ede3 100644 --- a/src/routes/archive.index.tsx +++ b/src/routes/archive.index.tsx @@ -19,7 +19,7 @@ import { import { supabase } from "@/integrations/supabase/client"; import { useAuth } from "@/lib/auth"; import { toast } from "sonner"; -import { Archive as ArchiveIcon, Plus, Upload, Trash2, FileSpreadsheet } from "lucide-react"; +import { Archive as ArchiveIcon, Plus, Upload, Trash2, FileSpreadsheet, Lock, Unlock } from "lucide-react"; import { formatDateTime } from "@/lib/format"; export const Route = createFileRoute("/archive/")({ From 41d3526b12b26c8139381744a464384db77fa0be Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 18:27:48 +0000 Subject: [PATCH 2/5] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/archive.index.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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(() => { From 99888be9482ea7cfb45f53b0f9b60e89484c6ca6 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 18:27:57 +0000 Subject: [PATCH 3/5] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/archive.index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/routes/archive.index.tsx b/src/routes/archive.index.tsx index b5d8b1a..4830103 100644 --- a/src/routes/archive.index.tsx +++ b/src/routes/archive.index.tsx @@ -171,6 +171,10 @@ function ArchivePage() { }, [rows]); const deleteRow = async (id: string) => { + if (isLocked) { + toast.error("Tab is locked. Unlock it to delete records."); + return; + } if (!confirm("Delete this record?")) return; const { error } = await supabase.from("archive_records").delete().eq("id", id); if (error) { @@ -184,6 +188,10 @@ function ArchivePage() { const deleteAllInCategory = async () => { if (!activeCategory) return; + if (isLocked) { + toast.error("Tab is locked. Unlock it to clear records."); + return; + } if (!confirm(`Delete ALL ${totalCount} records in "${activeCategory.label}"? This cannot be undone.`)) return; const { error } = await supabase.from("archive_records").delete().eq("category_id", activeCategory.id); if (error) { From 8792cdb82391e86eb5d4579d303d77028a09dd91 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 18:28:09 +0000 Subject: [PATCH 4/5] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/archive.index.tsx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/routes/archive.index.tsx b/src/routes/archive.index.tsx index 4830103..1476f6e 100644 --- a/src/routes/archive.index.tsx +++ b/src/routes/archive.index.tsx @@ -258,8 +258,32 @@ function ArchivePage() {
Showing {rows.length} of {totalCount} {debouncedSearch ? "matching" : ""} rows
+ {isAdmin && activeId && ( + + )} {isAdmin && rows.length > 0 && ( - )} From 188a18cc411d9e27caf8537908d5f80c28bc4e78 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 18:28:19 +0000 Subject: [PATCH 5/5] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/archive.index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/routes/archive.index.tsx b/src/routes/archive.index.tsx index 1476f6e..2747d0a 100644 --- a/src/routes/archive.index.tsx +++ b/src/routes/archive.index.tsx @@ -340,10 +340,11 @@ function ArchivePage() { size="sm" variant="ghost" onClick={() => deleteRow(r.id)} - title="Delete row" + disabled={isLocked} + title={isLocked ? "Tab locked" : "Delete row"} className="text-destructive hover:text-destructive h-7 w-7 p-0" > - + {isLocked ? : } )}