Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-20 00:15:50 +00:00
co-authored by renee-png
parent 2d6cec2b19
commit 6ba25749a2
+33
View File
@@ -272,6 +272,39 @@ function CollectionDetailRoute() {
else refreshTasks();
};
const closeCollection = async () => {
if (!collection) return;
if (!confirm("Close this collection? Open tasks will be hidden but data is preserved. You can reopen anytime.")) return;
setClosingBusy(true);
const { error } = await supabase
.from("collections")
.update({ status: "closed", closed_at: new Date().toISOString().slice(0, 10) })
.eq("id", collection.id);
setClosingBusy(false);
if (error) {
toast.error("Could not close", { description: error.message });
return;
}
toast.success("Collection closed");
setReload((r) => r + 1);
};
const reopenCollection = async () => {
if (!collection) return;
setClosingBusy(true);
const { error } = await supabase
.from("collections")
.update({ status: "late_notice", closed_at: null })
.eq("id", collection.id);
setClosingBusy(false);
if (error) {
toast.error("Could not reopen", { description: error.message });
return;
}
toast.success("Collection reopened");
setReload((r) => r + 1);
};
if (loading) {
return (
<ProtectedLayout>