From 6d2e33c44fcf3899bd4b191d004784166f0534ac 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 00:03:10 +0000 Subject: [PATCH 1/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/integrations/supabase/types.ts | 3 +++ ...19000306_4915ac52-4c1f-4f01-bddb-96606c4072c4.sql | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 supabase/migrations/20260419000306_4915ac52-4c1f-4f01-bddb-96606c4072c4.sql diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index 8107b43..cf66644 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -3013,6 +3013,7 @@ export type Database = { created_by: string | null description: string | null id: string + kind: string name: string updated_at: string } @@ -3021,6 +3022,7 @@ export type Database = { created_by?: string | null description?: string | null id?: string + kind?: string name: string updated_at?: string } @@ -3029,6 +3031,7 @@ export type Database = { created_by?: string | null description?: string | null id?: string + kind?: string name?: string updated_at?: string } diff --git a/supabase/migrations/20260419000306_4915ac52-4c1f-4f01-bddb-96606c4072c4.sql b/supabase/migrations/20260419000306_4915ac52-4c1f-4f01-bddb-96606c4072c4.sql new file mode 100644 index 0000000..c586f18 --- /dev/null +++ b/supabase/migrations/20260419000306_4915ac52-4c1f-4f01-bddb-96606c4072c4.sql @@ -0,0 +1,12 @@ +ALTER TABLE public.workflow_templates + ADD COLUMN IF NOT EXISTS kind text NOT NULL DEFAULT 'task'; + +ALTER TABLE public.workflow_templates + DROP CONSTRAINT IF EXISTS workflow_templates_kind_check; + +ALTER TABLE public.workflow_templates + ADD CONSTRAINT workflow_templates_kind_check + CHECK (kind IN ('task','collection')); + +CREATE INDEX IF NOT EXISTS workflow_templates_kind_idx + ON public.workflow_templates (kind); \ No newline at end of file From d9273a1acea63917960fb8c21c5e9a4f13b43d3e 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 00:03:30 +0000 Subject: [PATCH 2/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/collections/apply-collection-workflow-dialog.tsx | 1 + src/components/tasks/apply-workflow-picker-dialog.tsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/collections/apply-collection-workflow-dialog.tsx b/src/components/collections/apply-collection-workflow-dialog.tsx index e725b46..eb76263 100644 --- a/src/components/collections/apply-collection-workflow-dialog.tsx +++ b/src/components/collections/apply-collection-workflow-dialog.tsx @@ -50,6 +50,7 @@ export function ApplyCollectionWorkflowDialog({ supabase .from("workflow_templates") .select("id, name") + .eq("kind", "collection") .order("name") .then(({ data }) => setTemplates((data ?? []) as Template[])); setTemplateId(null); diff --git a/src/components/tasks/apply-workflow-picker-dialog.tsx b/src/components/tasks/apply-workflow-picker-dialog.tsx index cf84d08..edd33e0 100644 --- a/src/components/tasks/apply-workflow-picker-dialog.tsx +++ b/src/components/tasks/apply-workflow-picker-dialog.tsx @@ -61,7 +61,7 @@ export function ApplyWorkflowPickerDialog({ setCaseId(null); setStartDate(new Date()); Promise.all([ - supabase.from("workflow_templates").select("id, name").order("name"), + supabase.from("workflow_templates").select("id, name").eq("kind", "task").order("name"), supabase .from("cases") .select("id, case_number, title") From a229f9333af6ad90cdc95811499f30b5c8ba05b9 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 00:03:38 +0000 Subject: [PATCH 3/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/tasks/apply-workflow-dialog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/tasks/apply-workflow-dialog.tsx b/src/components/tasks/apply-workflow-dialog.tsx index e55754a..0fe0421 100644 --- a/src/components/tasks/apply-workflow-dialog.tsx +++ b/src/components/tasks/apply-workflow-dialog.tsx @@ -51,6 +51,7 @@ export function ApplyWorkflowDialog({ supabase .from("workflow_templates") .select("id, name") + .eq("kind", "task") .order("name") .then(({ data }) => setTemplates((data ?? []) as Template[])); setTemplateId(null); From 5231e70b7cc8298430f63eb12086612cfaaba6db 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 00:03:52 +0000 Subject: [PATCH 4/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.workflows.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/routes/settings.workflows.tsx b/src/routes/settings.workflows.tsx index 4137aaf..e978c54 100644 --- a/src/routes/settings.workflows.tsx +++ b/src/routes/settings.workflows.tsx @@ -32,6 +32,7 @@ interface Template { name: string; description: string | null; created_by: string | null; + kind: "task" | "collection"; } interface TemplateTask { id: string; @@ -58,6 +59,7 @@ function WorkflowsPage() { const [newOpen, setNewOpen] = useState(false); const [newName, setNewName] = useState(""); const [newDesc, setNewDesc] = useState(""); + const [newKind, setNewKind] = useState<"task" | "collection">("task"); const [newTask, setNewTask] = useState({ title: "", days: 7, priority: "normal" as const }); const loadTemplates = useCallback(async () => { @@ -95,7 +97,12 @@ function WorkflowsPage() { if (!user || !newName.trim()) return; const { data, error } = await supabase .from("workflow_templates") - .insert({ name: newName.trim(), description: newDesc.trim() || null, created_by: user.id }) + .insert({ + name: newName.trim(), + description: newDesc.trim() || null, + kind: newKind, + created_by: user.id, + }) .select() .single(); if (error) { @@ -104,11 +111,18 @@ function WorkflowsPage() { } setNewName(""); setNewDesc(""); + setNewKind("task"); setNewOpen(false); await loadTemplates(); setSelected(data as Template); }; + const updateTemplateKind = async (id: string, kind: "task" | "collection") => { + await supabase.from("workflow_templates").update({ kind }).eq("id", id); + await loadTemplates(); + if (selected?.id === id) setSelected({ ...selected, kind }); + }; + const deleteTemplate = async (id: string) => { if (!confirm("Delete this workflow template?")) return; await supabase.from("workflow_templates").delete().eq("id", id); From 224b4edcad33ed100c0d87255c87437ba592c5a4 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 00:04:11 +0000 Subject: [PATCH 5/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.workflows.tsx | 40 ++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/src/routes/settings.workflows.tsx b/src/routes/settings.workflows.tsx index e978c54..854feb6 100644 --- a/src/routes/settings.workflows.tsx +++ b/src/routes/settings.workflows.tsx @@ -181,7 +181,16 @@ function WorkflowsPage() { selected?.id === t.id ? "bg-accent" : "" }`} > -
{t.name}
+
+
{t.name}
+ + {t.kind === "collection" ? "Collection" : "Task"} + +
{t.description &&
{t.description}
} ))} @@ -195,16 +204,31 @@ function WorkflowsPage() { ) : (
-
-
-
{selected.name}
+
+
+
{selected.name}
{selected.description && ( -
{selected.description}
+
{selected.description}
)}
- +
+ + + +
{tasks.map((t) => ( From 132f8ca659017307bdf90e041c345ababb22d073 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 00:04:26 +0000 Subject: [PATCH 6/6] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.workflows.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/routes/settings.workflows.tsx b/src/routes/settings.workflows.tsx index 854feb6..3cef2da 100644 --- a/src/routes/settings.workflows.tsx +++ b/src/routes/settings.workflows.tsx @@ -321,6 +321,18 @@ function WorkflowsPage() {