Skip to content
Merged
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
2 changes: 1 addition & 1 deletion api/tasks/tasks.enum.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export enum TASK_STATUS_ENUM {
TODO = 'TODO',
IN_PROGRESS = 'IN_PROGRESS',
COMPLETED = 'COMPLETED',
DONE = 'DONE',
}

export enum TASK_PRIORITY_ENUM {
Expand Down
32 changes: 31 additions & 1 deletion components/create-edit-todo-form.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { LablesApi } from '@/api/labels/labels.api'
import { TASK_PRIORITY_ENUM } from '@/api/tasks/tasks.enum'
import { TASK_PRIORITY_ENUM, TASK_STATUS_ENUM } from '@/api/tasks/tasks.enum'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
Expand All @@ -26,6 +26,7 @@ const todoFormSchema = z.object({
description: z.string().min(1, 'Description is required'),
dueDate: z.string().min(1, 'Due date is required'),
priority: z.enum(TASK_PRIORITY_ENUM).optional(),
status: z.enum(TASK_STATUS_ENUM).optional(),
labels: z.array(z.string()).optional(),
})

Expand Down Expand Up @@ -80,6 +81,7 @@ export const CreateEditTodoForm = ({
description: initialData?.description || '',
dueDate: initialData?.dueDate || '',
priority: initialData?.priority || TASK_PRIORITY_ENUM.LOW,
status: initialData?.status || TASK_STATUS_ENUM.TODO,
labels: initialData?.labels || [],
},
})
Expand Down Expand Up @@ -188,6 +190,34 @@ export const CreateEditTodoForm = ({
/>
</div>

{/*status*/}
Copy link

Choose a reason for hiding this comment

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

Unnecessary Comment category Readability

Tell me more
What is the issue?

The comment 'status' adds no value and doesn't follow the capitalization pattern of other section comments.

Why this matters

Inconsistent or redundant comments can create noise and make code harder to scan.

Suggested change ∙ Feature Preview

Remove the comment entirely as the code is self-documenting through its field label.

Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.

<div className="flex items-center gap-4">
<div className="flex w-28 items-center gap-2">
<Label htmlFor="priority">Status</Label>
</div>
<Controller
control={control}
name="status"
render={({ field }) => (
<div className="flex-1">
<Select
value={field.value}
onValueChange={(value) => field.onChange(value as TASK_STATUS_ENUM)}
>
<SelectTrigger className="w-full">
<SelectValue placeholder="Select task status" />
</SelectTrigger>
<SelectContent>
<SelectItem value={TASK_STATUS_ENUM.TODO}>Todo</SelectItem>
<SelectItem value={TASK_STATUS_ENUM.IN_PROGRESS}>In Progress</SelectItem>
<SelectItem value={TASK_STATUS_ENUM.DONE}>Done</SelectItem>
</SelectContent>
</Select>
</div>
)}
/>
</div>

{/* Label */}
<Controller
control={control}
Expand Down
2 changes: 2 additions & 0 deletions components/edit-task-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const EditTaskButton = ({ task }: EditTaskButtonProps) => {
? (task.labels as { id: string }[]).map((l) => l.id)
: (task.labels as string[])
: [],
status: task.status,
}}
onSubmit={(value) =>
updateTaskMutation.mutate({
Expand All @@ -53,6 +54,7 @@ export const EditTaskButton = ({ task }: EditTaskButtonProps) => {
dueAt: value.dueDate,
priority: value.priority,
description: value.description,
status: value.status,
labels: value.labels ?? [],
})
}
Expand Down
2 changes: 1 addition & 1 deletion components/todo-status-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { cn } from '@/lib/utils'
export const TASK_STATUS_TO_TEXT_MAP: Record<TASK_STATUS_ENUM, string> = {
[TASK_STATUS_ENUM.TODO]: 'Todo',
[TASK_STATUS_ENUM.IN_PROGRESS]: 'In Progress',
[TASK_STATUS_ENUM.COMPLETED]: 'Completed',
[TASK_STATUS_ENUM.DONE]: 'Done',
}

type TodoStatusTableProps = {
Expand Down
1 change: 1 addition & 0 deletions modules/dashboard/components/create-todo-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const CreateTodoButton = () => {
title: value.title,
description: value.description,
priority: value.priority,
status: value.status,
dueAt: value.dueDate,
labels: value.labels,
})
Expand Down