From 2aa15c6849bd0e08dd0e8f4fd7a48c6093bc7dcf Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 10 Sep 2026 03:05:41 +0000 Subject: [PATCH] feat: open new task entry in a Radix dialog instead of inline card Replaces the inline "Start New Task" card with the shadcn/Radix Dialog component, capped at 980px wide and scaled to 90dvw on smaller screens so it adapts cleanly down to mobile. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_011mLaREDWvtuXWtmmjKkwc4 --- src/components/NewTaskForm.tsx | 310 +++++++++++++++++---------------- 1 file changed, 159 insertions(+), 151 deletions(-) diff --git a/src/components/NewTaskForm.tsx b/src/components/NewTaskForm.tsx index 783b58a..8a273cd 100644 --- a/src/components/NewTaskForm.tsx +++ b/src/components/NewTaskForm.tsx @@ -1,6 +1,12 @@ import React, { useState } from "react"; import { Button } from "@/components/ui/button"; -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { ResponsiveSelect } from "@/components/ui/responsive-select"; @@ -36,6 +42,14 @@ export const NewTaskForm: React.FC = ({ onSubmit, onCancel, de (c) => c.id === selectedCategory ); + const resetForm = () => { + setTitle(""); + setTitleTouched(false); + setDescription(""); + setSelectedProject(""); + setSelectedCategory(""); + }; + const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); setTitleTouched(true); @@ -47,168 +61,162 @@ export const NewTaskForm: React.FC = ({ onSubmit, onCancel, de selectedProjectData?.client, selectedCategoryData?.id ); - setTitle(""); - setTitleTouched(false); - setDescription(""); - setSelectedProject(""); - setSelectedCategory(""); + resetForm(); setIsOpen(false); } }; - const titleError = titleTouched && !title.trim() ? "Task title is required." : ""; + const handleCancel = () => { + setIsOpen(false); + resetForm(); + onCancel?.(); + }; - if (!isOpen) { - return ( - - ); - } + const titleError = titleTouched && !title.trim() ? "Task title is required." : ""; return ( - - - Start New Task - - -
-
- - setTitle(e.target.value)} - onBlur={() => setTitleTouched(true)} - placeholder="What are you working on?" - aria-required="true" - aria-invalid={!!titleError} - aria-describedby={titleError ? "new-task-title-error" : undefined} - autoFocus - /> - {titleError && ( - - )} -
+ <> + {!isOpen && ( + + )} -
-
- - Markdown supported -
- - - Edit - Preview - - -