diff --git a/CHANGELOG.md b/CHANGELOG.md index 11aa007..afff517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project follows [Semantic Versioning](https://semver.org/). +## 2026-11-22 + +- Meter notes in the side notch and usage panel read cleanly in every style. Terminal no longer cuts off the end of the note. Lines break between parts ("Burning fast · Runs out in ~42m ·" then "resets today, 2:13 AM"), never inside a date, time or "(in 4d 12h)". Labels such as "Weekly · All models" break at the dot. +- Orbit, Ledger, Departures and Arcade draw the activity chart as a line graph instead of bars, like Flight Deck and Blueprint. In every line graph, a day with no data breaks the line and shows a dashed baseline instead of dropping to zero. +- The chart caption says "30 days shown" without repeating the quiet-days label shown beside it, and Terminal's 30-day spark fits on one row in the side notch. "1 day shown" and "1 earned reset credit" now use the singular. + ## 2026-11-21 - Publish 0.3.0-beta.28, build 99, for macOS, Windows and Linux from `5a0551a`. It is the first published Linux build: an unsigned AppImage and tar.gz with no in-app updates. Pin installs and docs to it and add a Linux download section (ADR 0050 amendment). diff --git a/docs/kb/app.md b/docs/kb/app.md index cab865c..6fb1999 100644 --- a/docs/kb/app.md +++ b/docs/kb/app.md @@ -117,11 +117,11 @@ Part of [project knowledge](../KB.md). Settings, onboarding, cards, heatmaps, si - Candidate Appearance includes a saved Small, Medium or Large panel size, defaulting to Medium. Main-panel widths are 324, 360 and 414 points before display clamping (scales 0.9, 1 and 1.15). Small is a compact panel: it hides the service status row, activity charts and the all-provider breakdown, leaving quota meters, credits and resets. Main-panel and Settings content use the same scale. Side-notch detail content uses explicit integer pixel sizes without CSS zoom. The notch card is 220 pixels wide beside the fixed 36-pixel strip; its height follows the size-specific content within the work area. Settings measures the scaled content height and fits its active category and expanded controls within the display work area, accounting for native title-bar height. Width and top position remain when on screen. Tray and 250-pixel shared-card capture remain unchanged. Ctrl/Cmd plus or minus selects the next size; Ctrl/Cmd 0 restores Medium. These shortcuts use the same saved preference and main-panel resizing as Settings. Window loads normalize retained Chromium zoom to avoid applying a second scale. The main panel measures natural content height, shrinks when content gets shorter, and never exceeds 70% of the display work area; beyond that, content scrolls in a Base UI ScrollArea between the pinned header and footer, with no visible scrollbar (wheel, trackpad and keys still scroll). The quota heatmap starts at the first week with recorded quota history (at least 12 weeks, at most 26) and labels Mon, Wed and Fri rows; the side-notch card omits the weekday labels. Synthetic tests cover persistence, invalid values, write failure, rapid keys and display clamping; actual native sizing acceptance is separate. - Usage-panel provider tabs keep the provider marks unchanged (ADR 0002) and add the headline window's percent and a 2 px bar below each mark, coloured like the menu bar and notch strip. Each tab's accessible name includes "N% of quota used". When every service is operational and fresh, Service status is one "All services operational" line that keeps each provider's status-page link; any incident, stale reading or refresh error restores the per-provider rows. Cards no longer repeat "Operational". -- Each quota meter has one note line. "Runs out in ~42m" appears only when pacing projects exhaustion before the reset; otherwise the reset shows with "(in 4d 12h)". Pacing off shows only the reset. Bars and figures turn amber while burning fast below 80%, and Classic bars show a tick where even use would be. Classic's headline figure is 17 px in the menu panel and share card. Reset-credit expiry uses the reset line's date style ("Sun, Nov 29"). +- Each quota meter has one note line. "Runs out in ~42m" appears only when pacing projects exhaustion before the reset; otherwise the reset shows with "(in 4d 12h)". Pacing off shows only the reset. Notes break only between parts: pace and "Runs out" move to the next line whole, and the reset part keeps "resets today,", dates, clock times and "(in 4d 12h)" unbroken. Window labels break at " · ". Bars and figures turn amber while burning fast below 80%, and Classic bars show a tick where even use would be. Classic's headline figure is 17 px in the menu panel and share card. Reset-credit expiry uses the reset line's date style ("Sun, Nov 29"). - The local token heatmap skips whole weeks of recorded zeros before the first activity, keeping at least 12 weeks, and labels them ("12 weeks · 14 quiet weeks hidden"). Unavailable days are not quiet and stay visible. With the heatmap on, the 30-day sparkline moves under More activity. - Settings → Connections gives every provider, including Muse Code and OpenCode Go, the same row: mark, name, one status chip (Connected, CLI, Local, Not connected, No allowance, Failed, Unavailable, Off), one source line with collection state, a warning line only when allowance is missing, and an outlined Configure button. Help text, method choice, the full status sentence and actions stay mounted in the Configure panel. -- Appearance offers a saved interface Style (`interfaceStyle`, default `classic`): Classic, Flight Deck, Orbit, Ledger, Terminal, Blueprint, Departures and Arcade ([ADR 0042](../adr/0042-interface-styles.md)). Each style picks a meter, notch gauge and activity chart from `src/shared/styles.ts`. Classic follows Theme and Accent, Ledger follows Theme as paper or ink, and the rest use fixed dark palettes, so Accent shows only for Classic. Non-Classic charts collapse seven or more leading quiet days into one label. Service status and the 36 px strip and 220 px card are unchanged in every style. Native macOS demo captures (2026-11-21) cover the usage panel in every style and the Classic notch anchor check; native notch captures for the other styles and Windows captures remain pending. +- Appearance offers a saved interface Style (`interfaceStyle`, default `classic`): Classic, Flight Deck, Orbit, Ledger, Terminal, Blueprint, Departures and Arcade ([ADR 0042](../adr/0042-interface-styles.md)). Each style picks a meter, notch gauge and activity chart from `src/shared/styles.ts`. Classic uses the grid heatmap, Terminal an ASCII spark, and the other six a line graph (2026-11-22; Orbit, Ledger, Departures and Arcade used bars before). Classic follows Theme and Accent, Ledger follows Theme as paper or ink, and the rest use fixed dark palettes, so Accent shows only for Classic. Non-Classic charts collapse seven or more leading quiet days into one label. Service status and the 36 px strip and 220 px card are unchanged in every style. Native macOS demo captures (2026-11-21) cover the usage panel in every style and the Classic notch anchor check; native notch captures for the other styles and Windows captures remain pending. - Candidate Settings gives Appearance, General, Providers, Side notch, Usage details and Diagnostics direct category access beside Connections. Related options use grouped rows. Panel size uses a compact row of visible Small, Medium and Large choices; accent color uses six labelled radio swatches. Aligned provider controls distinguish collection from menu-bar and side-notch display; stopping primary collection preserves the saved display preference. The display control stays available when an additional account has an active source slot. Advanced local accounts remain available. The main panel and Settings scroll in a Base UI ScrollArea; Settings shows an overlay scrollbar only while content overflows, and the main panel hides it; native scrollbar indicators stay hidden, with scrolling and keyboard access retained. These renderer contracts do not establish native UI parity. diff --git a/src/renderer/app.tsx b/src/renderer/app.tsx index a1ec2af..5b7d06c 100644 --- a/src/renderer/app.tsx +++ b/src/renderer/app.tsx @@ -86,6 +86,11 @@ function MeterVisual({ kind, used, marker, colour }: { kind: MeterKind; used: nu } /** "Sun, Nov 29", the reset line's date style; the year appears only when it differs from now. */ const shortDate = (at: number, now: number) => new Date(at).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric", ...(new Date(at).getFullYear() === new Date(now).getFullYear() ? {} : { year: "numeric" }) }); +// Dates, clock times and countdowns stay on one line, so narrow notes wrap between phrases, not inside "resets today,", "Nov 26" or "(in 4d 12h)". +const unbroken = /(\([^)]*\)|^[Rr]esets [A-Za-z]+,?|[A-Z][a-z]{2} \d{1,2}(?:, \d{4})?|\d{1,2}:\d{2}\s[AP]M)/; +const keepTogether = (text: string): ReactNode => { const parts = text.split(unbroken); return parts.length < 2 ? text : parts.map((p, i) => i % 2 ? {p} : p); }; +// A label such as "Weekly · All models" wraps at its separator, not inside a short phrase. +const phrases = (text: string): ReactNode => { const parts = text.split(" · "); return parts.length < 2 || parts.some(p => p.length > 24) ? text : parts.flatMap((p, i) => [...(i ? [" · "] : []), {p}]); }; /** Reset time with the day spelled out: "today", "tomorrow", or the weekday and date. */ export function resetText(resetsAt: number, now: number): string { const at = new Date(resetsAt), time = at.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }); @@ -112,8 +117,8 @@ export function Meter({ w, now, activityAt, pacing, quotaBurn = false }: { w: Qu const parts: ReactNode[] = []; if (pacing && text) parts.push({text[0].toUpperCase() + text.slice(1)}); if (runsOut !== undefined) parts.push(Runs out in ~{formatETA((runsOut - now) / 1000, true)}); - parts.push({parts.length ? reset.replace(/^Resets/, "resets") : reset}{until}); - return
{w.label}{figure}

{parts.flatMap((part, i) => i ? [" · ", part] : [part])}

; + parts.push({keepTogether(`${parts.length ? reset.replace(/^Resets/, "resets") : reset}${until}`)}); + return
{phrases(w.label)}{figure}

{parts.flatMap((part, i) => i ? [" · ", part] : [part])}

; } interface StripCell { amount?: number; peak: number; readout: string; label: string } /** Sparse-aware daily strip: a leading run of quiet days collapses into one labelled block. */ @@ -142,11 +147,19 @@ function ActivityStrip({ kind, cells, label }: { kind: Exclude height - 3 - level(c) * (height - 8); - const path = `M0 ${y(shown[0]).toFixed(1)}` + shown.map((c, i) => `V${y(c).toFixed(1)}H${((i + 1) * slice).toFixed(1)}`).join(""); - body = <>{quietBlock}{shown.map((c, i) => setActive(i)} />)}; + // Unavailable days break the line and get a dashed baseline, as the bars mark them, instead of plotting as zero. + const runs: { x0: number; d: string }[] = []; + shown.forEach((c, i) => { + if (c.amount === undefined) return; + const step = `V${y(c).toFixed(1)}H${((i + 1) * slice).toFixed(1)}`, last = runs.at(-1), start = +(i * slice).toFixed(1); + if (last && i > 0 && shown[i - 1].amount !== undefined) last.d += step; else runs.push({ x0: start, d: `M${start} ${y(c).toFixed(1)}${step}` }); + }); + const path = runs.map(r => r.d).join(""), area = runs.map(r => `${r.d}V${height}H${r.x0}Z`).join(""); + const gaps = shown.map((c, i) => c.amount === undefined && ); + body = <>{quietBlock}{shown.map((c, i) => setActive(i)} />)}; } else body = <>{quietBlock} 40 ? 0 : 2 }}>{shown.map((c, i) => setActive(i)}>)}; // A slider reads one day at a time in screen readers' focus mode; the visual readout repeats it for pointer users. - return <>
setActive(undefined)} onBlur={() => setActive(undefined)}>{body}
; + return <>
setActive(undefined)} onBlur={() => setActive(undefined)}>{body}
; } type HeatmapProps = { title: string; scope: string; period?: string; label: string; fullHistory?: boolean; weeks?: number; weekdays?: boolean; unavailable?: boolean; controls?: ReactNode; children?: ReactNode; chart?: ChartKind }; /** Renders a heatmap in the active style's chart. */ @@ -254,7 +267,7 @@ export function ProviderCard({ slot, state, action, detail = false, staticExport // Shown with an empty state and under last known bars alike, since either way the source cannot supply allowance now. const guide = !staticExport && quotaCode(s.quotas[key]) === "companionMissing" && ; const heatmap = s.appearance.heatmap && (slot.provider !== "claude" || s.appearance.claudeHeatmap) && (slot.provider !== "codex" || s.appearance.codexHeatmap); - return

{slotName(slot)}{slot.provider === "grok" && <> Beta}

{plan && {plan}}
{status && (status.stale || status.severity !== "operational") &&

{status.stale ? `Last known ${status.severity === "operational" ? "Operational" : status.description} · ${formatETA((s.clock - status.checkedAt) / 1000, true)} ago · ${status.refreshError}` : status.description}

}{q ? <>{fresh && slot.provider === "muse" &&

Observed {new Date(q.capturedAt).toLocaleString()} · CLI subscription allowance

}{fresh?.observedFrom === "grokBotCache" &&

Observed {new Date(q.capturedAt).toLocaleString()} · Grok Bot's cached reading

}{!fresh &&

Last known · {new Date(q.capturedAt).toLocaleString()}{q.observedFrom === "grokBotCache" && " · Grok Bot's cached reading"}
{reason(s.quotas[key])}

}{!fresh && guide}{q.groups.length ? q.groups.map(g =>

{g.title}

{g.windows.map((w, index) => c.provider === "grok" && c.source === "account" && c.accountMethod === "bot")} />)}
) : (detail ? effectiveWindows(q) : q.windows).map((w, index) => c.provider === "grok" && c.source === "account" && c.accountMethod === "bot")} />)}{q.credits &&
{q.credits.unit === "dollars" ? "Balance" : "Credits"}{q.credits.unlimited ? "Unlimited" : q.credits.unit === "dollars" ? money(q.credits.balance) : n(q.credits.balance)}
{q.credits.dollarBalance !== undefined &&

≈ {money(q.credits.dollarBalance)} equivalent

}{q.credits.usedDollars !== undefined &&

{money(q.credits.usedDollars)} used{q.credits.limitDollars === undefined ? "" : ` of ${money(q.credits.limitDollars)}`}

}
}{q.resetCreditCount !== undefined && (slot.provider !== "claude" || fresh) &&

{slot.provider === "claude" ? `${q.resetCreditCount} free reset${q.resetCreditCount === 1 ? "" : "s"}` : `${q.resetCreditCount} earned reset credits`}

{q.resetCredits.map(c =>
{c.title}{!staticExport && fresh?.canConsumeReset === true && (!detail || s.appearance.resetButton) && resetCreditAvailable(c, s.clock) && }

{c.status ? c.status[0].toUpperCase() + c.status.slice(1) : "Status not reported"}{c.expiresAt !== undefined && c.expiresAt <= s.clock ? " · expired" : ""} · {c.expiresAt === undefined ? "Expiry not reported" : `Expires ${shortDate(c.expiresAt, s.clock)}`}

)}
} : <>

{reason(s.quotas[key])}

{guide}}{usage &&

{slot.provider === "openRouter" ? "Account activity" : `Activity on ${deviceName(state)}`}

Sessions
{n(usage.sessionCount)}
Messages
{n(usage.messageCount)}
{usage.tokens !== undefined &&
Measured tokens
{n(totalTokens(usage.tokens))}
}{usage.estimatedCostUSD !== undefined &&
Estimated cost
{money(usage.estimatedCostUSD)}
}

{usage.todayMessageCount > 0 || usage.todaySessionCount > 0 ? `Today: ${n(usage.todaySessionCount)} session${usage.todaySessionCount === 1 ? "" : "s"} · ${n(usage.todayMessageCount)} messages · updated ${formatETA((s.clock - usage.capturedAt) / 1000, true)} ago` : `Updated ${formatETA((s.clock - usage.capturedAt) / 1000, true)} ago · ${usage.tokens !== undefined ? "measured token totals" : "token totals unavailable"}`}

{usage.usageWindows && (staticExport ? :
Usage by period
)}
}{accountActivity && heatmap && }{heatmap && q && !s.demo && !extract(accountActivity)?.dailyUsageBuckets?.length && }{t && (s.appearance.telemetry || s.appearance.chart || heatmap) && }{activeWindow && activity && (staticExport ? :
Active window breakdown
)}{activity && activity.sessions.length > 0 &&
Recent sessions ({activity.sessions.length}){activity.sessions.slice(-8).reverse().map(session =>
{session.projectName}{n(totalTokens(session.tokens))}

{session.model} · {session.messageCount} turns · estimated {money(session.estimatedCostUSD)}

)}
}{!activity && !usage && (s.activities[key] || s.usages[key]) &&

{reason(s.activities[key] ?? s.usages[key])}

}{detail && !staticExport &&
}
; + return

