Add review column
This commit is contained in:
2
backend/migrations/003_add_inreview_status.sql
Normal file
2
backend/migrations/003_add_inreview_status.sql
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
-- Add 'inreview' to task_status enum
|
||||||
|
ALTER TYPE task_status ADD VALUE 'inreview';
|
||||||
@@ -6,10 +6,12 @@ use uuid::Uuid;
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Type, Serialize, Deserialize, PartialEq, TS)]
|
#[derive(Debug, Clone, Type, Serialize, Deserialize, PartialEq, TS)]
|
||||||
#[sqlx(type_name = "task_status", rename_all = "lowercase")]
|
#[sqlx(type_name = "task_status", rename_all = "lowercase")]
|
||||||
|
#[serde(rename_all = "lowercase")]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
pub enum TaskStatus {
|
pub enum TaskStatus {
|
||||||
Todo,
|
Todo,
|
||||||
InProgress,
|
InProgress,
|
||||||
|
InReview,
|
||||||
Done,
|
Done,
|
||||||
Cancelled,
|
Cancelled,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,13 +34,14 @@ import {
|
|||||||
KanbanCard,
|
KanbanCard,
|
||||||
type DragEndEvent
|
type DragEndEvent
|
||||||
} from '@/components/ui/shadcn-io/kanban'
|
} from '@/components/ui/shadcn-io/kanban'
|
||||||
|
import type { TaskStatus } from '../../../shared/types'
|
||||||
|
|
||||||
interface Task {
|
interface Task {
|
||||||
id: string
|
id: string
|
||||||
project_id: string
|
project_id: string
|
||||||
title: string
|
title: string
|
||||||
description: string | null
|
description: string | null
|
||||||
status: 'Todo' | 'InProgress' | 'Done' | 'Cancelled'
|
status: TaskStatus
|
||||||
created_at: string
|
created_at: string
|
||||||
updated_at: string
|
updated_at: string
|
||||||
}
|
}
|
||||||
@@ -61,18 +62,23 @@ interface ApiResponse<T> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
const statusLabels = {
|
// All possible task statuses from shared types
|
||||||
Todo: 'To Do',
|
const allTaskStatuses: TaskStatus[] = ['todo', 'inprogress', 'inreview', 'done', 'cancelled']
|
||||||
InProgress: 'In Progress',
|
|
||||||
Done: 'Done',
|
const statusLabels: Record<TaskStatus, string> = {
|
||||||
Cancelled: 'Cancelled'
|
todo: 'To Do',
|
||||||
|
inprogress: 'In Progress',
|
||||||
|
inreview: 'In Review',
|
||||||
|
done: 'Done',
|
||||||
|
cancelled: 'Cancelled'
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusBoardColors = {
|
const statusBoardColors: Record<TaskStatus, string> = {
|
||||||
Todo: '#64748b',
|
todo: '#64748b',
|
||||||
InProgress: '#3b82f6',
|
inprogress: '#3b82f6',
|
||||||
Done: '#22c55e',
|
inreview: '#f59e0b',
|
||||||
Cancelled: '#ef4444'
|
done: '#22c55e',
|
||||||
|
cancelled: '#ef4444'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ProjectTasks() {
|
export function ProjectTasks() {
|
||||||
@@ -91,7 +97,7 @@ export function ProjectTasks() {
|
|||||||
const [newTaskDescription, setNewTaskDescription] = useState('')
|
const [newTaskDescription, setNewTaskDescription] = useState('')
|
||||||
const [editTaskTitle, setEditTaskTitle] = useState('')
|
const [editTaskTitle, setEditTaskTitle] = useState('')
|
||||||
const [editTaskDescription, setEditTaskDescription] = useState('')
|
const [editTaskDescription, setEditTaskDescription] = useState('')
|
||||||
const [editTaskStatus, setEditTaskStatus] = useState<Task['status']>('Todo')
|
const [editTaskStatus, setEditTaskStatus] = useState<Task['status']>('todo')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (projectId) {
|
if (projectId) {
|
||||||
@@ -276,15 +282,22 @@ export function ProjectTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const groupTasksByStatus = () => {
|
const groupTasksByStatus = () => {
|
||||||
const groups: Record<Task['status'], Task[]> = {
|
const groups: Record<TaskStatus, Task[]> = {} as Record<TaskStatus, Task[]>
|
||||||
Todo: [],
|
|
||||||
InProgress: [],
|
// Initialize groups for all possible statuses
|
||||||
Done: [],
|
allTaskStatuses.forEach(status => {
|
||||||
Cancelled: []
|
groups[status] = []
|
||||||
}
|
})
|
||||||
|
|
||||||
tasks.forEach(task => {
|
tasks.forEach(task => {
|
||||||
groups[task.status].push(task)
|
// Convert old capitalized status to lowercase if needed
|
||||||
|
const normalizedStatus = task.status.toLowerCase() as TaskStatus
|
||||||
|
if (groups[normalizedStatus]) {
|
||||||
|
groups[normalizedStatus].push(task)
|
||||||
|
} else {
|
||||||
|
// Default to todo if status doesn't match any expected value
|
||||||
|
groups['todo'].push(task)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return groups
|
return groups
|
||||||
@@ -494,10 +507,11 @@ export function ProjectTasks() {
|
|||||||
<SelectValue />
|
<SelectValue />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="Todo">To Do</SelectItem>
|
<SelectItem value="todo">To Do</SelectItem>
|
||||||
<SelectItem value="InProgress">In Progress</SelectItem>
|
<SelectItem value="inprogress">In Progress</SelectItem>
|
||||||
<SelectItem value="Done">Done</SelectItem>
|
<SelectItem value="inreview">In Review</SelectItem>
|
||||||
<SelectItem value="Cancelled">Cancelled</SelectItem>
|
<SelectItem value="done">Done</SelectItem>
|
||||||
|
<SelectItem value="cancelled">Cancelled</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ type CreateTask = { project_id: string, title: string, description: string | nul
|
|||||||
|
|
||||||
type Task = { id: string, project_id: string, title: string, description: string | null, status: TaskStatus, created_at: string, updated_at: string, };
|
type Task = { id: string, project_id: string, title: string, description: string | null, status: TaskStatus, created_at: string, updated_at: string, };
|
||||||
|
|
||||||
type TaskStatus = "Todo" | "InProgress" | "Done" | "Cancelled";
|
type TaskStatus = "todo" | "inprogress" | "inreview" | "done" | "cancelled";
|
||||||
|
|
||||||
type UpdateTask = { title: string | null, description: string | null, status: TaskStatus | null, };
|
type UpdateTask = { title: string | null, description: string | null, status: TaskStatus | null, };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user