From 7a8bf8ff01e5363298de820beac153018e1af64e Mon Sep 17 00:00:00 2001 From: Satya Patel Date: Fri, 27 Mar 2026 08:25:31 -0700 Subject: [PATCH] fix(desktop): simplify task detail activity and comments --- .../components/CommentInput/CommentInput.tsx | 13 ----- .../$taskId/components/CommentInput/index.ts | 1 - .../_dashboard/tasks/$taskId/page.test.tsx | 44 ----------------- .../_dashboard/tasks/$taskId/page.tsx | 49 +++++++++++++------ 4 files changed, 33 insertions(+), 74 deletions(-) delete mode 100644 apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/CommentInput/CommentInput.tsx delete mode 100644 apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/CommentInput/index.ts delete mode 100644 apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.test.tsx diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/CommentInput/CommentInput.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/CommentInput/CommentInput.tsx deleted file mode 100644 index 719e789651f..00000000000 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/CommentInput/CommentInput.tsx +++ /dev/null @@ -1,13 +0,0 @@ -interface CommentInputProps { - placeholder?: string; -} - -export function CommentInput({ - placeholder = "Leave a comment...", -}: CommentInputProps) { - return ( -
- {placeholder} -
- ); -} diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/CommentInput/index.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/CommentInput/index.ts deleted file mode 100644 index 10729e12405..00000000000 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/components/CommentInput/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CommentInput } from "./CommentInput"; diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.test.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.test.tsx deleted file mode 100644 index 39c216caa7d..00000000000 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.test.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, expect, test } from "bun:test"; -// biome-ignore lint/style/noRestrictedImports: test file needs fs/path for source verification -import { readFileSync } from "node:fs"; -// biome-ignore lint/style/noRestrictedImports: test file needs fs/path for source verification -import { join } from "node:path"; - -const TASK_DETAIL_DIR = __dirname; - -function readComponent(relativePath: string): string { - return readFileSync(join(TASK_DETAIL_DIR, relativePath), "utf-8"); -} - -describe("Task detail action menu", () => { - test("page renders the task action menu in the header", () => { - const source = readComponent("page.tsx"); - const headerSource = readComponent( - "components/TaskDetailHeader/TaskDetailHeader.tsx", - ); - - expect(source).toContain( - 'import { TaskDetailHeader } from "./components/TaskDetailHeader";', - ); - expect(source).toContain(" { - const source = readComponent( - "components/TaskActionMenu/TaskActionMenu.tsx", - ); - - expect(source).toContain("await collections.tasks.delete(task.id)"); - expect(source).toContain( - 'console.error("[TaskActionMenu] Failed to delete task:", error)', - ); - expect(source).toContain("copyToClipboard(task.slug)"); - expect(source).toContain("copyToClipboard(task.title)"); - expect(source).not.toContain("Status"); - expect(source).not.toContain("Assignee"); - expect(source).not.toContain("Priority"); - }); -}); diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx index aba93a4f504..39e11098e35 100644 --- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx +++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/tasks/$taskId/page.tsx @@ -1,4 +1,8 @@ -import type { SelectUser } from "@superset/db/schema"; +import type { + SelectTask, + SelectTaskStatus, + SelectUser, +} from "@superset/db/schema"; import { ScrollArea } from "@superset/ui/scroll-area"; import { Separator } from "@superset/ui/separator"; import { eq, or } from "@tanstack/db"; @@ -8,10 +12,8 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router"; import { useMemo } from "react"; import { apiTrpcClient } from "renderer/lib/api-trpc-client"; import { useCollections } from "renderer/routes/_authenticated/providers/CollectionsProvider"; -import type { TaskWithStatus } from "../components/TasksView/hooks/useTasksTable"; import { Route as TasksLayoutRoute } from "../layout"; import { ActivitySection } from "./components/ActivitySection"; -import { CommentInput } from "./components/CommentInput"; import { EditableTitle } from "./components/EditableTitle"; import { PropertiesSidebar } from "./components/PropertiesSidebar"; import { TaskDetailHeader } from "./components/TaskDetailHeader"; @@ -24,6 +26,12 @@ export const Route = createFileRoute( component: TaskDetailPage, }); +type TaskDetailRecord = SelectTask & { + status: SelectTaskStatus; + assignee: SelectUser | null; + creator: SelectUser | null; +}; + function TaskDetailPage() { const { taskId } = Route.useParams(); const { tab, assignee, search } = TasksLayoutRoute.useSearch(); @@ -54,16 +62,20 @@ function TaskDetailPage() { .leftJoin({ assignee: collections.users }, ({ tasks, assignee }) => eq(tasks.assigneeId, assignee.id), ) - .select(({ tasks, status, assignee }) => ({ + .leftJoin({ creator: collections.users }, ({ tasks, creator }) => + eq(tasks.creatorId, creator.id), + ) + .select(({ tasks, status, assignee, creator }) => ({ ...tasks, status, assignee: assignee ?? null, + creator: creator ?? null, })) .where(({ tasks }) => or(eq(tasks.id, taskId), eq(tasks.slug, taskId))), [collections, taskId], ); - const task: TaskWithStatus | null = useMemo(() => { + const task: TaskDetailRecord | null = useMemo(() => { if (!taskData || taskData.length === 0) return null; const task = taskData[0]; return { @@ -72,6 +84,10 @@ function TaskDetailPage() { typeof task.assignee?.id === "string" ? (task.assignee as SelectUser) : null, + creator: + typeof task.creator?.id === "string" + ? (task.creator as SelectUser) + : null, }; }, [taskData]); const taskFallbackQuery = useQuery({ @@ -107,6 +123,7 @@ function TaskDetailPage() { const handleDelete = () => { navigate({ to: "/tasks", search: backSearch }); }; + const creatorName = task?.creator?.name?.trim() ? task.creator.name : null; if (!task) { if (isTaskLoading || isTaskSyncing) { @@ -144,19 +161,19 @@ function TaskDetailPage() { onSave={handleSaveDescription} /> - + {creatorName ? ( + <> + -

Activity

- - +

Activity

-
- -
+ + + ) : null}