{slotName(slot)}{slot.provider === "grok" && <> Beta}

{plan && {plan}}
{status && (status.stale || status.severity !== "operational") &&

{status.stale ? `Last known ${status.severity === "operational" ? "Operational" : status.description} · ${formatETA((s.clock - status.checkedAt) / 1000, true)} ago · ${status.refreshError}` : status.description}

}{q ? <>{fresh && slot.provider === "muse" &&

Observed {new Date(q.capturedAt).toLocaleString()} · CLI subscription allowance

}{fresh?.observedFrom === "grokBotCache" &&

Observed {new Date(q.capturedAt).toLocaleString()} · Grok Bot's cached reading

}{!fresh &&

Last known · {new Date(q.capturedAt).toLocaleString()}{q.observedFrom === "grokBotCache" && " · Grok Bot's cached reading"}
{reason(s.quotas[key])}

}{!fresh && guide}{q.groups.length ? q.groups.map(g =>

{g.title}

{g.windows.map((w, index) => c.provider === "grok" && c.source === "account" && c.accountMethod === "bot")} />)}
) : (detail ? effectiveWindows(q) : q.windows).map((w, index) => c.provider === "grok" && c.source === "account" && c.accountMethod === "bot")} />)}{q.credits &&
{q.credits.unit === "dollars" ? "Balance" : "Credits"}{q.credits.unlimited ? "Unlimited" : q.credits.unit === "dollars" ? money(q.credits.balance) : n(q.credits.balance)}
{q.credits.dollarBalance !== undefined &&

≈ {money(q.credits.dollarBalance)} equivalent

}{q.credits.usedDollars !== undefined &&

{money(q.credits.usedDollars)} used{q.credits.limitDollars === undefined ? "" : ` of ${money(q.credits.limitDollars)}`}

}
}{q.resetCreditCount !== undefined && (slot.provider !== "claude" || fresh) &&

{slot.provider === "claude" ? `${q.resetCreditCount} free reset${q.resetCreditCount === 1 ? "" : "s"}` : `${q.resetCreditCount} earned reset credit${q.resetCreditCount === 1 ? "" : "s"}`}

{q.resetCredits.map(c =>
{c.title}{!staticExport && fresh?.canConsumeReset === true && (!detail || s.appearance.resetButton) && resetCreditAvailable(c, s.clock) && }

{c.status ? c.status[0].toUpperCase() + c.status.slice(1) : "Status not reported"}{c.expiresAt !== undefined && c.expiresAt <= s.clock ? " · expired" : ""} · {c.expiresAt === undefined ? "Expiry not reported" : <>Expires {keepTogether(shortDate(c.expiresAt, s.clock))}}

)}
} : <>

{reason(s.quotas[key])}

{guide}}{usage &&

{slot.provider === "openRouter" ? "Account activity" : `Activity on ${deviceName(state)}`}

Sessions
{n(usage.sessionCount)}
Messages
{n(usage.messageCount)}
{usage.tokens !== undefined &&
Measured tokens
{n(totalTokens(usage.tokens))}
}{usage.estimatedCostUSD !== undefined &&
Estimated cost
{money(usage.estimatedCostUSD)}
}

{usage.todayMessageCount > 0 || usage.todaySessionCount > 0 ? `Today: ${n(usage.todaySessionCount)} session${usage.todaySessionCount === 1 ? "" : "s"} · ${n(usage.todayMessageCount)} messages · updated ${formatETA((s.clock - usage.capturedAt) / 1000, true)} ago` : `Updated ${formatETA((s.clock - usage.capturedAt) / 1000, true)} ago · ${usage.tokens !== undefined ? "measured token totals" : "token totals unavailable"}`}

{usage.usageWindows && (staticExport ? :
Usage by period
)}
}{accountActivity && heatmap && }{heatmap && q && !s.demo && !extract(accountActivity)?.dailyUsageBuckets?.length && }{t && (s.appearance.telemetry || s.appearance.chart || heatmap) && }{activeWindow && activity && (staticExport ? :
Active window breakdown
)}{activity && activity.sessions.length > 0 &&
Recent sessions ({activity.sessions.length}){activity.sessions.slice(-8).reverse().map(session =>
{session.projectName}{n(totalTokens(session.tokens))}

{session.model} · {session.messageCount} turns · estimated {money(session.estimatedCostUSD)}

)}
}{!activity && !usage && (s.activities[key] || s.usages[key]) &&

{reason(s.activities[key] ?? s.usages[key])}

}{detail && !staticExport &&
}
; } function RollingUsage({ windows, provider }: { windows: UsageWindow[]; provider: Provider }) { const reference = windows.find(w => w.label === "last 30d"), cost = (reference?.estimatedCostUSD ?? 0) > 0; diff --git a/src/renderer/interface-styles.css b/src/renderer/interface-styles.css index 22da234..05bfd98 100644 --- a/src/renderer/interface-styles.css +++ b/src/renderer/interface-styles.css @@ -20,7 +20,8 @@ .meter-orbit .meter-time::after { content: ""; position: absolute; right: -2.5px; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--text); } .meter-orbit .meter-fill { position: absolute; left: 0; bottom: 0; height: 6px; border-radius: 6px; background: var(--brand); } .app .quota-window .meter.meter-ascii { height: auto; margin: 3px 0; overflow: hidden; border-radius: 0; background: none; } -.meter-ascii { display: block; white-space: nowrap; font-family: var(--ui-mono); font-size: 11px; line-height: 1.2; letter-spacing: -.5px; color: var(--brand); } +/* Scoped to the bar: the quota-window wrapper also carries meter-ascii, and nowrap there clipped the note. */ +.meter > .meter-ascii { display: block; white-space: nowrap; font-family: var(--ui-mono); font-size: 11px; line-height: 1.2; letter-spacing: -.5px; color: var(--brand); } .hp-label { align-self: center; padding-right: 2px; font-family: var(--ui-mono); font-size: 8px; font-weight: 800; line-height: 1; color: var(--warn); } .flap-digits { display: inline-flex; gap: 2px; vertical-align: middle; } .flap { position: relative; display: inline-grid; place-items: center; min-width: 1.05em; padding: 1px 2px; border-radius: 2px; font-family: var(--ui-mono); font-weight: 700; line-height: 1.15; color: var(--brand); background: linear-gradient(#26292d 50%, #1c1e21 50%); box-shadow: inset 0 -1px 0 #000, 0 1px 0 #ffffff12; } @@ -63,13 +64,16 @@ .trace-line { fill: none; stroke: var(--brand); stroke-width: 1.5; } .trace-area { fill: color-mix(in srgb, var(--brand) 18%, transparent); } .trace-cursor { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 2; } +.trace-gap { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 2; } .strip-hits { position: absolute; inset: 0; display: flex; } .strip-hits > span { flex: 1 1 0; } /* The outer modifier is strip-kind-*, so it never matches the inner .strip-bars or .strip-spark rows. */ .activity-strip.strip-kind-spark { display: block; height: auto; } .strip-spark { display: block; font-family: var(--ui-mono); font-size: 13px; line-height: 1.15; word-break: break-all; color: var(--brand); } -.strip-spark .strip-quiet { display: inline; max-width: none; padding: 0 4px; border: 0; background: none; font-size: 10px; } +.strip-spark .strip-quiet { display: block; text-align: left; max-width: none; padding: 0 4px; border: 0; background: none; font-size: 10px; } .strip-spark .active { color: var(--text); } +/* 30 daily glyphs fit one row of the 220 px notch card instead of spilling a few onto a second row. */ +.surface-notch .strip-spark { font-size: 10px; } /* Style picker in Settings. */ .settings .style-picker { min-width: 0; margin: 0; padding: 14px 0; border: 0; } diff --git a/src/renderer/style.css b/src/renderer/style.css index 24359d8..b938f9c 100644 --- a/src/renderer/style.css +++ b/src/renderer/style.css @@ -289,8 +289,10 @@ /* Unlayered so it beats the scrollbar's Tailwind `flex`: the menu bar panel scrolls without a visible bar, like the rest of the app. Wheel, trackpad and keys still scroll. */ .viewport-flyout > [data-slot="scroll-area-scrollbar"] { display: none; } -.quota-window .meter-note { margin: 0; } -.quota-window .runs-out { color: var(--warn); font-weight: 600; } +/* Short note parts (pace, runs out) move to the next line whole; the reset part flows, with its date phrases kept together in app.tsx. */ +.quota-window .meter-note { margin: 0; } .quota-window .meter-note > span:not(.reset-line) { display: inline-block; max-width: 100%; text-align: start; } +.quota-window .runs-out { color: var(--warn); font-weight: 600; white-space: nowrap; } +.nowrap { white-space: nowrap; } :is(.secondary, .heatmap-readout) { text-wrap: pretty; } /* Classic: pace tick sits proud of the bar, and the headline figure carries the most weight in the card. */ .app .quota-window .meter.meter-bar { position: relative; overflow: visible; } .app .quota-window .meter-bar .meter-pace { top: -2px; bottom: -2px; opacity: .75; } diff --git a/src/shared/styles.ts b/src/shared/styles.ts index 173ac73..0d28f48 100644 --- a/src/shared/styles.ts +++ b/src/shared/styles.ts @@ -12,12 +12,12 @@ export interface StyleInfo { export const styleInfo: Record = { classic: { name: "Classic", tagline: "System look with bars and rings", meter: "bar", gauge: "conic", chart: "grid", palette: "follow" }, flightDeck: { name: "Flight Deck", tagline: "Amber LED tapes with a pace needle", meter: "tape", gauge: "vu", chart: "trace", palette: "fixed" }, - orbit: { name: "Orbit", tagline: "Rings that track time against quota", meter: "orbit", gauge: "twin", chart: "bars", palette: "fixed" }, - ledger: { name: "Ledger", tagline: "Serif figures on newsprint", meter: "rule", gauge: "figure", chart: "bars", palette: "theme" }, + orbit: { name: "Orbit", tagline: "Rings that track time against quota", meter: "orbit", gauge: "twin", chart: "trace", palette: "fixed" }, + ledger: { name: "Ledger", tagline: "Serif figures on newsprint", meter: "rule", gauge: "figure", chart: "trace", palette: "theme" }, terminal: { name: "Terminal", tagline: "Green phosphor with ASCII bars", meter: "ascii", gauge: "ascii", chart: "spark", palette: "fixed" }, blueprint: { name: "Blueprint", tagline: "Quotas drawn as dimension lines", meter: "rule", gauge: "twin", chart: "trace", palette: "fixed" }, - departures: { name: "Departures", tagline: "Split-flap board with reset times", meter: "flap", gauge: "flap", chart: "bars", palette: "fixed" }, - arcade: { name: "Arcade", tagline: "Quota left shown as hit points", meter: "hp", gauge: "hp", chart: "bars", palette: "fixed" }, + departures: { name: "Departures", tagline: "Split-flap board with reset times", meter: "flap", gauge: "flap", chart: "trace", palette: "fixed" }, + arcade: { name: "Arcade", tagline: "Quota left shown as hit points", meter: "hp", gauge: "hp", chart: "trace", palette: "fixed" }, }; export const validInterfaceStyle = (v: unknown): v is InterfaceStyle => typeof v === "string" && (interfaceStyles as readonly string[]).includes(v); export const styleOf = (v: unknown): InterfaceStyle => validInterfaceStyle(v) ? v : "classic"; diff --git a/tests/renderer.test.ts b/tests/renderer.test.ts index a7b8de0..f439729 100644 --- a/tests/renderer.test.ts +++ b/tests/renderer.test.ts @@ -320,7 +320,7 @@ it("hides reset actions for allowance-only sources while retaining earned credit for (const capability of [undefined, false, true]) { q.canConsumeReset = capability; for (const surface of ["flyout", "notch", "share"]) { - const markup = renderApp(view, surface); expect(markup).toContain("1 earned reset credits"); + const markup = renderApp(view, surface); expect(markup).toContain("1 earned reset credit"); expect(markup.includes("Use reset")).toBe(capability === true && surface !== "share"); } } @@ -657,7 +657,7 @@ it("keeps static exports free of actions and selectors while retaining credit an expect(live).toContain(action); expect(exported).not.toContain(action); } expect(exported).not.toMatch(/<(button|select)\b/); - for (const data of ["1 earned reset credits", "Full reset", "Available", "Expires", "12 weeks · 14 quiet weeks hidden", "1,234,567 tokens, 2 sessions", "80% used"]) { + for (const data of ["1 earned reset credit", "Full reset", "Available", "Expires", "12 weeks · 14 quiet weeks hidden", "1,234,567 tokens, 2 sessions", "80% used"]) { expect(live).toContain(data); expect(exported).toContain(data); } }); @@ -1245,7 +1245,7 @@ it("collapses quiet weeks into one labelled block in strip-chart styles", () => view.snapshot.quotaActivity = { codex: [3, 2, 1, 0].map(ago => ({ day: shiftDay(today, -ago), percent: 10 + ago })) }; const render = (style: "classic" | "ledger" | "flightDeck" | "terminal") => renderToStaticMarkup(createElement(StyleContext.Provider, { value: style }, createElement(ProviderCard, { slot: primary("codex"), state: view, action: async () => {} }))); expect(render("classic")).toContain("heatmap-cell"); - for (const [style, kind] of [["ledger", "bars"], ["flightDeck", "trace"], ["terminal", "spark"]] as const) { + for (const [style, kind] of [["ledger", "trace"], ["flightDeck", "trace"], ["terminal", "spark"]] as const) { const markup = render(style); expect(markup).toContain(`activity-strip strip-kind-${kind}`); expect(markup).not.toContain("heatmap-cell"); @@ -1264,6 +1264,10 @@ it("draws strip days without overflow, inventing light use or hiding the latest const trace = strip("trace", [...Array(9).fill(0), 7]); expect(trace).toContain("9 quiet days"); expect(trace).toMatch(/d="M0 [\d.]+V[\d.]+H300\.0"/); + const gap = strip("trace", [5, undefined, 5]); + expect(gap).toMatch(/class="trace-line" d="M0 5\.0V5\.0H100\.0M200 5\.0V5\.0H300\.0"/); + expect(gap).toMatch(/class="trace-area" d="M0 5\.0V5\.0H100\.0V60H0ZM200 5\.0V5\.0H300\.0V60H200Z"/); + expect(gap).toMatch(/ { const view = state(), q = quota("codex", [], now), expires = now + 3 * 86400000; q.resetCreditCount = 1; q.resetCredits = [{ id: "c", title: "Full reset", status: "available", expiresAt: expires }]; view.snapshot.quotas.codex = value(q); - expect(renderApp(view)).toContain(`Available · Expires ${new Date(expires).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" })}`); + const markup = renderApp(view); + expect(markup.replace(/([^<]*)<\/span>/g, "$1")).toContain(`Available · Expires ${new Date(expires).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" })}`); + // Locale-independent: the date text sits after "Expires", and in English its "Nov 30" part is wrapped whole. + if (/[A-Z][a-z]{2} \d{1,2}/.test(new Date(expires).toLocaleDateString([], { month: "short", day: "numeric" }))) expect(markup).toMatch(/Expires [^<]*[A-Z][a-z]{2} \d{1,2}<\/span>/); }); it("takes the tab headline from the same effective windows as the notch strip", () => { @@ -1362,3 +1369,24 @@ it("marks the scroll root per surface so only the usage panel hides its scrollba expect(css).toContain('.viewport-flyout > [data-slot="scroll-area-scrollbar"] { display: none; }'); expect(css).not.toContain(".viewport-settings"); }); + +it("wraps narrow meter notes and labels between phrases, never inside a date or countdown", () => { + const render = (win: ReturnType) => renderToStaticMarkup(createElement(Meter, { w: win, now, pacing: true })); + const calm = render(window("Weekly · All models", 10, now + 3 * 86400000, 10080)); + expect(calm).toContain('Weekly · All models'); + expect(calm).toMatch(/]*>resets [A-Za-z]+,<\/span>/); + expect(calm).toContain('(in 3d)'); + const css = readFileSync("src/renderer/style.css", "utf8"), styles = readFileSync("src/renderer/interface-styles.css", "utf8"); + expect(css).toContain(".quota-window .runs-out { color: var(--warn); font-weight: 600; white-space: nowrap; }"); + expect(css).toContain(".quota-window .meter-note > span:not(.reset-line) { display: inline-block;"); + // The quota-window wrapper also carries meter-ascii; a bare selector made Terminal notes nowrap and clipped them. + expect(styles).toContain(".meter > .meter-ascii { display: block; white-space: nowrap;"); + expect(styles).not.toMatch(/^\.meter-ascii \{/m); +}); + +it("keeps the quiet-day count out of the strip readout and pluralises its day count", () => { + const strip = (amounts: number[]) => renderToStaticMarkup(createElement(ActivityHeatmap, { title: "Activity", scope: "Synthetic", label: "Test strip", chart: "trace", children: amounts.map((amount, i) => createElement(HeatmapCell, { key: i, amount, peak: 5, readout: `${amount}`, label: `Day ${i}` })) })); + const quiet = strip([...Array(21).fill(0), 4]); + expect(quiet).toContain("3 quiet weeks collapsed"); expect(quiet).toContain('1 day shown'); + expect(strip([1, 2])).toContain('2 days shown'); +});