Repository navigation
feat: revamp the project room and replace the rail with the sidebar - #345
pratikbuilds wants to merge 316 commits into
Conversation
| expect(view?.state).toBe("done"); | ||
| }); | ||
|
|
||
| test("a step says what it makes, as its action's returns name it for its input", () => { |
There was a problem hiding this comment.
All those tests are misplaced. planState tests should live in `plan.test.ts`. There should also be a proper catalog building step there.
This can be done in a separate "test cleanup" PR on top of the stack, to not interfere with it, since it'll move old tests too.
| * The bar's approval of the document being read: the version on show once approved, else Approve | ||
| * while it is the newest. An older version read from the menu is neither, since only the newest | ||
| * can be approved. | ||
| */ |
There was a problem hiding this comment.
Always ask for a deslop step at the end of the process. Here's how this looks after I asked for a deslop:
```
/**
* What the bar shows for approving the document being read. If the version on screen is
* approved, it says so; if it isn't approved but is the newest, the bar offers Approve.
* An older version opened from the menu gets neither, because only the newest version
* can be approved.
*/
```
Not Shakespeare, but much better than the ", else Approve while..." weird sentence structure above.
| import type { DocumentApprovalControl } from "./deliverable-block.tsx"; | ||
| import type { PaneBarGroup } from "./pane-bar.tsx"; | ||
|
|
||
| export function useApproveGroup( |
There was a problem hiding this comment.
Also, in general, documentation above a function is better than the above style in the beginning of a file.
| }, | ||
| ]; | ||
| if (viewing !== newest) return []; | ||
| const approve = async () => { |
There was a problem hiding this comment.
Something smells of stale captured scope related bugs here.
| @@ -63,7 +65,6 @@ function render(selected: PaneDocument | null, state?: DeliverableState) { | |||
| onSelect={() => {}} | |||
There was a problem hiding this comment.
This noise happens because all our onX events are non nullable, but often needed as null, so we end up passing those empty lambdas everywhere. This is really ugly and creates LOC bloat, as well as context spam for both humans and agents. This can be fixed on a cleanup PR on top of the stack.
| @@ -85,8 +86,8 @@ describe("persistent artifact pane", () => { | |||
| const html = render(ready, document); | |||
| expect(html).toContain("Real output"); | |||
There was a problem hiding this comment.
I don't even know what those god-awful tests are testing. Nuke them all! This kind of test will churn really hard. Any change in copy will change the test.
We shouldn't in general base tests on copy. See these principles:
https://testing-library.com/docs/queries/about#priority
| ]); | ||
|
|
||
| // Each document's tabs: one per document, two for the design. | ||
| /** The app's manual as a written page: no versions to pick, its pictures where it places them. */ |
There was a problem hiding this comment.
What does this comment even mean? We must improve the prose or filter it out from our PRs
| /** The design concepts the person compares, a tab each, until one is picked. */ | ||
| concepts: readonly DesignConcept[]; | ||
| /** A tab the conversation asks for that is not a filed document, such as a concept. */ | ||
| /** The tab the room asks for, from the conversation or the sidebar; a new object asks again. */ |
There was a problem hiding this comment.
We also should avoid churning like crazy through comments. I'm not 100% sure why this comment here was touched. Also this comment is horrible. Let's pay attention to prose. We don't want to drown in so much slop we can never fix it again.
| import { wording } from "../../config.ts"; | ||
| import styles from "./box-cards.module.css"; | ||
|
|
||
| const text = wording.promptBox.waiting; |
| * the box's placeholder and what Send sends. A card waiting inside the box hands over its whole row | ||
| * of buttons; a screen covering the page hands over only its forward action, since its way back | ||
| * stays with the page. | ||
| * of buttons; a screen in the plugin space beside the box hands over its row and its forward action |
There was a problem hiding this comment.
What's the purpose of this diff?
| {...parts} | ||
| />, | ||
| ); | ||
| expect(html).toContain("Weather design"); |
There was a problem hiding this comment.
Let's nuke ALL tests that do this. This is nonsense.
React's autoFocus scrolled the page to where the card first sat, before the page measured its place beside the passage, carrying the reader up the page. Focus it without scrolling instead.
A passage selected to comment on stayed selected until another was chosen. A press anywhere else now puts the card away, and its passage with it, when nothing has been written; words written stay. Where the margin is too narrow, the card over the page no longer closes on such a press, a blur or a scroll while it is being written, so its field decides there too.
The pill over the running app said only "The app is running", and work going on showed no dots there either. The pill now leads with the thinking dots while work runs, folded or not, and with a green dot that sends out a slow ring while the app is up, the green the sidebar marks the app with. Under reduced motion the dot stays still.
Work going on now shows a light running clockwise round a ring of ink dots, its head a touch larger with a fading tail, in place of the chat's three dots. The running app shows a ring of green dots that gathers into one point and opens again, turning a little with each breath, in place of the pulsing dot. Under reduced motion the first stands as a ring fading round to its head and the second stands open.
White on the lighter dark-mode blue and green was about 2.6:1, below WCAG AA for every Send, Approve, Continue and Use button. Black on the same fills is about 8:1.
The room rebuilt a ResizeObserver and read the box's layout on every render, so every keystroke and streamed word. It now sets the observer up once and measures again when the box resizes, when the grip above it comes or goes, or when the chat sheet opens or closes.
Escape closed the plugin screen and the pulled-up chat together, and after one screen replaced another it could miss the new one. The handler now reads the current screen through useEffectEvent and leaves the key to an open chat sheet.
Full screen from the chat over a plugin screen closed the screen but could leave the project view open. It now closes both.
Escape on "Approve and discard N comments?" cancelled the question and then reached the room, which closed the whole view. The confirmation now marks the key as used.
Saving an edited comment kept its old quote and occurrence, so dragging its handles while editing was lost. A moved passage is now quoted again from the version on show.
Dragging a passage handle onto the title gave the comment an occurrence of -1, which showed it as a missing passage. A handle now only follows the caret inside the document's text, where passages are counted.
The comment box opened on the first Shift+Arrow key-up, after one character, because the check also fired while Shift was still held.
With Use Concept in the prompt box and nothing unavailable, the concept choice drew no bar, so a failed send showed no error. The bar now also stands when the screen has a fault.
Buttons a screen draws through ActionsSlot were inert while sending, but its forward action through PromptAction was not, so Use Concept could be pressed twice. Both slots now wrap what they draw in the same inert hold.
Pulling the chat sheet or dragging a comment handle left listeners on window if the view unmounted mid-drag, and the sheet could keep springing. Each drag now owns an AbortController that its end and unmount abort, and the handle drag follows only its own pointer.
Switching versions quickly let a slower read of an earlier pick replace the one on show, and Compare could read changesOpen from before the await. Each read is numbered and only the latest is used, and changesOpen is read after the await.
Over the document it asks to approve, the box folded to the typing row and Approve, so a person reading the page lost track of what Approve agreed to. The box now keeps the card's title above the words. The summary and document chip stay folded because the page shows them.
Comments on the document also answer the approval, and the old text mentioned only typing a change.
The next-step line is gone, but the room still asked the hub for it every 5 seconds. Only the prompt box's placeholder read the answer. The placeholder now reads the facts behind the status pill, and the poll, its read and its query key are removed. The hub route is left for the e2e test that calls it. One placeholder changes. The hub counted the coordinator as working, and an idle one often showed as starting, so a project with its app running asked "What do you want to say…". Now the coordinator counts only mid-turn, and that project asks "What needs to change…".
A decision screen sent feedback back through ReplyBox.stage and the room's stagedSend. Other screens used the PromptSend port. Send went down two paths. Now PromptSend holds Send's label too, and its take may return a promise; the box clears once that resolves true. The review offers its send-back through the port and sets its placeholder with usePromptPlaceholder. The room's staging code is deleted. usePromptPlaceholder sets nothing for a screen with no placeholder. Otherwise the host would clear the text its view set. With files attached, Send used to send the feedback back and leave the files behind. It sends words and files as one message now.
The room kept four flags about the plugin space and asked the DOM whether the chat sheet was up before Escape closed anything. It now keeps only the person's last say about the screen, derives the cover from it, and the chat sheet reports when it is pulled up.
Comments alone, a shell answer, a screen, comments with words, then an ordinary message: the order lives in one tested function rather than the Send handler's early returns.
The room wrote reply steps, run cards, hand-off sightings and the latest reply time into refs while rendering, so a render React threw away still left them behind. Each render now works out what it learned without changing anything and stores it after commit.
The prompt box, the comment drafts and the project sidebar each took their own copy of the project id, the open tab and how to send or reload. They now share one RoomSession, so the comments see the same open tab as the rest of the room.
The text, attached files, sent stand-ins and send faults leave useRoom for a hook of their own. The room still decides where a send goes: a question, an approval or the coordinator.
The workspace is keyed by project and the opening message is set before it mounts, so these effects only ever set state to the values it already started with.
Each move of a passage handle set state in WrittenDocument. DocumentView is not memoized, so the whole Markdown was parsed and rendered again. Because the passages changed too, measure was rebuilt and the page's two observers disconnected and reattached on every move. The body is memoized on its text and images. The observers reach measure through useEffectEvent, so they subscribe once. The layout effect still measures whenever the passages change.
paint set the history's height and then read two rects, forcing a layout on every spring frame and drag move. It now reads first and writes after, so the fade trails the height by one frame. Each spring step also reads openHeight once instead of twice.
The dock's MutationObserver watches its whole subtree. When the page covers the conversation, the chat sheet in the dock holds the history, so every streamed word ran a querySelector and forced a layout. Changes inside the chat's history move neither the grip nor the box. They are skipped now.
The thread filter, each call's parts and the specialist lists all called standing(unit), three or more times per unit on every streamed word. A per-render cache keyed by the unit's key answers the repeats.
The link opened the project view on the live app while the coder was still writing it, and that page was broken mid-build. Nothing else used the row's watch action, so it goes with the link: its wording, the model's watch field and the room's onWatch. Refs CL-12475
Since eccbfc0 the saved app is the tip of the app repository's main, and the coder pushes there in the background while it builds. Publish showed a few seconds into the first build, with a half-written app behind it. Publishing now also needs the app_exists fact, which the hub records once the coder files an app after its checks pass. A project with a release or a holding keeps its status either way. Refs CL-12473
The corner's label was muted grey in an outlined box, so Published and Publish looked disabled. Its text is now full strength like Download and Share, and it fills on hover. A status that needs the person shows a dot before its words. Two labels change. The paused state said "Carry on publishing", but the button only opens the Publish page, so it now says "Publishing paused". "Time to keep it is up" is now "Check your app", marked as needing the person: only they know whether they kept it. Screen readers hear "Publish" once instead of "Publish: Publish", and the hover says "Open the Publish page".
Why
In the room today, finding where a project stands and what it needs from you means looking in several places:
This PR rebuilds the room so each of those has one place:
For the sidebar to list what the project makes, it has to know what each step produces. The hub's plan view now says so (
makes, plus a ready-made plan'snameandoutcome), so the web app still names no plugin.Plan: Builder UI revamp.
Summary
Each sidebar row is one thing the project makes, and steps that make nothing fold into the row they lead to:
The icon comes from the plan view, so the host still names no plugin:
The new logic is in plain files, each with tests:
project-outline.tsandproject-sidebar.model.ts: the rows for what the project makes, their states and the sidebar's props.waiting.ts: what waits on the person, and in what order.room-status.ts: what the pill says and its one action, from the first rule that fits.prompt-box.model.ts: the box's card, the pill's line and the space's screen.comments.ts: which drafts exist, the message they make and the page they're on.document-page.model.ts, plusversion-reading.ts,approve-group.tsandversion-notes.tsx, which it shares with the mockup, sheet and package views.Removed in this PR:
PlanPanel.DocumentViewanduser-manual.view.tsxfor written documents.Reading the commits
This PR is stacked on #344. Together the two replace #303–#306 and #335–#338.
The 68 commits come in four runs.
The first 29 rebuild the old stack so it reads in order, and each makes one change in its final form:
The largest commit is
feat(web): move what waits on the person into the prompt box(21 files). It changes the room's slots and its model together, because the states in between don't typecheck.The last 16 came from testing the PR:
chore(web): merge the redesigned sidebar and chat sheet into the roommerges in the base's new sidebar and its one-motion chat sheet, and deletes code that only the sidebar's file rows used.The last 9 came from using the running app, where the box covered its foot:
fix(web): end the running app above the prompt boxdocked the box under the app instead, andfix(web): let the running app run beneath the prompt box againreverts it, so the pair can be skipped.b0c081f0fixes a story that checked the project view before its view transition ran.The last 14 came from going through the comment flow against the Figma design:
feat(web): open the commented page from the box's comment tokenmakes the token open the page, with × to remove the comments and Undo.feat(web): turn down a waiting screen from the box with Not nowlets a plugin screen the coordinator asked about, such as Publish, be turned down from the box. The last two fix a comment field that scrolled the page up when it opened, and a selected passage that stayed selected until another was chosen.Evidence
After: the first 29 commits end on the same tree as feat(web): pull the chat up over the project view as a sheet #338 (
git diff room-chat-sheet 83753084is empty), and the last 16 build on it.oxlint --deny-warnings, dependency boundaries, typecheck).0e97bb50),bun --conditions=intx-src test ./apps/web/src ./packages apps/hub/src/plugins apps/hub/src/plansreports 437 tests: 0 failing and 9 skipped.comments.test.tscovers the drafts, the message they make and Undo. That includesproject-outline.test.ts(each row'smakes, and the publish row aspublished) andexecute.test.ts(a ready-made plan's group has itsnameandoutcome). I haven't run the tests at each of the last 39 commits.AppScreenWaiting,AppApprovalWaiting,AppWorking,AppBoxOpens) and Open, Close and Escape on the plugin space (ScreenOpened). The comment and document stories pass at 1280 and 1920 wide, except the two that type (CommentPutAway, andEnterSaves, which fails before this PR's comment fixes too): in Storybook here, typed letters reach the field but React never sees them, as with the font picker's typing stories. Setting the field's text directly, a comment with words stays on a press elsewhere and an empty one goes, at both widths.How to test: check out
room-revamp, then runbun install,bun run devandbun run dev:seed -- --fixture=habit-tracker --stage=ready_to_build. Connect a model provider in Settings to see questions, approvals and replies live.⌘\, and below 900px it is a drawer.…menu has Pause before this step and Skip this step. The app line has Open app.Storybook: Screens/Workspace/Room, ProjectSidebar, WrittenDocument and the plugin screens.
Merge Danger
Door: two-way
There is no migration and no change to stored data, so a revert brings back the old room as it was. On the hub, this PR only adds optional fields to the plan view (
makes,name,outcome) and an optionaloutcometo the ready-made plan manifest, which three publish plugins set.Blast Radius: every screen
Navigation changes on every page. In the room, the layout changes, questions and approvals move into the prompt box, and written documents read as a printed page. Known gaps: