Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat: enhance CreateTaskModal with improved layout and scrolling (#183)

Andrej452b80b19c40
diff --git a/apps/web/src/components/shared/modals/create-task-modal.tsx b/apps/web/src/components/shared/modals/create-task-modal.tsx
index e25f20daa..9c4a66f3f 100644
--- a/apps/web/src/components/shared/modals/create-task-modal.tsx
+++ b/apps/web/src/components/shared/modals/create-task-modal.tsx
@@ -110,9 +110,9 @@ function CreateTaskModal({ open, onClose, status }: CreateTaskModalProps) {
<Dialog.Root open={open} onOpenChange={handleClose}>
<Dialog.Portal>
<Dialog.Overlay className="fixed inset-0 bg-black/40 backdrop-blur-sm z-40" />
- <Dialog.Content className="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-lg">
- <div className="bg-white dark:bg-zinc-900 rounded-lg shadow-xl">
- <div className="flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800">
+ <Dialog.Content className="fixed z-50 left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-full max-w-lg max-h-[90vh]">
+ <div className="bg-white dark:bg-zinc-900 rounded-lg shadow-xl flex flex-col h-full max-h-[90vh]">
+ <div className="flex-shrink-0 flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800">
<Dialog.Title className="text-lg font-semibold text-zinc-900 dark:text-zinc-100">
New Task
</Dialog.Title>
@@ -125,150 +125,156 @@ function CreateTaskModal({ open, onClose, status }: CreateTaskModalProps) {
</Dialog.Close>
</div>
- <Form {...form}>
- <form onSubmit={form.handleSubmit(onSubmit)} className="p-4">
- <div className="space-y-4">
- <FormField
- control={form.control}
- name="title"
- render={({ field }) => (
- <FormItem>
- <FormLabel className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">
- Title
- </FormLabel>
- <FormControl>
- <Input
- {...field}
- autoFocus
- placeholder="Task title"
- className="bg-white dark:bg-zinc-800/50"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
-
- <FormField
- control={form.control}
- name="description"
- render={({ field }) => (
- <FormItem>
- <FormLabel className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">
- Description
- </FormLabel>
- <FormControl>
- <div className="border border-zinc-200 dark:border-zinc-700/50 rounded-md overflow-hidden">
- <Editor
- value={field.value || ""}
- onChange={(value) => field.onChange(value)}
- placeholder="Add a detailed description..."
+ <div className="overflow-y-auto flex-grow">
+ <Form {...form}>
+ <form onSubmit={form.handleSubmit(onSubmit)} className="p-4">
+ <div className="space-y-4">
+ <FormField
+ control={form.control}
+ name="title"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">
+ Title
+ </FormLabel>
+ <FormControl>
+ <Input
+ {...field}
+ autoFocus
+ placeholder="Task title"
+ className="bg-white dark:bg-zinc-800/50"
/>
- </div>
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
- <FormField
- control={form.control}
- name="email"
- render={({ field }) => (
- <FormItem>
- <FormLabel className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">
- Asignees
- </FormLabel>
- <FormControl>
- <Select
- {...field}
- options={[
- {
- value: "",
- label: "Unassigned",
- icon: (
- <UserIcon className="w-4 h-4 text-zinc-400" />
- ),
- },
- ...(users ?? []).map((user) => ({
- value: user.userEmail ?? "",
- label: user.userName ?? "",
- })),
- ]}
- placeholder="Select assignee"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
+ <FormField
+ control={form.control}
+ name="description"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">
+ Description
+ </FormLabel>
+ <FormControl>
+ <div className="border border-zinc-200 dark:border-zinc-700/50 rounded-md overflow-hidden">
+ <div className="max-h-[300px] overflow-y-auto">
+ <Editor
+ value={field.value || ""}
+ onChange={(value) => field.onChange(value)}
+ placeholder="Add a detailed description..."
+ />
+ </div>
+ </div>
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
- <FormField
- control={form.control}
- name="priority"
- render={({ field }) => (
- <FormItem>
- <FormLabel className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">
- Priority
- </FormLabel>
- <FormControl>
- <Select
- {...field}
- options={[
- {
- value: "low",
- label: "Low",
- icon: (
- <Flag className="w-4 h-4 text-blue-500" />
- ),
- },
- {
- value: "medium",
- label: "Medium",
- icon: (
- <Flag className="w-4 h-4 text-yellow-500" />
- ),
- },
- {
- value: "high",
- label: "High",
- icon: (
- <Flag className="w-4 h-4 text-orange-500" />
- ),
- },
- {
- value: "urgent",
- label: "Urgent",
- icon: <Flag className="w-4 h-4 text-red-500" />,
- },
- ]}
- placeholder="Select priority"
- />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- </div>
+ <FormField
+ control={form.control}
+ name="email"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">
+ Asignees
+ </FormLabel>
+ <FormControl>
+ <Select
+ {...field}
+ options={[
+ {
+ value: "",
+ label: "Unassigned",
+ icon: (
+ <UserIcon className="w-4 h-4 text-zinc-400" />
+ ),
+ },
+ ...(users ?? []).map((user) => ({
+ value: user.userEmail ?? "",
+ label: user.userName ?? "",
+ })),
+ ]}
+ placeholder="Select assignee"
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
- <div className="flex justify-end gap-2 mt-6">
- <Dialog.Close asChild>
+ <FormField
+ control={form.control}
+ name="priority"
+ render={({ field }) => (
+ <FormItem>
+ <FormLabel className="block text-sm font-medium text-zinc-900 dark:text-zinc-300 mb-1">
+ Priority
+ </FormLabel>
+ <FormControl>
+ <Select
+ {...field}
+ options={[
+ {
+ value: "low",
+ label: "Low",
+ icon: (
+ <Flag className="w-4 h-4 text-blue-500" />
+ ),
+ },
+ {
+ value: "medium",
+ label: "Medium",
+ icon: (
+ <Flag className="w-4 h-4 text-yellow-500" />
+ ),
+ },
+ {
+ value: "high",
+ label: "High",
+ icon: (
+ <Flag className="w-4 h-4 text-orange-500" />
+ ),
+ },
+ {
+ value: "urgent",
+ label: "Urgent",
+ icon: (
+ <Flag className="w-4 h-4 text-red-500" />
+ ),
+ },
+ ]}
+ placeholder="Select priority"
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ </div>
+
+ <div className="flex justify-end gap-2 mt-6">
+ <Dialog.Close asChild>
+ <Button
+ type="button"
+ className="bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700"
+ >
+ Cancel
+ </Button>
+ </Dialog.Close>
<Button
- type="button"
- className="bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700"
+ type="submit"
+ className="bg-indigo-600 text-white hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400"
>
- Cancel
+ Create Task
</Button>
- </Dialog.Close>
- <Button
- type="submit"
- className="bg-indigo-600 text-white hover:bg-indigo-500 dark:bg-indigo-500 dark:hover:bg-indigo-400"
- >
- Create Task
- </Button>
- </div>
- </form>
- </Form>
+ </div>
+ </form>
+ </Form>
+ </div>
</div>
</Dialog.Content>
</Dialog.Portal>