Skip to content

[DO NOT MERGE] Study View: the portal's grid layout, with react-grid-layout (STS-LY-1…3) - #501

Draft
alisman wants to merge 13 commits into
masterfrom
studyview-grid-layout
Draft

alisman wants to merge 13 commits into
masterfrom
studyview-grid-layout

Conversation

@alisman

@alisman alisman commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Do not merge. A draft for the user to look at. They asked that it not be merged.

Summary

Explore's Summary grid is laid out as the portal's, with the portal's own grid library, react-grid-layout (2.3.0; the portal uses 0.16):

  • cells of 195 × 170 px, 5 px apart;
  • floor((window − 40) / 200) columns, the grid centred at cols·195 + (cols+1)·5;
  • each card the portal's default size for its kind: a pie 1×1; a bar chart 2×1; a table, density or violin 2×2; a table of values 2×1 up to 4 rows, else 2×2;
  • placed by priority, then name, into the first free spot (findSpot), the reader's added charts last;
  • no drag or resize.

Code:

  • the rules: lib/study-view-layout.ts;
  • the grid: app/lab/explore-grid.tsx;
  • each section of explore-sections.tsx now returns its cards (clinicalCards, geneTableCards, …), so the grid can place each one;
  • cardOrders is replaced by orderCards.

Not yet as the portal's:

  • The survival card stays one card with an endpoint picker, at 2×2.
  • Categorical charts drawn as value lists take the portal's pie-as-table size, not 1×1 pies.
  • Cards' insides are not yet sized to their cells; they scroll within them.

Verification

  • Browser, dev server, coadread at 1440 px: every card at the portal's size, in its order, no page errors.
  • test/study-view-layout.test.ts: the cell, the columns, each kind's size, the order and findSpot.
  • npm test 7,197 pass, 0 fail; tsc --noEmit and eslint clean.

Preview

/lab?tab=explore&study=coadread_tcga_pan_can_atlas_2018

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht


Show it working
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…t): 195 × 170 cells, each chart a whole number of them (STS-LY-1…3)

Every card on Explore's Summary is placed as the portal places it: cells of 195 × 170 px, 5 px
apart, floor((window − 40) / 200) columns, the grid centred at cols·195 + (cols+1)·5. Each card
takes the portal's default size for its kind (a pie 1×1, a bar chart 2×1, a table, density or
violin 2×2, a table of values 2×1 up to 4 rows), and goes in priority order into the first free
spot (findSpot), the reader's added charts last. No drag or resize.

The survival card stays one card with an endpoint picker, at 2×2. Categorical charts drawn as
value lists take the portal's pie-as-table size.

Draft: not to be merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
@vercel

vercel Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cbiolab-genie Ready Ready Preview Nov 23, 2026 11:00pm UTC
cbiolab-new Ready Ready Preview Nov 23, 2026 11:00pm UTC
cohort-lab Ready Ready Preview Nov 23, 2026 11:00pm UTC

Request Review

…s text

Every card's title is drawn alike, as the portal's (STS-HD-1): its name only, bold and centred,
on one 20 px line, a long one cut with an ellipsis. Text the portal does not show in a card moves
into the title's tooltip (what a chart counts, its level, the selection a density drag holds) or
goes (the min · median · max line and its median chips, the gene tables' gene counts, a list's
'scroll for more'). The survival card's title is the portal's "KM Plot: Overall (months)"
(kmPlotTitle), drawn without the risk table; Data Types, Case Lists and the other tables no longer
use the upper-case section heading.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
The Study View's survival chart draws the axes and curve only (survivalSvg's plotOnly), as the
portal's small KM chart: no risk table, legend, tests or caption under it. The curve's median,
patients and events are in the plot's tooltip, where the portal keeps its legend (STS-KM-3); the
downloaded figure keeps the full legend. The endpoint picker is compact, so the header stays one
20 px line. On coadread the figure is 376 × 259 inside the 393 × 343 card, with nothing to scroll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
…the slices, the values in a hover table

A pie chart fills its 1 × 1 card below its title, radius min(w, h)/2 − 20 drawn 12 px above the
centre (STS-PIE-2), with no legend beside it. Each slice carries its count (numeral 0.[0]a,
portalPieCount) past a quarter of the pie, or where |tan(π·ratio/2)|·(r/5)·2 holds the label
(pieLabelFits), in ink that contrasts with the slice (STS-PIE-3); a slice's tooltip is
'value:count' (STS-PIE-4). Hovering the pie shows its values as a table, # and Freq with the
checkboxes, search and Select all of a value list (STS-PIE-5). While the chart has a filter, the
values it leaves out are grey at half opacity and the selected ones outlined (STS-PIE-7).

Verified on coadread: Sex 312 / 280 on the slices (NA 2 too small), Overall Survival Status 471
only; the hover table Male 312 52.5%, Female 280 47.1%, NA 2 0.3%; a click on Male greys Female and
NA; the card fits 193 × 168 with nothing to scroll.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
…trols on one line

Every card's header is one 20 px line 4 px from its top. The title is centred over the card's whole
width, keeping as clear of the top-right controls on its left as on its right; the ☰ menu sits in
the corner at 20 × 20 px and any other control (the frequency table's filter, a density chart's
reset, a generic-assay chart's ✕) just left of it, on the same line. The gene tables' search box
moves to the card's footer, as every value list's already is (STS-TBL-3); the survival chart's
endpoint picker moves into its ☰ menu (Endpoint ▸ OS, PFS, …), so its title is centred too.

Measured on coadread at 1440 px: every card's title within 0 px of its card's centre, and title,
☰ and other controls all 20 px tall at 5 px from the card's top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
…over

The value lists, Data Types, Cancer Studies and the derived lists drop their
proportion bar column. A card's ☰ and other header buttons show while the
pointer is over the card, a button in it has focus, or its menu is open;
on a screen without hover they always show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
The histograms, the KM plot and the density scatter take the room under the
title instead of a height of their own: the histogram's bars stretch above a
fixed tick row; the KM plot is drawn at its box's width and height
(survivalSvg plot-only takes a height; DrawAtSize measures both); the density
draws at its box's height. Outside a grid card each keeps its old size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
About five ticks an axis instead of eight, and thousands as K/M/B (10,000 →
10K, fmtCompactTick in lib/chart/format.ts), so the labels take less of the
card from the plot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
As the portal's study-view tables (FixedHeaderTable: #f9f9f9 every other row):
each list row striped by its index, so the stripes stay with their rows as the
virtual list scrolls; the header shaded; the scrolling box ruled above and
below. Tokens --row-stripe and --table-head carry a dark-mode value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
A grid card's header is a shaded bar edge to edge, ruled underneath, its title
and buttons centred in it; the tables' column headers go back to the card's
own background.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht
A page showing the grid takes the card colour for its background, in place of
the panel the grid sat on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q3ezTaCo6wHFVsML6Qd4ht

This branch was successfully deployed

1 active deployment
Preview – cohort-lab — 0bb9a9b2 Deployed Nov 23, 2026 by vercel[bot]
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