diff --git a/src/components/todos/create-edit-todo-form.tsx b/src/components/todos/create-edit-todo-form.tsx index 733ec7b..3faeaad 100644 --- a/src/components/todos/create-edit-todo-form.tsx +++ b/src/components/todos/create-edit-todo-form.tsx @@ -16,7 +16,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' @@ -40,6 +40,12 @@ const todoFormSchema = z.object({ }, { error: 'Assignee is required' }, ), + createdBy: z + .object({ + label: z.string(), + value: z.string(), + }) + .optional(), }) export type TTodoFormData = z.infer @@ -134,6 +140,7 @@ export const CreateEditTodoForm = ({ status: initialData?.status || TASK_STATUS_ENUM.TODO, labels: initialData?.labels || [], assignee: initialData?.assignee || undefined, + createdBy: initialData?.createdBy || undefined, }, }) @@ -327,6 +334,28 @@ export const CreateEditTodoForm = ({ )} /> + + {mode === 'edit' && ( + ( + + + + )} + /> + )} diff --git a/src/components/todos/todo-list-table.tsx b/src/components/todos/todo-list-table.tsx index 88af9b8..247889a 100644 --- a/src/components/todos/todo-list-table.tsx +++ b/src/components/todos/todo-list-table.tsx @@ -34,7 +34,6 @@ export const TodoListTableHeader = ({ Label Priority Assignee - Created By Due Date {showDeferredColumn && Deferred Until} {showActions && Actions} @@ -75,8 +74,6 @@ const TodoListTableRow = ({ {todo.assignee?.assignee_name ?? '--'} - {todo.createdBy?.name ?? '--'} - {todo.dueAt ? new DateUtil(todo.dueAt).format(DateFormats.D_MMM_YYYY) : '--'} diff --git a/src/lib/todo-util.ts b/src/lib/todo-util.ts index 716bb4d..c80a32d 100644 --- a/src/lib/todo-util.ts +++ b/src/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, } } } diff --git a/src/modules/teams/team-tasks.tsx b/src/modules/teams/team-tasks.tsx index 46cfe35..a8938bd 100644 --- a/src/modules/teams/team-tasks.tsx +++ b/src/modules/teams/team-tasks.tsx @@ -48,8 +48,6 @@ const TodoListTableRow = ({ todo, team }: TodoListTableRowProps) => { {todo.assignee?.assignee_name ?? '--'} - {todo.createdBy?.name ?? '--'} - {todo.dueAt ? new DateUtil(todo.dueAt).format(DateFormats.D_MMM_YYYY) : '--'}