Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion components/create-edit-todo-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -42,6 +42,12 @@ const todoFormSchema = z.object({
},
{ error: 'Assignee is required' },
),
createdBy: z
.object({
label: z.string(),
value: z.string(),
})
.optional(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can createdBy be optional in a task?

Copy link
Contributor Author

@shobhan-sundar-goutam shobhan-sundar-goutam Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional is there to avoid any issues for Create Task. createdBy is used only for edit todo modal. Please check the new PR #204

})

export type TTodoFormData = z.infer<typeof todoFormSchema>
Expand Down Expand Up @@ -328,6 +334,13 @@ export const CreateEditTodoForm = ({
</FormInput>
)}
/>

{/* Created By (only in edit mode) */}
{mode === 'edit' && initialData?.createdBy && (
<FormInput label="Created By" htmlFor="createdBy" icon={UserIcon}>
<p className="pl-3 text-sm text-gray-700">{initialData.createdBy.label}</p>
</FormInput>
)}
</div>
</div>

Expand Down
6 changes: 6 additions & 0 deletions lib/todo-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}