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
3 changes: 3 additions & 0 deletions components/project/tasklist/task/task-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { cn } from "@/lib/utils";
import { toDateStringWithDay, toStartOfDay } from "@/lib/utils/date";
import { useTRPC } from "@/trpc/client";
import { Checkbox } from "../../../ui/checkbox";
import { CommentsSection } from "../../comment/comments-section";
import { DateTimePicker } from "../../events/date-time-picker";
import { AssignToUser } from "../../shared/assign-to-user";
import { UserBadge } from "../../shared/user-badge";
Expand Down Expand Up @@ -389,6 +390,8 @@ export const TaskItem = ({
) : null}
</div>
</div>

<CommentsSection roomId={`task-${task.id}`} />
</div>
</div>
</Panel>
Expand Down
16 changes: 10 additions & 6 deletions components/project/tasklist/tasklist-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import type { TaskList } from "@/drizzle/types";
import { type TaskList, TaskListStatus } from "@/drizzle/types";
import { useTaskLists } from "@/hooks/use-tasklist";

export const TaskListHeader = ({
Expand Down Expand Up @@ -76,17 +76,21 @@ export const TaskListHeader = ({
updateTaskList.mutateAsync({
id: taskList.id,
status:
taskList.status === "active" ? "archived" : "active",
taskList.status === TaskListStatus.ACTIVE
? TaskListStatus.ARCHIVED
: TaskListStatus.ACTIVE,
}),
{
loading: "Updating list...",
success: "List updated.",
error: "Failed to update list.",
loading: "Updating status...",
success: "Status updated.",
error: "Failed to update status.",
},
);
}}
>
{taskList.status === "active" ? "Archive" : "Unarchive"}
{taskList.status === TaskListStatus.ACTIVE
? "Archive"
: "Unarchive"}
</Button>
</DropdownMenuItem>
<DropdownMenuItem className="w-full p-0">
Expand Down
4 changes: 2 additions & 2 deletions trpc/routers/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ export const projectsRouter = createTRPCRouter({
.or(
z.object({
id: z.number(),
dueDate: z.date().nullable(),
status: z.enum(["active", "archived"]),
}),
)
.or(
z.object({
id: z.number(),
status: z.enum(["active", "archived"]),
dueDate: z.date().nullable(),
}),
),
)
Expand Down
32 changes: 16 additions & 16 deletions trpc/routers/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { and, asc, desc, eq, or } from "drizzle-orm";
import { TRPCError } from "@trpc/server";
import { and, asc, desc, eq, or } from "drizzle-orm";
import { z } from "zod";
import { task, taskList } from "@/drizzle/schema";
import { TaskListStatus, TaskStatus } from "@/drizzle/types";
Expand Down Expand Up @@ -141,20 +141,20 @@ export const tasksRouter = createTRPCRouter({
.or(
z.object({
id: z.number(),
dueDate: z
.string()
.nullable()
status: z
.nativeEnum(TaskListStatus)
.optional()
.transform((val) => (val?.trim()?.length ? new Date(val) : null)),
.default(TaskListStatus.ACTIVE),
}),
)
.or(
z.object({
id: z.number(),
status: z
.nativeEnum(TaskListStatus)
dueDate: z
.string()
.nullable()
.optional()
.default(TaskListStatus.ACTIVE),
.transform((val) => (val?.trim()?.length ? new Date(val) : null)),
}),
),
)
Expand Down Expand Up @@ -383,34 +383,34 @@ export const tasksRouter = createTRPCRouter({
.or(
z.object({
id: z.number(),
dueDate: z
.string()
.nullable()
.transform((val) => (val ? new Date(val) : null)),
description: z.string(),
}),
)
.or(
z.object({
id: z.number(),
description: z.string(),
assignedToUser: z.string().nullable(),
}),
)
.or(
z.object({
id: z.number(),
assignedToUser: z.string().nullable(),
position: z.number(),
}),
)
.or(
z.object({
id: z.number(),
position: z.number(),
taskListId: z.number(),
}),
)
.or(
z.object({
id: z.number(),
taskListId: z.number(),
dueDate: z
.string()
.nullable()
.transform((val) => (val ? new Date(val) : null)),
}),
),
)
Expand Down