Skip to content

feat(design): show real loading, zero and error states in the review preview - #432

Merged
filipeforattini merged 3 commits into
mainfrom
design-loading-states
Sep 24, 2026
Merged

filipeforattini merged 3 commits into
mainfrom
design-loading-states

Conversation

@filipeforattini

@filipeforattini filipeforattini commented Sep 24, 2026 •

Copy link
Copy Markdown

Summary

The review page showed a big white box while a revision's preview built (reported on 0.54, presentation target, design app). This adds real loading, zero and error states, and the plumbing to report progress.

  • State machine (packages/design/src/loading.ts, serialized into the page like stage/deck): the design list, the preview request, the build status, the frame's load, and the runtime's new design:ready message (posted by screens.ts after load + document.fonts.ready) produce the visible state.
  • Review preview area: while it loads, the frame stays hidden on the theme background behind a target-shaped skeleton (slide strip + 16:9 canvas / phone frame / page) with the stage text and elapsed seconds. Once the frame is ready it fades in, or appears at once with prefers-reduced-motion. A live reload keeps the current frame on screen until the new document arrives.
  • Build status: the design app tracks preview builds per revision and serves GET …/:designID/revision/:revisionID/status (queued / tools while the Design tools install on first use / building / ready / failed). The page polls it only while the preview request is in flight. Hosts without the route (the inline HttpApi and legacy pages) fall back to a generic "Building the preview…". No HttpApi route is added.
  • Zero state: a design without a revision shows "The agent is preparing the first revision…" with the agent's live status from the feed (thinking / running a tool).
  • Error state: a failed build shows its summary and a Retry button instead of a blank box.
  • "No separate variants": shown only after the revision is on screen, and smaller.
  • Presenter: slide frames stay hidden until they are ready, with a "Loading the deck…" line and a failure message plus Retry.
  • First-use download (app-binary.ts): the archive is streamed, and progress is reported process-wide (progress / watch / describe). The design tools publish it as a TUI toast ("Downloading redcode-design 0.1.0… 45%"). DesignApp.open answers a review link through redcode's redirect with a waiting page (the progress, reloading itself) while the app downloads or starts. If the start fails, the page shows why, with Retry, instead of a connection error. Launches in one process now share one ensure.
  • Copy: new strings in copy.ts, with pt-BR translations.

Tests (no real browser)

  • packages/core/test/design-loading.test.ts: pure events → visible-state tests, serialization, waiting page.
  • packages/core/test/design-app-binary.test.ts: download progress reported and described.
  • packages/design-app/test/app.test.ts: the build status route goes from queued to ready around a preview.
  • packages/redcode/test/design/app-status.test.ts: TUI toast status for the download.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…preview

The review page kept a raw white iframe on screen while a revision built. The preview
area now follows observed events through a pure state machine (packages/design/src/loading.ts):
the design list, the preview request, the design app's build status (new
revision/:id/status route), the frame's load and the runtime's design:ready message.
It shows a target-shaped skeleton with the current stage and elapsed time, a zero
state with the agent's live activity, and a failure summary with Retry, then fades
the frame in. The presenter windows wait the same way.

The first-use download of the design app reports its progress: the TUI shows it as
a toast, and a review link opened meanwhile answers with a waiting page that follows
the download instead of a connection error. Launches are shared in-process.
@filipeforattini
filipeforattini enabled auto-merge (squash) September 24, 2026 16:03
@filipeforattini
filipeforattini merged commit a4907f4 into main Sep 24, 2026
25 checks passed
@filipeforattini
filipeforattini deleted the design-loading-states branch September 24, 2026 16:10
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