Skip to content

docs(examples): add live overview page for all job types - #817

Merged
LinoGiger merged 4 commits into
mainfrom
docs(examples)/add-interactive-overview-page
Aug 14, 2026
Merged

docs(examples): add live overview page for all job types#817
LinoGiger merged 4 commits into
mainfrom
docs(examples)/add-interactive-overview-page

Conversation

@RapidPoseidon

@RapidPoseidon RapidPoseidon commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What

Adds docs/examples/index.md — an overview page on the Examples tab showing every job type the SDK can create as a scrollable gallery of live phones. Each card is a real campaign you can try in place, with a link to the example behind it for the code. The headings feed Material's table of contents, so the right rail jumps between modalities rather than making you scroll.

Seven cards: Classification, Comparison, Locate, Draw, Select Words, Free Text, Ranking.

The page is wired into nav and into the llmstxt-md Examples section.

Load cost

Seven live rapids apps is not free, so this was measured rather than assumed. One phone is 43 requests / ~870 KB / ~0.6 s. All seven booting eagerly: ~340 requests, ~7.4 MB.

Two mitigations in docs/js/preview-embed.js:

  • data-preview-lazy — the iframe ships with no src; an IntersectionObserver fills it in 150 px before the phone enters view. First paint boots only the 2–4 phones actually on screen.
  • Serialised boots — lazy alone still cost 4.6 MB up front. Phones entering the viewport in the same frame all request the same rapids bundle before any of them has populated the HTTP cache, so the page pays for that bundle once per phone. Booting one at a time (waiting on load + 500 ms, with a 3 s cap so a stalled phone can't block the queue) lets everyone after the first read it from cache.
requests first paint total
eager ~340 ~4.6 MB ~7.4 MB
lazy + serialised ~340 ~3.5 MB ~6.0 MB

That's the floor for auto-playing embeds, since each phone is a full Next.js app. A click-to-load facade (static poster + "try it" overlay) would take first paint to near zero at the cost of one click before interaction — happy to switch if that trade reads better.

Both the existing embeds (starting page, quickstart) keep their current eager behaviour; lazy is opt-in per wrapper.

The preview campaigns

Each card points at a dedicated SDK DOCS examples <type> order that is created but never run, so it stays in preview state, collects no responses, and is never billed — the same setup as the four previews already on the starting page.

selections=[LabelingSelection(amount=3)] is passed explicitly when creating them. Without it, compare / classify / ranking inherit a default validation set and the backend puts two unrelated qualification rapids (a red panda, a sentiment question) in front of the task the card is meant to demonstrate. Locate, draw, select words and free text have no default set and are unaffected.

Card Campaign
Classification cmp_1SCZysSRxUHIJ5
Comparison cmp_1SCZyXpfpHFbmd
Locate cmp_1SCZhvwq8dKVfQ
Draw cmp_1SCZiFks5AUIMi
Select Words cmp_1SCZiZoHgeFf8t
Free Text cmp_1SCZitM8vyAoTC
Ranking cmp_1SCZzu6YH6ncAs

Worth a look before merging: these are owned by poseidon@rapidata.ai, whereas the four starting-page previews are owned by lino@rapidata.ai / org_1PHx4XH5QQEGY6. They render fine (the preview endpoint is public), but if that service account is ever cleaned up the previews go with it. Say the word and I'll recreate them under the same account as the existing ones.

Verified

  • uv run --group docs mkdocs build clean (no new warnings)
  • All seven phones boot and open on their own task; Refresh yields a fresh one
  • Lazy gating confirmed: 4 booted / 3 idle on first paint at 1400×1000, 2 booted at 390×844
  • Checked at desktop (two columns) and mobile (one column) widths

The first commit on this branch is the earlier tabbed-set version, kept in history for comparison.

🔗 Session: https://poseidon.rapidata.internal/chat/session-52146939

🤖 Generated with Claude Code

RapidPoseidon and others added 2 commits August 14, 2026 11:03
Mirrors the starting page: one tabbed set covering every job type the SDK
can create, with the rapids campaign preview swapping to match the selected
tab, so a reader can try each modality without leaving the docs.

Each preview is backed by a dedicated SDK-DOCS order that is created but
never run, so it stays in preview state and collects no responses - the same
setup as the four previews already embedded on the starting page. The
selections are passed explicitly because compare, classify and ranking
otherwise inherit a default validation set, which puts two unrelated
qualification tasks in front of the one the tab is meant to show.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: lino <68745352+LinoGiger@users.noreply.github.com>
…hones

Replaces the tabbed overview with one card per job type, each a real campaign
you can try in place, with a link to the example behind it. Headings give the
page a table of contents to jump between modalities.

Seven live rapids apps is roughly 6 MB and 340 requests if they all boot at
once, so `data-preview-lazy` holds each phone until it is nearly in view, and
the boots are serialised: loading them in parallel means every phone requests
the same rapids bundle before any of them has populated the HTTP cache, so the
page pays for that bundle seven times over.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: lino <68745352+LinoGiger@users.noreply.github.com>
@RapidPoseidon RapidPoseidon changed the title docs(examples): add interactive overview page for all job types docs(examples): add live overview page for all job types Aug 14, 2026
Rapid types with a text answer autofocus their input once the app boots.
Focusing anything inside an iframe makes the browser scroll the parent document
to reveal it, so the free text phone booting while still half off-screen threw
the reader ~850px down the gallery and skipped the cards in between - once per
visit, since the autofocus only happens on the frame's first load.

Two changes, because neither is sufficient alone. Phones now wait until half
visible before booting, which keeps any resulting lurch small; demanding
near-full visibility instead was worse, leaving a scroll window only tens of
pixels wide that a paging reader skips over, so the phone never booted at all.
And since booting trails the reader's scroll by about a second, the phone can be
off-screen again by the time focus lands - so the position is captured and put
back. A cross-origin iframe fires no focusin on the parent; the only
notification is a window blur, which arrives before the scroll. Corrections are
skipped once the reader has pointed at that phone themselves, so tapping into
the answer field still scrolls it into view the way they asked for.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: lino <68745352+LinoGiger@users.noreply.github.com>
@LinoGiger
LinoGiger marked this pull request as ready for review August 14, 2026 14:03
@LinoGiger
LinoGiger self-requested a review as a code owner August 14, 2026 14:03
The cards are the only headings, so the contents list just restated the seven
titles the reader is already scrolling past.

Hiding it widens the content column, which left the two phone columns stretching
apart, so the gallery is capped at the width of two phones and centred.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: lino <68745352+LinoGiger@users.noreply.github.com>
@LinoGiger
LinoGiger merged commit d4f5707 into main Aug 14, 2026
2 checks passed
@LinoGiger
LinoGiger deleted the docs(examples)/add-interactive-overview-page branch August 14, 2026 15:05
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.

2 participants