Skip to content

Commit c70bd89

Browse files
committed
fix(viz mobile): mode pills become select <480px, hide redundant strips on phones
1 parent 6e422df commit c70bd89

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

src/dashboard/src/components/viz/HighlightStrip.module.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
font-size: var(--font-xs);
1313
color: var(--text-2);
1414
line-height: 1.4;
15+
16+
// Below 640px the TurnBanner headline already carries the event
17+
// title above this row; the divergence summary repeated here just
18+
// eats vertical space the canvas needs more. Pull it off-screen
19+
// for assistive tech (display:none drops it from the a11y tree)
20+
// so phones reclaim the row.
21+
@media (max-width: 640px) {
22+
display: none;
23+
}
1524
}
1625

1726
.text { flex: 1 1 auto; }

src/dashboard/src/components/viz/VizLegendBar.module.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
font-family: var(--sans);
1414
font-size: var(--font-xs);
1515
color: var(--text-3);
16+
17+
// Below 480px the 4 legend swatches + Show full legend button take a
18+
// full 40px row. The legend is reference info, not interactive — and
19+
// SHOW FULL LEGEND is still reachable via the toolbar's ? Help
20+
// overlay on phones. Reclaim the row for canvas height.
21+
@media (max-width: 480px) {
22+
display: none;
23+
}
1624
}
1725

1826
.glyphRow {

src/dashboard/src/components/viz/grid/GridModePills.tsx

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useMediaQuery, PHONE_QUERY } from './useMediaQuery.js';
2+
13
export type GridMode = 'living' | 'mood' | 'forge' | 'ecology' | 'divergence';
24

35
/** Hints are scenario-templated. `{people}` = plural population noun,
@@ -48,6 +50,49 @@ export function GridModePills({
4850
counts?: Partial<Record<GridMode, number>>;
4951
labels: { person: string; people: string; Person: string; People: string };
5052
}) {
53+
const isPhone = useMediaQuery(PHONE_QUERY);
54+
55+
// On phone viewports the 5-pill row was horizontally scrollable but
56+
// ate ~44px of vertical chrome + always required the user to swipe
57+
// sideways to see DIVERGENCE / ECOLOGY. Native <select> renders the
58+
// current mode + a tap target that opens the system picker — cleaner
59+
// and reclaims the row for actual viz content.
60+
if (isPhone) {
61+
return (
62+
<select
63+
aria-label="Grid viz mode"
64+
value={mode}
65+
onChange={(e) => onChange(e.target.value as GridMode)}
66+
title={interpolate(MODES.find(m => m.key === mode)?.hint ?? '', labels)}
67+
style={{
68+
width: '100%',
69+
padding: '8px 10px',
70+
fontSize: 16, // iOS Safari zoom-on-focus threshold
71+
fontFamily: 'var(--mono)',
72+
fontWeight: 800,
73+
letterSpacing: '0.08em',
74+
textTransform: 'uppercase',
75+
background: 'var(--bg-card)',
76+
color: 'var(--text-1)',
77+
border: '1px solid var(--border)',
78+
borderRadius: 6,
79+
cursor: 'pointer',
80+
minHeight: 44, // WCAG 2.5.5 target size
81+
}}
82+
>
83+
{MODES.map((m) => {
84+
const count = counts?.[m.key];
85+
const countSuffix = typeof count === 'number' && count > 0 ? ` · ${count}` : '';
86+
return (
87+
<option key={m.key} value={m.key}>
88+
{m.label}{countSuffix}
89+
</option>
90+
);
91+
})}
92+
</select>
93+
);
94+
}
95+
5196
return (
5297
<div
5398
role="tablist"

0 commit comments

Comments
 (0)