diff --git a/components/create-edit-todo-form.tsx b/components/create-edit-todo-form.tsx index 6d5f65a..c05cf61 100644 --- a/components/create-edit-todo-form.tsx +++ b/components/create-edit-todo-form.tsx @@ -18,7 +18,7 @@ import { cn, isPastDate } from '@/lib/utils' import { SelectLabels } from '@/modules/dashboard/components/select-labels' import { zodResolver } from '@hookform/resolvers/zod' import { useQuery } from '@tanstack/react-query' -import { CalendarIcon, CircleDotIcon, LucideIcon, PlayIcon, TagIcon } from 'lucide-react' +import { CalendarIcon, CircleDotIcon, LucideIcon, PlayIcon, TagIcon, UserIcon } from 'lucide-react' import { useState } from 'react' import { Controller, useForm, UseFormWatch } from 'react-hook-form' import { z } from 'zod' @@ -42,6 +42,12 @@ const todoFormSchema = z.object({ }, { error: 'Assignee is required' }, ), + createdBy: z + .object({ + label: z.string(), + value: z.string(), + }) + .optional(), }) export type TTodoFormData = z.infer @@ -328,6 +334,13 @@ export const CreateEditTodoForm = ({ )} /> + + {/* Created By (only in edit mode) */} + {mode === 'edit' && initialData?.createdBy && ( + +

{initialData.createdBy.label}

+
+ )} diff --git a/lib/todo-util.ts b/lib/todo-util.ts index 6842446..16625a6 100644 --- a/lib/todo-util.ts +++ b/lib/todo-util.ts @@ -62,6 +62,12 @@ export class TodoUtil { type: todo.assignee.user_type, } : undefined, + createdBy: todo.createdBy + ? { + label: todo.createdBy.name, + value: todo.createdBy.id, + } + : undefined, } } }