Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: scan every bare grid-cols token and widen the icon picker on phones (#5679)

[._.]/ Adam Eivy57238bfbad04
diff --git a/client/src/AGENTS.md b/client/src/AGENTS.md
index 45ee3151ac..a64d26fe0f 100644
--- a/client/src/AGENTS.md
+++ b/client/src/AGENTS.md
@@ -6,7 +6,7 @@ These apply to React/Vite client code. Universal constraints (functional program
- **No window.alert/confirm** - use inline confirmations or toast notifications
- **Form labels need `htmlFor`/`id` pairing** - when adding a settings/config form field, wire `<label htmlFor="...">` to an `id="..."` on the input — screen readers and click-to-focus both depend on the association. The visual `block`/`mb-1` styling alone doesn't establish it.
-- **Mobile responsive** - all pages should be mobile responsive friendly. **A `grid-cols-N` with N > 3 and no breakpoint prefix is a bug**, not a style nit: at 360px a four-up stat bar gives each card ~65px of outer width, so its label wraps to five lines and the whole above-the-fold region is unreadable. Give the phone a narrow default and let the viewport opt into the wide layout (`grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4`). Enforced tree-wide by `client/src/responsiveGridConventions.test.js`, which carries the allowlist for the few grids that really are N-across on a phone (a seven-day month grid, the fixed five-trait Big Five bars).
+- **Mobile responsive** - all pages should be mobile responsive friendly. **A `grid-cols-N` with N > 3 and no `…:grid-cols-*` anywhere in the same class string is a bug**, not a style nit: at 360px a four-up stat bar gives each card ~65px of outer width, so its label wraps to five lines and the whole above-the-fold region is unreadable. Give text-bearing cards a narrow phone default and let the viewport opt into the wide layout (`grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4`); a widened *gap* (`gap-4 sm:gap-6`) is not a column breakpoint. A grid of square thumbnails or heatmap cells may stay four-plus wide on a phone, but it still needs a column breakpoint so the desktop isn't stuck at the phone count. Enforced tree-wide by `client/src/responsiveGridConventions.test.js`, which carries the allowlist for the few grids that really are frozen N-across (a seven-day month grid, the fixed five-trait Big Five bars).
- **Above the fold** - keep actionable content and info above the fold and design pages for maximum information and access without scrolling
- **No hardcoded localhost** - use `window.location.hostname` for URLs; app accessed via Tailscale remotely
- **Chrome floating over media uses `.port-media-overlay`** - a label, status bar, badge, or control panel sitting on top of an image, a video, or a 3D canvas takes its surface and ink from the theme (`.port-media-overlay`, or `.port-media-overlay-strong` for a small label directly on photography; `.port-media-overlay-item` for its buttons, `.port-media-overlay-divider` for its separators — all defined in `index.css`, which carries the mechanism and the rule for picking between this, `.always-dark`, and the OpenWorld HUD remap). **Don't write `bg-black/NN` + `text-white`/`text-gray-N00` for this** — day mode remaps the text to the theme's dark ink while the black scrim stays black, so the label renders dark-on-black. Older overlays outside the 3D/Three.js pages still carry that idiom (migration tracked in #3796), so match the new convention rather than the nearest neighbor.
diff --git a/client/src/components/IconPicker.jsx b/client/src/components/IconPicker.jsx
index 363bacff8c..ca5abff7f2 100644
--- a/client/src/components/IconPicker.jsx
+++ b/client/src/components/IconPicker.jsx
@@ -37,7 +37,7 @@ export default function IconPicker({ value, onChange }) {
aria-hidden="true"
/>
<div className="absolute top-full left-0 mt-1 w-full bg-port-card border border-port-border rounded-lg shadow-xl z-50 p-2 max-h-64 overflow-auto">
- <div className="grid grid-cols-4 gap-1 sm:grid-cols-5">
+ <div className="grid grid-cols-3 gap-1 sm:grid-cols-5">
{iconNames.map(name => (
<button
key={name}
diff --git a/client/src/responsiveGridConventions.test.js b/client/src/responsiveGridConventions.test.js
index 257369f173..7ef6b0fe09 100644
--- a/client/src/responsiveGridConventions.test.js
+++ b/client/src/responsiveGridConventions.test.js
@@ -12,10 +12,17 @@
*
* The rule: a `className` string holding a bare `grid-cols-N` for N >= 4 must
* also hold at least one *prefixed* `…:grid-cols-*` in the same string, so the
- * wide layout is something the viewport opts into rather than the phone default.
- * Any variant prefix counts — a media breakpoint (`sm:`), a container query
- * (`@3xl:`), or a custom variant — because each of them makes the column count
- * conditional on available width.
+ * column count is conditional on available width instead of frozen at every
+ * viewport. Any variant prefix counts — a media breakpoint (`sm:`), a container
+ * query (`@3xl:`), or a custom variant.
+ *
+ * Deliberately NOT "the unprefixed default must be <= 3 columns": a grid of
+ * square thumbnails or heatmap cells is legitimately four to six wide on a
+ * phone (`grid-cols-4 sm:grid-cols-8 lg:grid-cols-12` over sprite frames,
+ * `grid-cols-6 sm:grid-cols-12` over a 24-hour heatmap) because the cell holds
+ * no text to wrap. The defect this guard exists for is the *frozen* count — a
+ * grid that never learned the viewport changes — and the author who writes a
+ * breakpoint at all has demonstrably thought about the narrow case.
*
* Scoped to git-tracked non-test sources under `client/src` so an untracked
* scratch file can't fail the suite. Comments are masked first: a doc comment
@@ -95,12 +102,22 @@ function maskComments(source) {
}
const STRING_LITERAL = /(['"`])((?:\\.|(?!\1)[\s\S])*?)\1/g;
-// A column count that is the phone default: no `variant:` in front of it.
-const BARE_WIDE_GRID = /(?:^|\s)grid-cols-(\d+)(?=\s|$)/;
+// A column count that is the phone default: no `variant:` in front of it. Global,
+// because a single class string can hold more than one bare token and the widest
+// one is the one that decides whether the layout is legible.
+const BARE_GRID = /(?:^|\s)grid-cols-(\d+)(?=\s|$)/g;
// Any variant prefix — `sm:`, `lg:`, `@3xl:`, `roomy-viewport:` — makes it conditional.
const PREFIXED_GRID = /[\w@[\]().\-/]+:grid-cols-/;
const MIN_WIDE_COLUMNS = 4;
+function widestBareColumnCount(value) {
+ BARE_GRID.lastIndex = 0;
+ let widest = 0;
+ let bare;
+ while ((bare = BARE_GRID.exec(value))) widest = Math.max(widest, Number(bare[1]));
+ return widest;
+}
+
function lineOf(source, index) {
return source.slice(0, index).split('\n').length;
}
@@ -112,8 +129,7 @@ function violationsIn(rawSource, file) {
STRING_LITERAL.lastIndex = 0;
while ((match = STRING_LITERAL.exec(source))) {
const value = match[2];
- const bare = value.match(BARE_WIDE_GRID);
- if (!bare || Number(bare[1]) < MIN_WIDE_COLUMNS) continue;
+ if (widestBareColumnCount(value) < MIN_WIDE_COLUMNS) continue;
if (PREFIXED_GRID.test(value)) continue;
found.push(`${file}:${lineOf(source, match.index)} — "${value.trim()}"`);
}
@@ -136,6 +152,10 @@ describe('responsive grid conventions', () => {
const flagged = (markup) => violationsIn(`<div className="${markup}" />`, 'probe.jsx').length;
expect(flagged('grid grid-cols-4 gap-4 mb-6')).toBe(1);
expect(flagged('grid grid-cols-5 gap-2')).toBe(1);
+ // A widened gap is not a column breakpoint — it leaves four columns frozen.
+ expect(flagged('grid grid-cols-4 gap-4 sm:gap-6 text-center')).toBe(1);
+ // The widest bare token decides, not the first one seen.
+ expect(flagged('grid grid-cols-2 gap-2 grid-cols-6')).toBe(1);
expect(flagged('grid grid-cols-2 gap-3 sm:gap-4 lg:grid-cols-4')).toBe(0);
expect(flagged('grid grid-cols-4 sm:grid-cols-8 lg:grid-cols-12 gap-1.5')).toBe(0);
expect(flagged('grid grid-cols-2 gap-3 @3xl:grid-cols-4')).toBe(0);