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

stop Pill's own inline-flex from defeating a caller's `hidden` on the Usage page

[._.]/ Adam Eivya686938772dc
diff --git a/client/src/AGENTS.md b/client/src/AGENTS.md
index ec137b069b..e6a8dd6afb 100644
--- a/client/src/AGENTS.md
+++ b/client/src/AGENTS.md
@@ -7,6 +7,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 `…: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).
+- **A shared primitive that bakes in `inline-flex` must yield it to a caller's own display utility.** Tailwind v4 emits display utilities in alphabetical order, so `.inline-flex` lands AFTER `.hidden` in the stylesheet and wins at equal specificity: a `<Pill className="hidden sm:inline-flex">` stayed visible at every width, and the responsive variant it was paired with did nothing. `Pill` handles this (see `OWN_DISPLAY` in `components/ui/Pill.jsx`); `InfoTooltip`, `CopyableId`, and `ProvenanceChip` still interpolate `className` after a hardcoded `inline-flex` and need the same treatment the first time one of them is given a `hidden md:` call site. Primitives baking `flex`/`grid` are not exposed — those sort BEFORE `.hidden` and lose to it correctly.
- **A fixed-width popover carries a viewport clamp** - an absolutely-positioned panel whose width is fixed at 256px or more (`w-64` and up, or the same size as an arbitrary `w-[19rem]`) must also carry `max-w-[calc(100vw-1rem)]`. `Layout`'s root shell is `overflow-x-hidden`, so anything wider than the viewport is *clipped away*, not made scrollable: a `w-96` filter panel anchored `right-3` on a 360px phone puts its whole left column of controls permanently off-screen with nothing to scroll to. The `calc(100vw-1rem)` form (not `90vw`) is the standard because it holds an 8px gutter at every width instead of a proportional one that collapses on small screens. Enforced tree-wide by `client/src/popoverClampConventions.test.js`.
- **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
diff --git a/client/src/components/ui/Pill.jsx b/client/src/components/ui/Pill.jsx
index f54635a6d7..99a5740d10 100644
--- a/client/src/components/ui/Pill.jsx
+++ b/client/src/components/ui/Pill.jsx
@@ -16,6 +16,15 @@
// never emit a `border-…` color with no `border` width).
// mono — adds font-mono (host / scheme badges).
// Any extra props (`title`, …) pass through to the span.
+//
+// A caller's own unprefixed display utility replaces the default `inline-flex`.
+// Tailwind v4 emits display utilities alphabetically, so `.inline-flex` lands
+// after `.hidden` in the stylesheet and outranks it at equal specificity: a
+// `hidden sm:inline-flex` className used to leave the badge visible at every
+// width, with the responsive variant it was paired with doing nothing.
+// Responsive variants ride in a media query that already outranks the base
+// layer, so they must NOT count as an override here.
+const OWN_DISPLAY = /(?:^|\s)(?:hidden|block|inline|inline-block|flex|inline-flex|grid|inline-grid|contents)(?:\s|$)/;
const TONES = {
accent: 'text-port-accent bg-port-accent/10 border-port-accent/20',
@@ -48,7 +57,8 @@ export default function Pill({
// with no width to paint it.
const color = bordered ? toneClass : toneClass.replace(/\bborder-\S+/g, '');
const cls = [
- 'inline-flex items-center gap-1 rounded',
+ OWN_DISPLAY.test(className) ? '' : 'inline-flex',
+ 'items-center gap-1 rounded',
sz.text,
sz.padding,
bordered ? 'border' : '',
diff --git a/client/src/components/ui/Pill.test.jsx b/client/src/components/ui/Pill.test.jsx
index 1bd48f1606..de069d26f5 100644
--- a/client/src/components/ui/Pill.test.jsx
+++ b/client/src/components/ui/Pill.test.jsx
@@ -71,6 +71,24 @@ describe('Pill', () => {
expect(el.className).toContain('border-port-warning/30');
});
+ // See OWN_DISPLAY in Pill.jsx — a caller's `hidden` must win.
+ it('yields its inline-flex to a caller-supplied display utility', () => {
+ render(<Pill className="hidden sm:inline-flex">x</Pill>);
+ const tokens = screen.getByText('x').className.split(/\s+/);
+ expect(tokens).toContain('hidden');
+ expect(tokens).not.toContain('inline-flex');
+ // The responsive variant is what restores the badge above the breakpoint.
+ expect(tokens).toContain('sm:inline-flex');
+ // Everything else the primitive owns survives the swap.
+ expect(tokens).toContain('items-center');
+ expect(tokens).toContain('rounded');
+ });
+
+ it('keeps inline-flex when the caller passes only a responsive display variant', () => {
+ render(<Pill className="sm:inline-flex">x</Pill>);
+ expect(screen.getByText('x').className.split(/\s+/)).toContain('inline-flex');
+ });
+
it('passes through arbitrary props like title', () => {
render(<Pill title="tooltip">x</Pill>);
expect(screen.getByText('x')).toHaveAttribute('title', 'tooltip');
diff --git a/client/src/pages/UsagePage.jsx b/client/src/pages/UsagePage.jsx
index 300072fc6f..131c5aa2db 100644
--- a/client/src/pages/UsagePage.jsx
+++ b/client/src/pages/UsagePage.jsx
@@ -50,7 +50,7 @@ function UsageMeter({ limit }) {
return (
<div className="py-1 sm:py-2 border-b border-port-border last:border-0">
<div className="flex items-baseline justify-between gap-2 mb-0.5 sm:mb-1">
- <span className="text-white text-xs sm:text-base truncate">{limit.label}</span>
+ <span className="text-white text-xs sm:text-base truncate" title={limit.label}>{limit.label}</span>
<span className="shrink-0 text-gray-400 text-[10px] sm:text-sm">
{remaining == null ? '—' : `${remaining}% left`}
</span>
@@ -107,7 +107,9 @@ function ProviderQuotaCard({ quota, onRefresh, refreshing, disabled }) {
return (
<div className="bg-port-card border border-port-border rounded-lg p-2 sm:rounded-xl sm:p-4">
<div className="flex items-center justify-between gap-1 sm:gap-2 mb-1 sm:mb-2">
- <h3 className="text-sm sm:text-base font-semibold text-white truncate">{quota.label}</h3>
+ {/* min-w-0 so the provider name shrinks with the card instead of being
+ crushed to nothing by the fixed-width controls beside it. */}
+ <h3 className="min-w-0 text-sm sm:text-base font-semibold text-white truncate">{quota.label}</h3>
<div className="flex items-center gap-1 sm:gap-2 shrink-0">
{quota.plan && quota.plan !== 'unknown' && (
<Pill tone="context" size="xs" className="hidden sm:inline-flex">{quota.plan}</Pill>
@@ -174,7 +176,10 @@ function ProviderQuotaCard({ quota, onRefresh, refreshing, disabled }) {
{/* Backends with no queryable quota report observed counts instead of
a meter — a percentage we cannot measure must not be invented. */}
{quota.metrics?.length > 0 && (
- <div className="grid grid-cols-2 gap-2">
+ // One tile per row on a phone: these cells sit inside an already
+ // half-width mobile card, and two columns of it wrapped a tile's
+ // label and detail onto four lines apiece.
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
{quota.metrics.map((m) => (
<StatTile key={m.key} label={m.label} value={m.value} detail={m.detail} />
))}
@@ -182,7 +187,7 @@ function ProviderQuotaCard({ quota, onRefresh, refreshing, disabled }) {
)}
{quota.activity?.length > 0 && (
- <div className="hidden sm:grid grid-cols-1 sm:grid-cols-2 gap-2 pt-1">
+ <div className="hidden sm:grid sm:grid-cols-2 gap-2 pt-1">
{quota.activity.map((a) => (
<StatTile
key={a.period}
diff --git a/client/src/pages/UsagePage.test.jsx b/client/src/pages/UsagePage.test.jsx
index 0fd388dbdd..3aa9454fba 100644
--- a/client/src/pages/UsagePage.test.jsx
+++ b/client/src/pages/UsagePage.test.jsx
@@ -235,6 +235,51 @@ describe('UsagePage federated quota readings', () => {
});
});
+describe('UsagePage mobile provider-card layout', () => {
+ const metricsCard = {
+ family: 'image_gen',
+ label: 'Image Gen',
+ supported: true,
+ plan: 'pro',
+ limits: [],
+ activity: [],
+ metrics: [
+ { key: 'codex', label: 'Codex · image_gen', value: 'No renders · 24h', detail: 'quota not reported by this CLI' },
+ { key: 'grok', label: 'Grok · image_gen', value: 'No renders · 24h', detail: 'quota not reported by this CLI' },
+ ],
+ fleet: {
+ count: 2,
+ instances: [
+ { instanceId: 'inst-self', name: null, self: true, fetchedAt: '2026-09-03T10:00:00.000Z' },
+ { instanceId: 'inst-peer', name: 'Example Box', self: false, fetchedAt: '2026-09-03T11:00:00.000Z' },
+ ],
+ },
+ };
+
+ // Two cards share the row at phone width, so the header badges are
+ // desktop-only and the observed-count tiles stack. Both were regressions the
+ // class strings alone did not deliver: `Pill` used to re-assert its own
+ // `inline-flex` over the caller's `hidden` (see OWN_DISPLAY in Pill.jsx), and
+ // two columns of tiles inside a half-width card wrapped every label onto four
+ // lines.
+ it('hides the header badges and stacks the count tiles at phone width', async () => {
+ api.getProviderUsage.mockResolvedValue({ providers: [metricsCard] });
+ render(<MemoryRouter><UsagePage /></MemoryRouter>);
+
+ await screen.findByRole('heading', { name: 'Image Gen' });
+ for (const badge of [screen.getByText('pro'), screen.getByText('2 instances')]) {
+ const tokens = badge.className.split(/\s+/);
+ expect(tokens).toContain('hidden');
+ expect(tokens).not.toContain('inline-flex');
+ }
+
+ const tileGrid = screen.getByText('Codex · image_gen').closest('.grid');
+ expect(tileGrid.className.split(/\s+/)).toEqual(
+ expect.arrayContaining(['grid-cols-1', 'sm:grid-cols-2'])
+ );
+ });
+});
+
describe('arrangeQuotaCells', () => {
const q = (family) => ({ family, label: family });