Skip to content

feat(web): read written documents and the user manual as a printed page - #337

Closed
pratikbuilds wants to merge 8 commits into
room-prompt-boxfrom
room-document-page
Closed

pratikbuilds wants to merge 8 commits into
room-prompt-boxfrom
room-document-page

Conversation

@pratikbuilds

Copy link
Copy Markdown
Contributor

PR 3 of 5 in the room revamp. Base: #336 (PR 2). By the plan it needs only #303–#306; it's stacked on PR 2 to keep one line of history. Plan: Builder UI revamp, section "PR 3: written documents as a printed page".

What changed

Inside the project view, written documents (problem brief, constraints, approaches, requirements, build plan) and the user manual show as #305's printed page, with their sections listed beside it.

 <ProjectView>
-  <DocumentView>                       for written documents
+  <WrittenDocument>
+    <DocumentPage>                     bar: versions, Compare, Approve, page count, zoom, download
+    <DocumentContents>                 the document's sections
   mockups, sheets, approval packages, the live app: unchanged
  • document-page.model.ts reads the document and its versions and gives the page its title, running header, bar, text and quoting; the view never sees hub data.
  • Mockups, sheets, approval packages and the live app keep their views and now share the version-reading, approval and version-note code with the page (version-reading.ts, approve-group.ts, version-notes.tsx).
  • Removed: DocumentView for written documents, and user-manual.view.tsx.
  • Wording in config.ts (versions, documentViewer.asBuilt).

What behaves differently

  • The document's own heading becomes the page title.
  • A comparison leaves out the heading both versions share; a changed heading stays in, shown as a change.
  • The user manual's header says "As built", and its bar has no versions and no Approve.
  • Attached markdown files also open as pages.
  • Print (in the sidebar row's menu since PR 1) prints only the page's sheet.

How to test

Run it: check out room-document-page, bun install, bun run dev, bun run dev:seed -- --fixture=habit-tracker --stage=ready_to_build.

  1. Open each written document from the sidebar: it's a white A4-like page with a running header, its sections listed on the right, and a bar with versions, Approve, page count, zoom and download.
  2. Click a section in the list: the page scrolls to it.
  3. Switch to an older version: the page and the section list change, with a note naming the version the plan uses.
  4. Compare with previous: the changes show inline, and the shared title isn't repeated.
  5. Download: a …-vN.md file is saved.
  6. From the row menu, Print: the print preview has only the page, with no section list or bar.
  7. Select a passage and use Add to prompt: On "<title>" vN: and the passage go into the box (comments replace this in PR 5).
  8. Open the design mockup and the approval package: they keep their old views.
  9. Repeat 1 in dark mode and under 900px wide.

Storybook: Screens/Workspace/WrittenDocument → Filed, Approved, OlderVersion, Comparing, VersionReadFailed, UserManualPage, Dark, Narrow; Screens/Workspace/Room → ProjectOpen, DocumentPageComparing, DocumentPageNarrowDark.

How it was verified

  • Lint, format, typecheck, boundaries, and bun --conditions=intx-src test ./apps/web/src ./packages: 298 pass. Model tests cover the title, header, bar, Approve, history unavailable, quoting, and comparisons.
  • On a local hub, with a seeded brief at two versions: the page, its bar and section list; switching versions; Compare; quoting; download; Print from the sidebar row menu (print dialog stubbed) printing only the sheet.

Not exercised

  • The real print dialog, Approve and choosing an approach on the hub, the user manual on the hub, dark and narrow on the hub (stories only).

Open design questions:

  • DocumentPage (feat(web): add the print-like document page with its contents #305) hides the section list when its area is under 1180px. With the sidebar open on a 1440px window the area is 1016px, so the list is hidden on a typical laptop.
  • Under about 500px wide, the page bar is cut off at the right edge, hiding zoom-in and download.
  • Add to prompt is still orange until PR 5 replaces it.

@corbits-triage

corbits-triage Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Triage: Fail

@pratikbuilds, please address the following:

  • added code matches a code pattern: apps/web/src/pages/workspace/artifact-pane.tsx:164 empty-fallback: Invented fallback (an empty string, list, object or zero); handle the missing value instead., apps/web/src/pages/workspace/deliverable-block.tsx:283 empty-fallback: Invented fallback (an empty string, list, object or zero); handle the missing value instead., apps/web/src/pages/workspace/document-page.model.ts:50 empty-fallback: Invented fallback (an empty string, list, object or zero); handle the missing value instead., apps/web/src/pages/workspace/document-page.model.ts:64 empty-fallback: Invented fallback (an empty string, list, object or zero); handle the missing value instead., apps/web/src/pages/workspace/written-document.stories.tsx:227 empty-fallback: Invented fallback (an empty string, list, object or zero); handle the missing value instead.

Stacked on #336: only this pull request's own changes were checked.

The reading pane's document held its version reading, its Approve action,
its notes about the version shown and its Markdown file inline. They move
into useVersionReading, useApproveGroup, VersionNotes and pane-file's
documentFile, so a written document's page can read its versions the same
way. The notes' wording moves into config.
useDocumentPage turns the room's read of a written document and the
versions the hub keeps into the printed page's props: the title lifted
from the text, the filed date in the running header, Approve, the
version menu and the download in the page's bar, the version notes, the
comparison, and the passage quote. WrittenDocumentView draws them on
DocumentPage, and WrittenDocument joins the two.
Filed, approved, an older version, a version being read, a failed read,
no history, a comparison, an approaches document, dark and narrow.
A written document in the project view now opens as the printed page
from DocumentPage, with its contents beside it, instead of the pane's
markdown view. DeliverableBody hands any Markdown document to the new
writtenDocument slot, which the room fills with WrittenDocument; the
version menu, Approve and the download move from the floating bar into
the page's own bar. Quoting a passage, comparing versions and the
loading, empty and error lines work as before, and Print copies the
page's sheet. The markdown branch, its lifted heading and the approach
choice leave DeliverableBody.
The open project view with an older version, a comparison, the loading
and error lines, and at phone width in light and dark. ProjectOpen and
ProjectOpenDark already draw the page itself.
The manual's tab now shows it on the same page as the other written
documents, titled User manual with its pictures in place, and
UserManualView with its stories goes. The manual follows the app, so its
running header says As built instead of a filing date, and it has no
versions to pick.
The page's title already shows the heading both versions share, so the
comparison drops it. A heading that changed stays in, so the change shows.
In the room a written page lies on the muted grey, a step darker than the sidebar's, as in the design; dark keeps its black backdrop. Where the canvas is narrow and the project's name floats over its corner, the page's bar starts below it.
@pratikbuilds

Copy link
Copy Markdown
Contributor Author

Replaced by #345, the same code rebuilt as one PR with commits that read in order. It's stacked on #344, which has the parts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant