From a985e7de817b7dc0c5170e64648d9a3551c37555 Mon Sep 17 00:00:00 2001 From: Shobhan Sundar Goutam Date: Fri, 12 Sep 2025 01:27:31 +0530 Subject: [PATCH 1/7] feat: display created by in Edit Todo modal --- src/components/todos/create-edit-todo-form.tsx | 15 ++++++++++++++- src/lib/todo-util.ts | 6 ++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/todos/create-edit-todo-form.tsx b/src/components/todos/create-edit-todo-form.tsx index 1f6fd39..1bd1c9c 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 @@ -326,6 +332,13 @@ export const CreateEditTodoForm = ({ )} /> + + {/* Created By (only in edit mode) */} + {mode === 'edit' && initialData?.createdBy && ( + +

{initialData.createdBy.label}

+
+ )} 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, } } } From 84beabada1b800a8cc55ed8218466123ed1b5c4b Mon Sep 17 00:00:00 2001 From: Shobhan Sundar Goutam Date: Fri, 12 Sep 2025 01:59:25 +0530 Subject: [PATCH 2/7] refactor: removed unnecessary htmlFor --- src/components/todos/create-edit-todo-form.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/todos/create-edit-todo-form.tsx b/src/components/todos/create-edit-todo-form.tsx index 1bd1c9c..a8d0256 100644 --- a/src/components/todos/create-edit-todo-form.tsx +++ b/src/components/todos/create-edit-todo-form.tsx @@ -335,7 +335,7 @@ export const CreateEditTodoForm = ({ {/* Created By (only in edit mode) */} {mode === 'edit' && initialData?.createdBy && ( - +

{initialData.createdBy.label}

)} From df173026950b7fe177ac6af2e535799bfd31a860 Mon Sep 17 00:00:00 2001 From: Shobhan Sundar Goutam Date: Mon, 15 Sep 2025 01:52:14 +0530 Subject: [PATCH 3/7] chore: remove comment for created by field --- src/components/todos/create-edit-todo-form.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/todos/create-edit-todo-form.tsx b/src/components/todos/create-edit-todo-form.tsx index a8d0256..e60fd4d 100644 --- a/src/components/todos/create-edit-todo-form.tsx +++ b/src/components/todos/create-edit-todo-form.tsx @@ -333,7 +333,6 @@ export const CreateEditTodoForm = ({ )} /> - {/* Created By (only in edit mode) */} {mode === 'edit' && initialData?.createdBy && (

{initialData.createdBy.label}

From 897f52f80261032b5124e83c41349c52a3c58f9d Mon Sep 17 00:00:00 2001 From: Shobhan Sundar Goutam Date: Mon, 15 Sep 2025 03:00:17 +0530 Subject: [PATCH 4/7] refactor: remove Created By column --- src/api/tasks/tasks.types.ts | 1 - src/components/todos/todo-list-table.tsx | 3 --- src/modules/teams/team-tasks.tsx | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/api/tasks/tasks.types.ts b/src/api/tasks/tasks.types.ts index c1818be..b70cfb8 100644 --- a/src/api/tasks/tasks.types.ts +++ b/src/api/tasks/tasks.types.ts @@ -102,7 +102,6 @@ export type TWatchListTask = { labels?: TLabel[] dueAt: string createdAt: string - createdBy?: TTaskCreatedBy | null watchlistId: string } 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/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) : '--'} From b0859647e8337ecf644dd34eea609a46722988a5 Mon Sep 17 00:00:00 2001 From: Shobhan Sundar Goutam Date: Mon, 15 Sep 2025 03:06:03 +0530 Subject: [PATCH 5/7] refactor: remove createdBy from watchlist.mock.ts --- src/mocks/data/watchlist.mock.ts | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/mocks/data/watchlist.mock.ts b/src/mocks/data/watchlist.mock.ts index 6d1dab2..2092434 100644 --- a/src/mocks/data/watchlist.mock.ts +++ b/src/mocks/data/watchlist.mock.ts @@ -41,10 +41,6 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-07-22T18:30:00Z', createdAt: '2025-07-18T08:27:10.653750Z', - createdBy: { - id: '68702ff8e331b8aa7a58fff3', - name: 'John Doe', - }, watchlistId: '687a09b65d69510ea7c97f22', userId: '687544d3814217e020e3d03a', }, @@ -72,10 +68,6 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-08-19T18:30:00Z', createdAt: '2025-07-29T19:18:55.179799Z', - createdBy: { - id: '68702ff8e331b8aa7a58fff3', - name: 'John Doe', - }, watchlistId: '68891eb8247494701cc45703', userId: '68702893e331b8aa7a58ffe7', }, @@ -103,10 +95,6 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-08-29T18:30:00Z', createdAt: '2025-08-04T18:27:11.888243Z', - createdBy: { - id: '68702ff8e331b8aa7a58fff3', - name: 'John Doe', - }, watchlistId: '68910ec2087c62e482073c3e', userId: '6870289de331b8aa7a58ffe8', }, @@ -134,10 +122,6 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-08-12T18:30:00Z', createdAt: '2025-07-30T09:43:33.622526Z', - createdBy: { - id: '68702ff8e331b8aa7a58fff3', - name: 'John Doe', - }, watchlistId: '6893741be25784697eb0f64a', userId: '68704332e331b8aa7a58ffff', }, @@ -165,10 +149,6 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-07-31T18:30:00Z', createdAt: '2025-07-29T19:34:14.042878Z', - createdBy: { - id: '68702ff8e331b8aa7a58fff3', - name: 'John Doe', - }, watchlistId: '6898597b5cc229c665988778', userId: '68763311d460e707c18727f4', }, @@ -196,10 +176,6 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-08-25T18:30:00Z', createdAt: '2025-07-30T10:00:00.000000Z', - createdBy: { - id: '68702ff8e331b8aa7a58fff3', - name: 'John Doe', - }, watchlistId: '6898597b5cc229c665988779', userId: '6875653d814217e020e3d069', }, From 88867d8c197e6f175dc8cbadd3a42944063af843 Mon Sep 17 00:00:00 2001 From: Shobhan Sundar Goutam Date: Tue, 16 Sep 2025 01:42:13 +0530 Subject: [PATCH 6/7] fix: keeping creadetBy field in TWatchListTask as it is being used in other parts --- src/api/tasks/tasks.types.ts | 1 + src/mocks/data/watchlist.mock.ts | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/api/tasks/tasks.types.ts b/src/api/tasks/tasks.types.ts index b70cfb8..c1818be 100644 --- a/src/api/tasks/tasks.types.ts +++ b/src/api/tasks/tasks.types.ts @@ -102,6 +102,7 @@ export type TWatchListTask = { labels?: TLabel[] dueAt: string createdAt: string + createdBy?: TTaskCreatedBy | null watchlistId: string } diff --git a/src/mocks/data/watchlist.mock.ts b/src/mocks/data/watchlist.mock.ts index 2092434..6d1dab2 100644 --- a/src/mocks/data/watchlist.mock.ts +++ b/src/mocks/data/watchlist.mock.ts @@ -41,6 +41,10 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-07-22T18:30:00Z', createdAt: '2025-07-18T08:27:10.653750Z', + createdBy: { + id: '68702ff8e331b8aa7a58fff3', + name: 'John Doe', + }, watchlistId: '687a09b65d69510ea7c97f22', userId: '687544d3814217e020e3d03a', }, @@ -68,6 +72,10 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-08-19T18:30:00Z', createdAt: '2025-07-29T19:18:55.179799Z', + createdBy: { + id: '68702ff8e331b8aa7a58fff3', + name: 'John Doe', + }, watchlistId: '68891eb8247494701cc45703', userId: '68702893e331b8aa7a58ffe7', }, @@ -95,6 +103,10 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-08-29T18:30:00Z', createdAt: '2025-08-04T18:27:11.888243Z', + createdBy: { + id: '68702ff8e331b8aa7a58fff3', + name: 'John Doe', + }, watchlistId: '68910ec2087c62e482073c3e', userId: '6870289de331b8aa7a58ffe8', }, @@ -122,6 +134,10 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-08-12T18:30:00Z', createdAt: '2025-07-30T09:43:33.622526Z', + createdBy: { + id: '68702ff8e331b8aa7a58fff3', + name: 'John Doe', + }, watchlistId: '6893741be25784697eb0f64a', userId: '68704332e331b8aa7a58ffff', }, @@ -149,6 +165,10 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-07-31T18:30:00Z', createdAt: '2025-07-29T19:34:14.042878Z', + createdBy: { + id: '68702ff8e331b8aa7a58fff3', + name: 'John Doe', + }, watchlistId: '6898597b5cc229c665988778', userId: '68763311d460e707c18727f4', }, @@ -176,6 +196,10 @@ export const mockWatchlistTasks: TWatchListTask[] = [ ], dueAt: '2025-08-25T18:30:00Z', createdAt: '2025-07-30T10:00:00.000000Z', + createdBy: { + id: '68702ff8e331b8aa7a58fff3', + name: 'John Doe', + }, watchlistId: '6898597b5cc229c665988779', userId: '6875653d814217e020e3d069', }, From b8e8394dd22309d4da037911aff03787bcd132f1 Mon Sep 17 00:00:00 2001 From: Shobhan Sundar Goutam Date: Wed, 17 Sep 2025 20:41:29 +0530 Subject: [PATCH 7/7] fix: modified condition and used useForm with input --- .../todos/create-edit-todo-form.tsx | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/todos/create-edit-todo-form.tsx b/src/components/todos/create-edit-todo-form.tsx index e60fd4d..e69f8bf 100644 --- a/src/components/todos/create-edit-todo-form.tsx +++ b/src/components/todos/create-edit-todo-form.tsx @@ -140,6 +140,7 @@ export const CreateEditTodoForm = ({ status: initialData?.status || TASK_STATUS_ENUM.TODO, labels: initialData?.labels || [], assignee: initialData?.assignee || undefined, + createdBy: initialData?.createdBy || undefined, }, }) @@ -333,10 +334,26 @@ export const CreateEditTodoForm = ({ )} /> - {mode === 'edit' && initialData?.createdBy && ( - -

{initialData.createdBy.label}

-
+ {mode === 'edit' && ( + ( + + + + )} + /> )}