Repository navigation
feat(web): task board with threads grouped by status #34779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
avillagran
wants to merge
9
commits into
pingdotgg:main
Choose a base branch
from
avillagran:feat/task-board
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,797
−23
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
67ecbb8
feat(web): task board page with threads grouped by status
avillagran 9429ca3
feat(web): task board panels collapse, stack by drag and drop, and sh…
avillagran 5967377
feat(web): stacked task board panels resize
avillagran f0b60db
feat(web): task board columns resize by their right edge
avillagran 385da49
docs(user): task board
avillagran 33e98d9
fix(web): task board follows unseen failures, resets sizes from the k…
avillagran 2df035b
fix(web): a task board panel dropped by a single quick move lands on …
avillagran 3634cc7
feat(web): task board panels move from the keyboard
avillagran c0050ba
test(web): task board keyboard test asserts through vi.waitFor
avillagran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
233 changes: 233 additions & 0 deletions
233
apps/web/src/components/board/TaskBoardPage.browser.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,233 @@ | ||
| import type { ScopedThreadRef } from "@t3tools/contracts"; | ||
| import { describe, expect, it, vi } from "vite-plus/test"; | ||
| import { page, userEvent } from "vite-plus/test/browser"; | ||
|
|
||
| import { render } from "../../../test/render"; | ||
| import { | ||
| type ThreadContextMenuOptions, | ||
| useProvideThreadContextMenu, | ||
| } from "../sidebar/threadContextMenu"; | ||
| import { TaskBoardPage } from "./TaskBoardPage"; | ||
|
|
||
| const fixture = vi.hoisted(() => ({ | ||
| updateMetadata: vi.fn(async (_request: unknown) => ({ _tag: "Success" as const })), | ||
| })); | ||
|
|
||
| function shell(id: string, title: string, overrides: Record<string, unknown> = {}) { | ||
| return { | ||
| id, | ||
| environmentId: "environment-one", | ||
| projectId: "project-one", | ||
| title, | ||
| lineage: { parentThreadId: null, relationshipToParent: null, rootThreadId: id }, | ||
| archivedAt: null, | ||
| settledOverride: null, | ||
| pinnedAt: null, | ||
| updatedAt: "2026-01-01T10:00:00.000Z", | ||
| hasPendingApprovals: false, | ||
| hasPendingUserInput: false, | ||
| runtime: null, | ||
| snoozedUntil: null, | ||
| ...overrides, | ||
| }; | ||
| } | ||
|
|
||
| vi.mock("../../state/entities", async (original) => { | ||
| const threads = [ | ||
| shell("thread-done", "Finished work"), | ||
| shell("thread-approval", "Needs approval", { hasPendingApprovals: true }), | ||
| ]; | ||
| return { | ||
| ...(await original<object>()), | ||
| useVisibleThreadShells: () => threads, | ||
| useProjects: () => [], | ||
| }; | ||
| }); | ||
| vi.mock("../../state/session", async (original) => ({ | ||
| ...(await original<object>()), | ||
| readEnvironmentScope: () => true, | ||
| })); | ||
| vi.mock("../../state/use-orchestration-command", () => ({ | ||
| useOrchestrationCommand: () => fixture.updateMetadata, | ||
| })); | ||
|
|
||
| type MenuCall = [ScopedThreadRef, { x: number; y: number }, ThreadContextMenuOptions | undefined]; | ||
|
|
||
| function SidebarMenuStub(props: { onMenu: (...args: MenuCall) => void }) { | ||
| useProvideThreadContextMenu(props.onMenu); | ||
| return null; | ||
| } | ||
|
|
||
| function pointer(type: string, x: number, y: number) { | ||
| return new PointerEvent(type, { | ||
| bubbles: true, | ||
| cancelable: true, | ||
| isPrimary: true, | ||
| button: 0, | ||
| buttons: type === "pointerup" ? 0 : 1, | ||
| clientX: x, | ||
| clientY: y, | ||
| }); | ||
| } | ||
|
|
||
| const panel = (label: string) => page.getByRole("region", { name: label }).element(); | ||
| const column = (label: string) => panel(label).closest<HTMLElement>("[data-board-column]"); | ||
| const grow = (label: string) => Number(panel(label).parentElement!.style.flexGrow); | ||
|
|
||
| describe("TaskBoardPage", () => { | ||
| it("opens the sidebar thread menu on right-click and renames in place", async () => { | ||
| localStorage.clear(); | ||
| fixture.updateMetadata.mockClear(); | ||
| const onMenu = vi.fn<(...args: MenuCall) => void>(); | ||
| await using screen = await render( | ||
| <> | ||
| <SidebarMenuStub onMenu={onMenu} /> | ||
| <TaskBoardPage /> | ||
| </>, | ||
| ); | ||
|
|
||
| await userEvent.click(screen.getByRole("button", { name: /Finished work/ }), { | ||
| button: "right", | ||
| }); | ||
| expect(onMenu).toHaveBeenCalledOnce(); | ||
| const [threadRef, , options] = onMenu.mock.calls[0]!; | ||
| expect(threadRef).toEqual({ environmentId: "environment-one", threadId: "thread-done" }); | ||
|
|
||
| options?.onStartRename?.(threadRef, "Finished work"); | ||
| const input = screen.getByRole("textbox", { name: "Thread title" }); | ||
| await userEvent.fill(input, "Renamed work"); | ||
| await userEvent.keyboard("{Enter}"); | ||
| expect(fixture.updateMetadata).toHaveBeenCalledWith({ | ||
| environmentId: "environment-one", | ||
| input: { threadId: "thread-done", title: "Renamed work" }, | ||
| }); | ||
| }); | ||
|
|
||
| it("collapses, stacks and keeps the layout across remounts", async () => { | ||
| localStorage.clear(); | ||
| { | ||
| await using screen = await render(<TaskBoardPage />); | ||
| await userEvent.click(screen.getByRole("button", { name: "Collapse Failed" })); | ||
| await expect.element(screen.getByRole("button", { name: "Expand Failed" })).toBeVisible(); | ||
|
|
||
| const header = panel("Working").querySelector("h2")!; | ||
| const from = header.getBoundingClientRect(); | ||
| const target = panel("Needs you").getBoundingClientRect(); | ||
| const drop = { x: target.left + target.width / 2, y: target.bottom - 10 }; | ||
| header.dispatchEvent(pointer("pointerdown", from.left + 10, from.top + 5)); | ||
| document.dispatchEvent(pointer("pointermove", from.left + 30, from.top + 5)); | ||
| await vi.waitFor(() => expect(panel("Working").className).toContain("opacity-50")); | ||
| document.dispatchEvent(pointer("pointermove", drop.x, drop.y)); | ||
| await vi.waitFor(() => | ||
| expect(panel("Needs you").querySelector(".bg-primary")).not.toBeNull(), | ||
| ); | ||
| document.dispatchEvent(pointer("pointerup", drop.x, drop.y)); | ||
| await vi.waitFor(() => expect(column("Working")).toBe(column("Needs you"))); | ||
| } | ||
|
|
||
| await using screen = await render(<TaskBoardPage />); | ||
| await expect.element(screen.getByRole("button", { name: "Expand Failed" })).toBeVisible(); | ||
| const stack = column("Needs you")!; | ||
| expect([...stack.querySelectorAll("section")].map((section) => section.ariaLabel)).toEqual([ | ||
| "Needs you", | ||
| "Working", | ||
| ]); | ||
| }); | ||
|
|
||
| it("stacks a panel dropped by a single quick move", async () => { | ||
| localStorage.clear(); | ||
| await using _screen = await render(<TaskBoardPage />); | ||
| const header = panel("Working").querySelector("h2")!; | ||
| const from = header.getBoundingClientRect(); | ||
| const target = panel("Needs you").getBoundingClientRect(); | ||
| const drop = { x: target.left + target.width / 2, y: target.bottom - 10 }; | ||
| header.dispatchEvent(pointer("pointerdown", from.left + 10, from.top + 5)); | ||
| // The only move both activates the drag and lands on the target. | ||
| document.dispatchEvent(pointer("pointermove", drop.x, drop.y)); | ||
| await vi.waitFor(() => expect(panel("Working").className).toContain("opacity-50")); | ||
| document.dispatchEvent(pointer("pointerup", drop.x, drop.y)); | ||
| await vi.waitFor(() => expect(column("Working")).toBe(column("Needs you"))); | ||
| }); | ||
|
|
||
| it("moves the focused panel with Alt+arrows and keeps focus on it", async () => { | ||
| localStorage.clear(); | ||
| await using screen = await render(<TaskBoardPage />); | ||
| const toggle = () => screen.getByRole("button", { name: "Collapse Working" }).element(); | ||
| (toggle() as HTMLElement).focus(); | ||
| await userEvent.keyboard("{Alt>}{Shift>}{ArrowLeft}{/Shift}{/Alt}"); | ||
| await vi.waitFor(() => { | ||
| expect(column("Working")).toBe(column("Needs you")); | ||
| expect(document.activeElement).toBe(toggle()); | ||
| }); | ||
| await userEvent.keyboard("{Alt>}{ArrowUp}{/Alt}"); | ||
| await vi.waitFor(() => | ||
| expect( | ||
| [...column("Working")!.querySelectorAll("section")].map((section) => section.ariaLabel), | ||
| ).toEqual(["Working", "Needs you"]), | ||
| ); | ||
| await userEvent.keyboard("{Alt>}{ArrowRight}{/Alt}"); | ||
| await vi.waitFor(() => { | ||
| expect(column("Working")).not.toBe(column("Needs you")); | ||
| expect(document.activeElement).toBe(toggle()); | ||
| }); | ||
| }); | ||
|
|
||
| it("resizes stacked panels, keeps the split across remounts, and resets on double-click", async () => { | ||
| localStorage.clear(); | ||
| // A layout saved before weights existed loads as equal shares. | ||
| localStorage.setItem( | ||
| "t3code:task-board:layout", | ||
| JSON.stringify({ columns: [["attention", "done"]], collapsed: [] }), | ||
| ); | ||
| const separator = { name: "Resize Needs you and Done" }; | ||
| { | ||
| await using screen = await render(<TaskBoardPage />); | ||
| const handle = screen.getByRole("separator", separator).element() as HTMLElement; | ||
| expect([grow("Needs you"), grow("Done")]).toEqual([1, 1]); | ||
| // Synthetic drag events have no active browser pointer to capture. | ||
| using _capture = vi.spyOn(handle, "setPointerCapture").mockImplementation(() => {}); | ||
| const pointer = { bubbles: true, pointerId: 1, button: 0, clientX: 0 }; | ||
| handle.dispatchEvent(new PointerEvent("pointerdown", { ...pointer, clientY: 300 })); | ||
| handle.dispatchEvent(new PointerEvent("pointerup", { ...pointer, clientY: 360 })); | ||
| expect(panel("Needs you").className).not.toContain("opacity-50"); | ||
| await vi.waitFor(() => | ||
| expect(localStorage.getItem("t3code:task-board:layout")).toContain("weights"), | ||
| ); | ||
| expect(grow("Needs you")).toBeGreaterThan(grow("Done")); | ||
| expect(grow("Needs you") + grow("Done")).toBeCloseTo(2); | ||
| } | ||
|
|
||
| await using screen = await render(<TaskBoardPage />); | ||
| expect(grow("Needs you")).toBeGreaterThan(grow("Done")); | ||
| // Unstyled in tests, the handle has no box for a real pointer to hit. | ||
| const handle = screen.getByRole("separator", separator).element(); | ||
| handle.dispatchEvent(new MouseEvent("dblclick", { bubbles: true })); | ||
| await vi.waitFor(() => expect([grow("Needs you"), grow("Done")]).toEqual([1, 1])); | ||
| }); | ||
|
|
||
| it("resizes a column by its edge, keeps the width across remounts, and resets on double-click", async () => { | ||
| localStorage.clear(); | ||
| const separator = { name: "Resize Needs you column" }; | ||
| const width = () => column("Needs you")!.style.width; | ||
| { | ||
| await using screen = await render(<TaskBoardPage />); | ||
| const handle = screen.getByRole("separator", separator).element() as HTMLElement; | ||
| expect(width()).toBe("288px"); | ||
| // Synthetic drag events have no active browser pointer to capture. | ||
| using _capture = vi.spyOn(handle, "setPointerCapture").mockImplementation(() => {}); | ||
| const pointer = { bubbles: true, pointerId: 1, button: 0, clientY: 0 }; | ||
| handle.dispatchEvent(new PointerEvent("pointerdown", { ...pointer, clientX: 300 })); | ||
| handle.dispatchEvent(new PointerEvent("pointerup", { ...pointer, clientX: 400 })); | ||
| await vi.waitFor(() => | ||
| expect(localStorage.getItem("t3code:task-board:layout")).toContain("widths"), | ||
| ); | ||
| expect(width()).toBe("388px"); | ||
| } | ||
|
|
||
| await using screen = await render(<TaskBoardPage />); | ||
| expect(width()).toBe("388px"); | ||
| const handle = screen.getByRole("separator", separator).element(); | ||
| handle.dispatchEvent(new MouseEvent("dblclick", { bubbles: true })); | ||
| await vi.waitFor(() => expect(width()).toBe("288px")); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.