diff --git a/apps/web/components/tasks/task-create-dialog.tsx b/apps/web/components/tasks/task-create-dialog.tsx index 434e5c9..93ad31f 100644 --- a/apps/web/components/tasks/task-create-dialog.tsx +++ b/apps/web/components/tasks/task-create-dialog.tsx @@ -21,6 +21,7 @@ import { SelectValue, } from '@/components/ui/select'; import { toast } from 'sonner'; +import { TaskTemplates } from '@/components/tasks/task-templates'; interface TaskCreateDialogProps { open: boolean; @@ -107,6 +108,13 @@ export function TaskCreateDialog({ Create a new task to track your work.
+ { + setTitle(t.title); + setDescription(t.description); + setPriority(t.priority); + setStatus(t.status); + }} /> +
void; +} + +export function TaskTemplates({ onSelect }: TaskTemplatesProps) { + const [templates] = useState(getTemplates); + + const handleChange = useCallback( + (value: string) => { + const template = templates.find((t) => t.name === value); + if (template) { + onSelect(template); + toast.success('Template applied'); + } + }, + [templates, onSelect] + ); + + if (templates.length === 0) return null; + + return ( +
+ + +
+ ); +} + +export type { TaskTemplate };