Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 15:54:27 +00:00
co-authored by renee-png
parent 3189284b06
commit 556b9e8ec0
+1 -28
View File
@@ -99,7 +99,7 @@ function WorkflowsPage() {
.insert({
name: newName.trim(),
description: newDesc.trim() || null,
kind: newKind,
kind: "task",
created_by: user.id,
})
.select()
@@ -110,18 +110,11 @@ 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);
@@ -182,13 +175,6 @@ function WorkflowsPage() {
>
<div className="flex items-center justify-between gap-2">
<div className="font-medium text-sm truncate">{t.name}</div>
<span className={`text-[10px] px-1.5 py-0.5 rounded shrink-0 ${
t.kind === "collection"
? "bg-amber-500/15 text-amber-700 dark:text-amber-300"
: "bg-blue-500/15 text-blue-700 dark:text-blue-300"
}`}>
{t.kind === "collection" ? "Collection" : "Task"}
</span>
</div>
{t.description && <div className="text-xs text-muted-foreground truncate">{t.description}</div>}
</button>
@@ -211,19 +197,6 @@ function WorkflowsPage() {
)}
</div>
<div className="flex items-center gap-2 shrink-0">
<Label className="text-xs text-muted-foreground">Type</Label>
<Select
value={selected.kind}
onValueChange={(v) => updateTemplateKind(selected.id, v as "task" | "collection")}
>
<SelectTrigger className="w-36 h-8">
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="task">Task workflow</SelectItem>
<SelectItem value="collection">Collection workflow</SelectItem>
</SelectContent>
</Select>
<Button variant="ghost" size="sm" onClick={() => deleteTemplate(selected.id)}>
<Trash2 className="h-3.5 w-3.5 text-destructive" />
</Button>