mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-20 07:15:25 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7eec266f50 | ||
|
|
b3d860cce2 |
@@ -233,8 +233,8 @@ test.describe("usage modal", () => {
|
||||
],
|
||||
});
|
||||
await gotoAppShell(page);
|
||||
// Three windows leave no room for labels in the summary, so it reads percents.
|
||||
await expectPinnedUsage(page, ["31%", "20%", "12%"]);
|
||||
// Three Weekly labels overflow the summary, so it falls back to compact shorthands.
|
||||
await expectPinnedUsage(page, ["31% wk", "20% wk", "12% wk"]);
|
||||
await openUsageFromItem(page);
|
||||
await expectUsageCardOrder(page, ["alpha:a", "beta:home", "beta:work"]);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import {
|
||||
usageModal,
|
||||
installTallUsageSource,
|
||||
} from "../support/helpers/usage-sidebar-item";
|
||||
import { seedDockedSidebarWidth } from "../support/helpers/sidebar-footer-overflow";
|
||||
import { seedSidebarFooterPreferences } from "../support/helpers/sidebar-nav-settings";
|
||||
import { waitForSettledPosition } from "../support/helpers/sheet-layout";
|
||||
import { createTempGitRepo } from "../support/helpers/workspace";
|
||||
@@ -577,3 +578,97 @@ test("visible usage summary requests reports on load", async ({ page }) => {
|
||||
await expectPinnedUsage(page, ["31% 5h", "54% wk", "7% 5h", "12% wk"]);
|
||||
expect(usage.listRequests()).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("sidebar usage falls back to period shorthands before dropping all labels", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(120_000);
|
||||
const [claude, codex] = claudeAndCodexReports();
|
||||
const fetchedAt = new Date().toISOString();
|
||||
await installUsageReportsFixture(page, {
|
||||
lists: [
|
||||
() => [
|
||||
{
|
||||
...codex!,
|
||||
report: {
|
||||
status: "available",
|
||||
windows: [
|
||||
{ id: "weekly", label: "Weekly", shortLabel: "wk", summary: true, usedPct: 97 },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
...claude!,
|
||||
report: {
|
||||
status: "available",
|
||||
windows: [
|
||||
{ id: "five_hour", label: "Session", shortLabel: "5h", summary: true, usedPct: 100 },
|
||||
{ id: "weekly", label: "Weekly", shortLabel: "wk", summary: true, usedPct: 14 },
|
||||
{
|
||||
id: "weekly_model_opus",
|
||||
label: "Weekly · Opus",
|
||||
shortLabel: "wk Opus",
|
||||
summary: true,
|
||||
usedPct: 22,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "antigravity:default",
|
||||
account: {},
|
||||
fetchedAt,
|
||||
sourceId: "antigravity",
|
||||
sourceLabel: "Antigravity",
|
||||
report: {
|
||||
status: "available",
|
||||
windows: [
|
||||
{
|
||||
id: "gemini-weekly",
|
||||
label: "Gemini Models · Weekly",
|
||||
shortLabel: "Gemini wk",
|
||||
summary: true,
|
||||
usedPct: 6,
|
||||
},
|
||||
{
|
||||
id: "gemini-5h",
|
||||
label: "Gemini Models · 5h",
|
||||
shortLabel: "Gemini 5h",
|
||||
summary: true,
|
||||
usedPct: 20,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
});
|
||||
await seedSidebarFooterPreferences(page, [{ key: "usage", visible: true }]);
|
||||
await seedDockedSidebarWidth(page, 432);
|
||||
await page.setViewportSize(WIDE);
|
||||
await gotoAppShell(page);
|
||||
|
||||
await expectPinnedUsage(page, ["6% wk", "20% 5h", "100% 5h", "14% wk", "22% wk", "97% wk"]);
|
||||
|
||||
const handle = page.getByTestId("left-sidebar-resize-handle");
|
||||
const dragSidebarTo = async (targetX: number) => {
|
||||
const box = (await handle.boundingBox())!;
|
||||
await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(targetX, box.y + box.height / 2, { steps: 10 });
|
||||
await page.mouse.up();
|
||||
};
|
||||
|
||||
await dragSidebarTo(600);
|
||||
await expectPinnedUsage(page, [
|
||||
"6% Gemini wk",
|
||||
"20% Gemini 5h",
|
||||
"100% 5h",
|
||||
"14% wk",
|
||||
"22% wk Opus",
|
||||
"97% wk",
|
||||
]);
|
||||
|
||||
await dragSidebarTo(300);
|
||||
await expectPinnedUsage(page, ["6%", "20%", "100%", "14%", "22%", "97%"]);
|
||||
});
|
||||
|
||||
@@ -53,7 +53,7 @@ function preferences(
|
||||
}
|
||||
|
||||
describe("choosePinnedUsageLayout", () => {
|
||||
const widths = { labelsWidth: 200, percentsWidth: 120, windowCount: 2 };
|
||||
const widths = { labelsWidth: 200, compactWidth: 200, percentsWidth: 120, windowCount: 2 };
|
||||
|
||||
it("shows meters only when every window's meter fits beside the labels", () => {
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: 240 })).toBe("meters");
|
||||
@@ -64,11 +64,27 @@ describe("choosePinnedUsageLayout", () => {
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: 199 })).toBe("percents");
|
||||
});
|
||||
|
||||
it("uses compact period shorthands when full labels overflow but compact labels fit", () => {
|
||||
const scoped = { labelsWidth: 485, compactWidth: 388, percentsWidth: 268, windowCount: 6 };
|
||||
expect(choosePinnedUsageLayout({ ...scoped, available: 485 })).toBe("labels");
|
||||
expect(choosePinnedUsageLayout({ ...scoped, available: 399 })).toBe("compact");
|
||||
expect(choosePinnedUsageLayout({ ...scoped, available: 388 })).toBe("compact");
|
||||
expect(choosePinnedUsageLayout({ ...scoped, available: 387 })).toBe("percents");
|
||||
});
|
||||
|
||||
it("skips compact mode when no window has a compact label", () => {
|
||||
const noPeriod = { labelsWidth: 220, compactWidth: 120, percentsWidth: 120, windowCount: 2 };
|
||||
expect(choosePinnedUsageLayout({ ...noPeriod, available: 180 })).toBe("percents");
|
||||
});
|
||||
|
||||
it("shows labels until the widths are measured", () => {
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: null })).toBe("labels");
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: 999, labelsWidth: null })).toBe(
|
||||
"labels",
|
||||
);
|
||||
expect(choosePinnedUsageLayout({ ...widths, available: 999, compactWidth: null })).toBe(
|
||||
"labels",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -145,6 +161,7 @@ describe("resolvePinnedUsage", () => {
|
||||
key: "claude:default/five-hour",
|
||||
label: "Claude Session 31% used",
|
||||
shortLabel: "5h",
|
||||
compactLabel: "5h",
|
||||
percent: 31,
|
||||
percentText: "31%",
|
||||
tone: "default",
|
||||
@@ -153,6 +170,7 @@ describe("resolvePinnedUsage", () => {
|
||||
key: "claude:default/weekly",
|
||||
label: "Claude Weekly 80% used",
|
||||
shortLabel: "wk",
|
||||
compactLabel: "wk",
|
||||
percent: 80,
|
||||
percentText: "80%",
|
||||
tone: "warning",
|
||||
@@ -216,6 +234,52 @@ describe("resolvePinnedUsage", () => {
|
||||
const items = windows([opencode], preferences(null));
|
||||
|
||||
expect(items.map((item) => item.shortLabel)).toEqual([""]);
|
||||
expect(items.map((item) => item.compactLabel)).toEqual([""]);
|
||||
});
|
||||
|
||||
it("extracts bare period tokens as compact labels for scoped or verbose short labels", () => {
|
||||
const mixed = report({
|
||||
sourceId: "mixed",
|
||||
sourceLabel: "Mixed",
|
||||
windows: [
|
||||
{ id: "a", label: "Session", shortLabel: "5h", summary: true, usedPct: 10 },
|
||||
{ id: "b", label: "Weekly · Opus", shortLabel: "wk Opus", summary: true, usedPct: 20 },
|
||||
{
|
||||
id: "c",
|
||||
label: "Code review · Weekly",
|
||||
shortLabel: "Code review wk",
|
||||
summary: true,
|
||||
usedPct: 30,
|
||||
},
|
||||
{
|
||||
id: "d",
|
||||
label: "Gemini Models · Weekly",
|
||||
shortLabel: "Gemini Models weekly",
|
||||
summary: true,
|
||||
usedPct: 40,
|
||||
},
|
||||
{
|
||||
id: "e",
|
||||
label: "Gemini Models · 5h",
|
||||
shortLabel: "Gemini Models 5h",
|
||||
summary: true,
|
||||
usedPct: 50,
|
||||
},
|
||||
{ id: "f", label: "Monthly", shortLabel: "Monthly", summary: true, usedPct: 60 },
|
||||
{ id: "g", label: "Premium requests", summary: true, usedPct: 70 },
|
||||
],
|
||||
});
|
||||
const items = windows([mixed], preferences(null));
|
||||
|
||||
expect(items.map((item) => [item.shortLabel, item.compactLabel])).toEqual([
|
||||
["5h", "5h"],
|
||||
["wk Opus", "wk"],
|
||||
["Code review wk", "wk"],
|
||||
["Gemini Models weekly", "wk"],
|
||||
["Gemini Models 5h", "5h"],
|
||||
["Monthly", "mo"],
|
||||
["Premium requests", ""],
|
||||
]);
|
||||
});
|
||||
|
||||
it("formats the share left when the user reads usage as remaining", () => {
|
||||
|
||||
@@ -18,6 +18,8 @@ export interface PinnedUsageWindow {
|
||||
label: string;
|
||||
/** The window's short name ("5h"), empty for none, or its label when the source sends none. */
|
||||
shortLabel: string;
|
||||
/** Bare period token ("5h", "wk", "mo") used when full short labels overflow the sidebar row. */
|
||||
compactLabel: string;
|
||||
/** The share shown, under the user's used/remaining preference. */
|
||||
percent: number;
|
||||
percentText: string;
|
||||
@@ -34,28 +36,66 @@ export interface PinnedUsageSource {
|
||||
}
|
||||
|
||||
/** How much of each window the one-line summary has room for. */
|
||||
export type PinnedUsageLayout = "meters" | "labels" | "percents";
|
||||
export type PinnedUsageLayout = "meters" | "labels" | "compact" | "percents";
|
||||
|
||||
// A meter narrower than this is a sliver that reads as noise rather than a share.
|
||||
export const MIN_METER_WIDTH = 16;
|
||||
/** The space between a meter and its text. */
|
||||
export const METER_GAP = 4;
|
||||
|
||||
const DURATION_TOKEN_PATTERN = /^\d+[smhd]$/i;
|
||||
|
||||
function normalizePeriodToken(token: string): string | null {
|
||||
const lower = token.toLowerCase();
|
||||
if (lower === "wk" || lower === "weekly") return "wk";
|
||||
if (lower === "mo" || lower === "monthly") return "mo";
|
||||
if (DURATION_TOKEN_PATTERN.test(token)) return lower;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts a bare period token ("5h", "wk", "mo") from a window's short label so tight sidebar
|
||||
* rows can keep shorthands visible instead of dropping every label when one window is scoped.
|
||||
*/
|
||||
function compactShortLabel(shortLabel: string): string {
|
||||
const trimmed = shortLabel.trim();
|
||||
if (trimmed === "") return "";
|
||||
const exact = normalizePeriodToken(trimmed);
|
||||
if (exact !== null) return exact;
|
||||
const parts = trimmed.split(/\s+/);
|
||||
if (parts.length > 1) {
|
||||
const first = normalizePeriodToken(parts[0]!);
|
||||
if (first !== null) return first;
|
||||
const last = normalizePeriodToken(parts[parts.length - 1]!);
|
||||
if (last !== null) return last;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* The richest layout that fits on one line: every window's meter, else its short label, else its
|
||||
* percent alone. Meters are all or none; a line never mixes them. Until the widths are known it
|
||||
* shows labels, which never flashes meters that turn out not to fit.
|
||||
* bare period shorthand, else its percent alone. Meters are all or none; a line never mixes them.
|
||||
* Until the widths are known it shows labels, which never flashes meters that turn out not to fit.
|
||||
*/
|
||||
export function choosePinnedUsageLayout(input: {
|
||||
available: number | null;
|
||||
labelsWidth: number | null;
|
||||
compactWidth: number | null;
|
||||
percentsWidth: number | null;
|
||||
windowCount: number;
|
||||
}): PinnedUsageLayout {
|
||||
const { available, labelsWidth, percentsWidth, windowCount } = input;
|
||||
if (available === null || labelsWidth === null || percentsWidth === null) return "labels";
|
||||
const { available, labelsWidth, compactWidth, percentsWidth, windowCount } = input;
|
||||
if (
|
||||
available === null ||
|
||||
labelsWidth === null ||
|
||||
compactWidth === null ||
|
||||
percentsWidth === null
|
||||
) {
|
||||
return "labels";
|
||||
}
|
||||
if (labelsWidth + windowCount * (MIN_METER_WIDTH + METER_GAP) <= available) return "meters";
|
||||
if (labelsWidth <= available) return "labels";
|
||||
if (compactWidth <= available && compactWidth > percentsWidth) return "compact";
|
||||
return percentsWidth < labelsWidth ? "percents" : "labels";
|
||||
}
|
||||
|
||||
@@ -85,10 +125,13 @@ export function resolvePinnedUsage(
|
||||
.map((window) => {
|
||||
const percent = displayPercent(window, preferences.displayAs) ?? 0;
|
||||
const percentText = formatPct(percent);
|
||||
const shortLabel =
|
||||
window.shortLabel ?? formatProviderUsageLabel(window.id, window.label, t);
|
||||
return {
|
||||
key: `${entry.id}/${window.id}`,
|
||||
label: `${describe(entry, formatProviderUsageLabel(window.id, window.label, t))} ${formatDisplayPct(percent, preferences.displayAs, undefined, t)}`,
|
||||
shortLabel: window.shortLabel ?? formatProviderUsageLabel(window.id, window.label, t),
|
||||
shortLabel,
|
||||
compactLabel: compactShortLabel(shortLabel),
|
||||
percent,
|
||||
percentText,
|
||||
tone: windowTone(window),
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
resolvePinnedUsage,
|
||||
type PinnedUsageLayout,
|
||||
type PinnedUsageSource,
|
||||
type PinnedUsageWindow,
|
||||
} from "./pinned";
|
||||
import { UsageModal } from "./usage-modal";
|
||||
|
||||
@@ -123,8 +124,8 @@ function layoutWidth(event: LayoutChangeEvent): number {
|
||||
|
||||
/**
|
||||
* One line: each account's icon, then per window a meter and "31% 5h". Off-screen copies measure
|
||||
* the line with labels and with percents alone; the richest layout that fits is shown, and what
|
||||
* it leaves out takes no space at all.
|
||||
* the line with full labels, bare period shorthands, and percents alone; the richest layout that
|
||||
* fits is shown, and what it leaves out takes no space at all.
|
||||
*/
|
||||
function PinnedUsageTrigger({
|
||||
label,
|
||||
@@ -139,6 +140,7 @@ function PinnedUsageTrigger({
|
||||
}) {
|
||||
const [available, setAvailable] = useState<number | null>(null);
|
||||
const [labelsWidth, setLabelsWidth] = useState<number | null>(null);
|
||||
const [compactWidth, setCompactWidth] = useState<number | null>(null);
|
||||
const [percentsWidth, setPercentsWidth] = useState<number | null>(null);
|
||||
const handleAvailableLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setAvailable(layoutWidth(event));
|
||||
@@ -146,12 +148,16 @@ function PinnedUsageTrigger({
|
||||
const handleLabelsLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setLabelsWidth(layoutWidth(event));
|
||||
}, []);
|
||||
const handleCompactLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setCompactWidth(layoutWidth(event));
|
||||
}, []);
|
||||
const handlePercentsLayout = useCallback((event: LayoutChangeEvent) => {
|
||||
setPercentsWidth(layoutWidth(event));
|
||||
}, []);
|
||||
const layout = choosePinnedUsageLayout({
|
||||
available,
|
||||
labelsWidth,
|
||||
compactWidth,
|
||||
percentsWidth,
|
||||
windowCount: sources.reduce((count, source) => count + source.windows.length, 0),
|
||||
});
|
||||
@@ -177,6 +183,9 @@ function PinnedUsageTrigger({
|
||||
<View style={styles.measured} onLayout={handleLabelsLayout}>
|
||||
<PinnedUsageLine sources={sources} layout="labels" measuring />
|
||||
</View>
|
||||
<View style={styles.measured} onLayout={handleCompactLayout}>
|
||||
<PinnedUsageLine sources={sources} layout="compact" measuring />
|
||||
</View>
|
||||
<View style={styles.measured} onLayout={handlePercentsLayout}>
|
||||
<PinnedUsageLine sources={sources} layout="percents" measuring />
|
||||
</View>
|
||||
@@ -185,6 +194,12 @@ function PinnedUsageTrigger({
|
||||
);
|
||||
}
|
||||
|
||||
function windowSuffix(window: PinnedUsageWindow, layout: PinnedUsageLayout): string {
|
||||
if (layout === "percents") return "";
|
||||
if (layout === "compact") return window.compactLabel;
|
||||
return window.shortLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* The line's items as direct children of one row, so every meter shares the leftover width
|
||||
* equally.
|
||||
@@ -215,6 +230,7 @@ function PinnedUsageLine({
|
||||
</View>
|
||||
{source.windows.map((window, windowIndex) => {
|
||||
const leadStyle = windowIndex === 0 ? styles.iconGap : styles.windowGap;
|
||||
const suffix = windowSuffix(window, layout);
|
||||
return (
|
||||
<Fragment key={window.key}>
|
||||
{layout === "meters" ? (
|
||||
@@ -228,9 +244,7 @@ function PinnedUsageLine({
|
||||
testID={measuring ? undefined : "sidebar-usage-pinned-window"}
|
||||
>
|
||||
{window.percentText}
|
||||
{layout === "percents" || window.shortLabel === "" ? null : (
|
||||
<Text style={styles.windowLabel}>{` ${window.shortLabel}`}</Text>
|
||||
)}
|
||||
{suffix === "" ? null : <Text style={styles.windowLabel}>{` ${suffix}`}</Text>}
|
||||
</Text>
|
||||
</Fragment>
|
||||
);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 5.9 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 5.9 KiB |
@@ -89,6 +89,7 @@ import {
|
||||
PiIcon,
|
||||
} from "~/components/agent-icons";
|
||||
import { DiscordIcon, GitHubIcon, SlackIcon } from "~/components/brand-icons";
|
||||
import { PaseoHubMark } from "~/components/paseo-brand";
|
||||
import {
|
||||
MobileChat,
|
||||
MobileDiff,
|
||||
@@ -515,6 +516,7 @@ function TurnkeySection() {
|
||||
description={t("landing.runAnywhere.teamsDescription")}
|
||||
ctaHref={localize("/hub")}
|
||||
ctaLabel={t("landing.runAnywhere.teamsCta")}
|
||||
ctaIcon={PASEO_HUB_CTA_ICON}
|
||||
showIntegrationIcons
|
||||
/>
|
||||
</div>
|
||||
@@ -523,12 +525,15 @@ function TurnkeySection() {
|
||||
);
|
||||
}
|
||||
|
||||
const PASEO_HUB_CTA_ICON = <PaseoHubMark className="h-4 w-4 shrink-0" />;
|
||||
|
||||
function TurnkeyExtensionCard({
|
||||
icon: Icon,
|
||||
title,
|
||||
description,
|
||||
ctaHref,
|
||||
ctaLabel,
|
||||
ctaIcon,
|
||||
showIntegrationIcons = false,
|
||||
}: {
|
||||
icon: LucideIcon;
|
||||
@@ -536,6 +541,7 @@ function TurnkeyExtensionCard({
|
||||
description: string;
|
||||
ctaHref: string;
|
||||
ctaLabel: string;
|
||||
ctaIcon?: React.ReactNode;
|
||||
showIntegrationIcons?: boolean;
|
||||
}) {
|
||||
return (
|
||||
@@ -545,6 +551,7 @@ function TurnkeyExtensionCard({
|
||||
href={ctaHref}
|
||||
className="inline-flex items-center gap-1.5 rounded-full bg-foreground px-2.5 py-1.5 text-xs text-background transition-colors hover:bg-foreground/90"
|
||||
>
|
||||
{ctaIcon}
|
||||
{ctaLabel}
|
||||
<ArrowRight className="h-3.5 w-3.5" />
|
||||
</a>
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
// Exact SVG paths from packages/app/src/components/icons/
|
||||
|
||||
import { OpenCodeIcon as OpenCodeBrandIcon, PiIcon as PiBrandIcon } from "../agent-icons";
|
||||
import { PaseoMark as CanonicalPaseoMark } from "../paseo-brand";
|
||||
|
||||
/** The Paseo brand swirl — public/logo.svg, drawn as a small sidebar avatar mark. */
|
||||
/** The Paseo butterfly mark, drawn as a small sidebar avatar or tool-call mark. */
|
||||
export function PaseoMark({ size = 13, className }: { size?: number; className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 700 700"
|
||||
fill="currentColor"
|
||||
aria-hidden="true"
|
||||
className={className}
|
||||
>
|
||||
<path d="M291.495 91.399C333.897 104.892 379.155 135.075 416.229 173.191C453.389 211.394 484.429 259.725 495.708 311.251C497.555 319.693 498.865 328.216 499.586 336.776C509.755 326.554 519.867 317.815 529.89 311.547C540.647 304.821 553.808 299.297 568.641 299.785C584.29 300.299 597.395 307.326 607.747 317.632C632.173 341.947 629.612 372.898 619.872 397.936C610.185 422.833 591.557 447.826 572.732 469.124C553.591 490.78 532.713 510.308 516.779 524.318C508.775 531.355 501.936 537.073 497.07 541.052C494.635 543.043 492.689 544.603 491.334 545.679C490.657 546.217 490.126 546.635 489.756 546.926C489.571 547.071 489.425 547.184 489.321 547.265C489.269 547.305 489.227 547.338 489.196 547.362C489.181 547.374 489.168 547.385 489.157 547.393C489.153 547.397 489.147 547.401 489.144 547.403C489.134 547.4 488.837 547.06 473.001 528.499L489.135 547.411C478.157 555.911 462.033 554.334 453.122 543.89C444.213 533.448 445.887 518.094 456.861 509.592C456.863 509.591 456.865 509.588 456.869 509.586C456.88 509.577 456.902 509.561 456.933 509.536C456.997 509.487 457.101 509.404 457.245 509.292C457.533 509.066 457.979 508.715 458.569 508.247C459.749 507.31 461.506 505.901 463.742 504.073C468.216 500.414 474.589 495.088 482.073 488.508C497.114 475.284 516.315 457.282 533.578 437.75C551.157 417.862 565.26 398.01 571.859 381.048C578.403 364.227 575.681 356.302 570.724 351.367C568.928 349.579 567.744 348.902 567.267 348.676C566.888 348.496 566.811 348.52 566.804 348.52C566.605 348.513 563.971 348.537 557.953 352.3C545.161 360.299 528.815 377.492 506.807 403.867C494.927 418.106 481.871 434.435 467.547 451.957C463.709 457.28 459.503 462.538 454.91 467.717L454.702 467.549C420.808 508.347 380.37 553.856 332.335 593.848C301.853 619.226 262.656 622.597 228.642 614.743C194.834 606.936 162.658 587.448 142.217 561.686C108.054 518.631 100.57 469.801 108.223 427.836C115.56 387.606 137.391 351.005 166.502 331.557C161.248 315.813 156.813 299.49 153.519 283.013C142.593 228.368 143.239 167.031 174.28 119.619C186.922 100.31 205.846 89.1535 227.387 85.2773C248.1 81.5504 270.278 84.648 291.495 91.399ZM378.642 206.356C345.773 172.563 307.463 147.917 275.208 137.654C259.096 132.527 246.171 131.514 236.828 133.195C228.314 134.727 222.227 138.497 217.721 145.38C196.712 177.468 193.858 224.004 203.82 273.827C206.532 287.394 210.127 300.834 214.345 313.817C236.45 310.276 260.156 311.463 281.22 317.11C319.621 327.403 357.501 355.419 357.501 405.654C357.501 435.255 339.111 465.136 307.278 473.815C273.211 483.103 238.854 464.822 213.105 427.541C203.716 413.947 194.443 397.766 185.947 379.89C174.028 392.223 163.08 411.953 158.673 436.118C153.128 466.518 158.514 501.286 183.085 532.253C195.993 548.522 217.742 562.031 240.771 567.349C263.594 572.619 284.147 569.24 298.664 557.154C349.383 514.927 390.709 466.547 426.366 422.952C448.879 390.86 453.195 356.06 445.578 321.265C436.703 280.718 411.425 240.06 378.642 206.356ZM306.296 405.722C306.296 384.769 292.223 370.736 267.284 364.051C256.012 361.03 244.156 360.087 233.095 360.771C240.361 375.935 248.168 389.513 255.897 400.704C275.647 429.298 289.989 427.822 293.247 426.934C298.737 425.437 306.296 418.161 306.296 405.722Z" />
|
||||
</svg>
|
||||
);
|
||||
return <CanonicalPaseoMark width={size} height={size} className={className} />;
|
||||
}
|
||||
|
||||
/** GitHub mark for the toolbar and PR panel. */
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
// Small shared bits for the mobile mockups. The Paseo butterfly mark is the
|
||||
// app icon (packages/website/public/favicon.svg) with the black plate dropped,
|
||||
// so it can be tinted and placed on any tile. Tile fills are the app's identity
|
||||
// Small shared bits for the mobile mockups. Tile fills are the app's identity
|
||||
// palette — packages/app/src/styles/identity-colors.ts — surfaced as
|
||||
// `--color-mock-tile-*` tokens in styles.css.
|
||||
|
||||
const BUTTERFLY_D =
|
||||
"M291.495 91.399C333.897 104.892 379.155 135.075 416.229 173.191C453.389 211.394 484.429 259.725 495.708 311.251C497.555 319.693 498.865 328.216 499.586 336.776C509.755 326.554 519.867 317.815 529.89 311.547C540.647 304.821 553.808 299.297 568.641 299.785C584.29 300.299 597.395 307.326 607.747 317.632C632.173 341.947 629.612 372.898 619.872 397.936C610.185 422.833 591.557 447.826 572.732 469.124C553.591 490.78 532.713 510.308 516.779 524.318C508.775 531.355 501.936 537.073 497.07 541.052C494.635 543.043 492.689 544.603 491.334 545.679C490.657 546.217 490.126 546.635 489.756 546.926C489.571 547.071 489.425 547.184 489.321 547.265C489.269 547.305 489.227 547.338 489.196 547.362C489.181 547.374 489.168 547.385 489.157 547.393C489.153 547.397 489.147 547.401 489.144 547.403C489.134 547.4 488.837 547.06 473.001 528.499L489.135 547.411C478.157 555.911 462.033 554.334 453.122 543.89C444.213 533.448 445.887 518.094 456.861 509.592C456.863 509.591 456.865 509.588 456.869 509.586C456.88 509.577 456.902 509.561 456.933 509.536C456.997 509.487 457.101 509.404 457.245 509.292C457.533 509.066 457.979 508.715 458.569 508.247C459.749 507.31 461.506 505.901 463.742 504.073C468.216 500.414 474.589 495.088 482.073 488.508C497.114 475.284 516.315 457.282 533.578 437.75C551.157 417.862 565.26 398.01 571.859 381.048C578.403 364.227 575.681 356.302 570.724 351.367C568.928 349.579 567.744 348.902 567.267 348.676C566.888 348.496 566.811 348.52 566.804 348.52C566.605 348.513 563.971 348.537 557.953 352.3C545.161 360.299 528.815 377.492 506.807 403.867C494.927 418.106 481.871 434.435 467.547 451.957C463.709 457.28 459.503 462.538 454.91 467.717L454.702 467.549C420.808 508.347 380.37 553.856 332.335 593.848C301.853 619.226 262.656 622.597 228.642 614.743C194.834 606.936 162.658 587.448 142.217 561.686C108.054 518.631 100.57 469.801 108.223 427.836C115.56 387.606 137.391 351.005 166.502 331.557C161.248 315.813 156.813 299.49 153.519 283.013C142.593 228.368 143.239 167.031 174.28 119.619C186.922 100.31 205.846 89.1535 227.387 85.2773C248.1 81.5504 270.278 84.648 291.495 91.399ZM378.642 206.356C345.773 172.563 307.463 147.917 275.208 137.654C259.096 132.527 246.171 131.514 236.828 133.195C228.314 134.727 222.227 138.497 217.721 145.38C196.712 177.468 193.858 224.004 203.82 273.827C206.532 287.394 210.127 300.834 214.345 313.817C236.45 310.276 260.156 311.463 281.22 317.11C319.621 327.403 357.501 355.419 357.501 405.654C357.501 435.255 339.111 465.136 307.278 473.815C273.211 483.103 238.854 464.822 213.105 427.541C203.716 413.947 194.443 397.766 185.947 379.89C174.028 392.223 163.08 411.953 158.673 436.118C153.128 466.518 158.514 501.286 183.085 532.253C195.993 548.522 217.742 562.031 240.771 567.349C263.594 572.619 284.147 569.24 298.664 557.154C349.383 514.927 390.709 466.547 426.366 422.952C448.879 390.86 453.195 356.06 445.578 321.265C436.703 280.718 411.425 240.06 378.642 206.356ZM306.296 405.722C306.296 384.769 292.223 370.736 267.284 364.051C256.012 361.03 244.156 360.087 233.095 360.771C240.361 375.935 248.168 389.513 255.897 400.704C275.647 429.298 289.989 427.822 293.247 426.934C298.737 425.437 306.296 418.161 306.296 405.722Z";
|
||||
import { PaseoMark as CanonicalPaseoMark } from "../../paseo-brand";
|
||||
|
||||
export function PaseoMark({ size = 20, className }: { size?: number; className?: string }) {
|
||||
return (
|
||||
<svg
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 700 700"
|
||||
fill="currentColor"
|
||||
className={className}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path transform="translate(350,350) scale(1.05) translate(-350,-350)" d={BUTTERFLY_D} />
|
||||
</svg>
|
||||
);
|
||||
return <CanonicalPaseoMark width={size} height={size} className={className} />;
|
||||
}
|
||||
|
||||
/** A hashed identity tile — one letter on a muted identity fill. */
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { HubLockup, PaseoHubLockup, PaseoHubMark, PaseoLockup, PaseoMark } from "./paseo-brand";
|
||||
|
||||
const REPO_ROOT = path.resolve(import.meta.dirname, "../../../..");
|
||||
const BRAND_ROOT = path.join(REPO_ROOT, "assets/brand");
|
||||
const WEBSITE_PUBLIC = path.join(REPO_ROOT, "packages/website/public");
|
||||
|
||||
function extractPathData(svg: string): string[] {
|
||||
return [...svg.matchAll(/\bd="([^"]+)"/g)].map((m) => m[1]);
|
||||
}
|
||||
|
||||
describe("paseo brand assets", () => {
|
||||
it("renders canonical Paseo and Paseo Hub marks with currentColor", () => {
|
||||
const paseoHtml = renderToStaticMarkup(<PaseoMark className="h-6 w-6" />);
|
||||
const hubHtml = renderToStaticMarkup(<PaseoHubMark className="h-6 w-6" />);
|
||||
const canonicalPaseo = readFileSync(path.join(BRAND_ROOT, "marks/paseo-white.svg"), "utf8");
|
||||
const canonicalHub = readFileSync(path.join(BRAND_ROOT, "marks/paseo-hub-white.svg"), "utf8");
|
||||
|
||||
expect(paseoHtml).toContain('viewBox="0 0 700 700"');
|
||||
expect(paseoHtml).toContain('stroke="currentColor"');
|
||||
expect(paseoHtml).toContain('stroke-width="50"');
|
||||
expect(extractPathData(paseoHtml)).toEqual(extractPathData(canonicalPaseo));
|
||||
|
||||
expect(hubHtml).toContain('viewBox="0 0 700 700"');
|
||||
expect(hubHtml).toContain('stroke="currentColor"');
|
||||
expect(hubHtml).toContain('stroke-width="50"');
|
||||
expect(extractPathData(hubHtml)).toEqual(extractPathData(canonicalHub));
|
||||
});
|
||||
|
||||
it("renders canonical Paseo, Paseo Hub, and Hub lockups at shared 144-unit height", () => {
|
||||
const cases = [
|
||||
{ Component: PaseoLockup, file: "lockups/paseo-white.svg", width: 580 },
|
||||
{ Component: PaseoHubLockup, file: "lockups/paseo-hub-white.svg", width: 842 },
|
||||
{ Component: HubLockup, file: "lockups/hub-white.svg", width: 461 },
|
||||
];
|
||||
|
||||
for (const { Component, file, width } of cases) {
|
||||
const html = renderToStaticMarkup(<Component className="h-6 w-auto" />);
|
||||
const canonical = readFileSync(path.join(BRAND_ROOT, file), "utf8");
|
||||
|
||||
expect(html).toContain(`viewBox="0 0 ${width} 144"`);
|
||||
expect(html).toContain(`width="${width}"`);
|
||||
expect(html).toContain('height="144"');
|
||||
expect(html).toContain('stroke="currentColor"');
|
||||
expect(html).toContain('fill="currentColor"');
|
||||
expect(extractPathData(html)).toEqual(extractPathData(canonical));
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps public/logo.svg and public/favicon.svg aligned with assets/brand", () => {
|
||||
const canonicalPaseo = readFileSync(path.join(BRAND_ROOT, "marks/paseo-white.svg"), "utf8");
|
||||
const publicLogo = readFileSync(path.join(WEBSITE_PUBLIC, "logo.svg"), "utf8");
|
||||
const publicFavicon = readFileSync(path.join(WEBSITE_PUBLIC, "favicon.svg"), "utf8");
|
||||
|
||||
expect(publicLogo).toBe(canonicalPaseo);
|
||||
expect(publicFavicon).toContain('<rect width="700" height="700" rx="156" fill="#000000"');
|
||||
expect(extractPathData(publicFavicon)).toEqual(extractPathData(canonicalPaseo));
|
||||
});
|
||||
|
||||
it("ships a multi-size favicon.ico with 48, 32, and 16px entries", () => {
|
||||
const ico = readFileSync(path.join(WEBSITE_PUBLIC, "favicon.ico"));
|
||||
expect(ico.readUInt16LE(0)).toBe(0);
|
||||
expect(ico.readUInt16LE(2)).toBe(1);
|
||||
const count = ico.readUInt16LE(4);
|
||||
const sizes: number[] = [];
|
||||
for (let i = 0; i < count; i += 1) {
|
||||
sizes.push(ico[6 + i * 16] || 256);
|
||||
}
|
||||
expect(sizes).toEqual([48, 32, 16]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,154 @@
|
||||
// Canonical Paseo and Paseo Hub brand marks and lockups, sourced directly from
|
||||
// `assets/brand/` (see `assets/brand/README.md`).
|
||||
|
||||
import type * as React from "react";
|
||||
import hubLockupSvg from "../../../../assets/brand/lockups/hub-white.svg?raw";
|
||||
import paseoHubLockupSvg from "../../../../assets/brand/lockups/paseo-hub-white.svg?raw";
|
||||
import paseoLockupSvg from "../../../../assets/brand/lockups/paseo-white.svg?raw";
|
||||
import paseoHubMarkSvg from "../../../../assets/brand/marks/paseo-hub-white.svg?raw";
|
||||
import paseoMarkSvg from "../../../../assets/brand/marks/paseo-white.svg?raw";
|
||||
|
||||
interface ParsedMark {
|
||||
width: number;
|
||||
height: number;
|
||||
viewBox: string;
|
||||
path: string;
|
||||
strokeWidth: number;
|
||||
}
|
||||
|
||||
interface ParsedLockup extends ParsedMark {
|
||||
wordmarkPath: string;
|
||||
}
|
||||
|
||||
function readAttr(tag: string, name: string, source: string): string {
|
||||
const match = tag.match(new RegExp(`${name}="([^"]+)"`));
|
||||
if (!match) {
|
||||
throw new Error(`Missing ${name} attribute in canonical brand SVG (${source})`);
|
||||
}
|
||||
return match[1];
|
||||
}
|
||||
|
||||
function parseSvgHeader(svg: string, source: string) {
|
||||
const svgTag = svg.match(/<svg\b[^>]*>/)?.[0];
|
||||
if (!svgTag) {
|
||||
throw new Error(`Missing <svg> root in canonical brand SVG (${source})`);
|
||||
}
|
||||
const paths = [...svg.matchAll(/<path\b[^>]*\/?>/g)].map((m) => m[0]);
|
||||
return {
|
||||
width: Number(readAttr(svgTag, "width", source)),
|
||||
height: Number(readAttr(svgTag, "height", source)),
|
||||
viewBox: readAttr(svgTag, "viewBox", source),
|
||||
paths,
|
||||
};
|
||||
}
|
||||
|
||||
function parseMark(svg: string, source: string): ParsedMark {
|
||||
const { width, height, viewBox, paths } = parseSvgHeader(svg, source);
|
||||
if (paths.length !== 1) {
|
||||
throw new Error(`Expected 1 path in brand mark SVG (${source}), found ${paths.length}`);
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
viewBox,
|
||||
path: readAttr(paths[0], "d", source),
|
||||
strokeWidth: Number(readAttr(paths[0], "stroke-width", source)),
|
||||
};
|
||||
}
|
||||
|
||||
function parseLockup(svg: string, source: string): ParsedLockup {
|
||||
const { width, height, viewBox, paths } = parseSvgHeader(svg, source);
|
||||
if (paths.length !== 2) {
|
||||
throw new Error(`Expected 2 paths in brand lockup SVG (${source}), found ${paths.length}`);
|
||||
}
|
||||
return {
|
||||
width,
|
||||
height,
|
||||
viewBox,
|
||||
path: readAttr(paths[0], "d", source),
|
||||
strokeWidth: Number(readAttr(paths[0], "stroke-width", source)),
|
||||
wordmarkPath: readAttr(paths[1], "d", source),
|
||||
};
|
||||
}
|
||||
|
||||
const PASEO_MARK = parseMark(paseoMarkSvg, "marks/paseo-white.svg");
|
||||
const PASEO_HUB_MARK = parseMark(paseoHubMarkSvg, "marks/paseo-hub-white.svg");
|
||||
const PASEO_LOCKUP = parseLockup(paseoLockupSvg, "lockups/paseo-white.svg");
|
||||
const PASEO_HUB_LOCKUP = parseLockup(paseoHubLockupSvg, "lockups/paseo-hub-white.svg");
|
||||
const HUB_LOCKUP = parseLockup(hubLockupSvg, "lockups/hub-white.svg");
|
||||
|
||||
function BrandMark({ asset, props }: { asset: ParsedMark; props: React.SVGProps<SVGSVGElement> }) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={asset.width}
|
||||
height={asset.height}
|
||||
viewBox={asset.viewBox}
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d={asset.path}
|
||||
stroke="currentColor"
|
||||
strokeWidth={asset.strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function BrandLockup({
|
||||
asset,
|
||||
props,
|
||||
}: {
|
||||
asset: ParsedLockup;
|
||||
props: React.SVGProps<SVGSVGElement>;
|
||||
}) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={asset.width}
|
||||
height={asset.height}
|
||||
viewBox={asset.viewBox}
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d={asset.path}
|
||||
stroke="currentColor"
|
||||
strokeWidth={asset.strokeWidth}
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
<path d={asset.wordmarkPath} fill="currentColor" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
/** Canonical Paseo butterfly mark (700x700 viewBox, stroked with currentColor). */
|
||||
export function PaseoMark(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandMark asset={PASEO_MARK} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Paseo Hub five-petal flower mark (700x700 viewBox, stroked with currentColor). */
|
||||
export function PaseoHubMark(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandMark asset={PASEO_HUB_MARK} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Paseo lockup (butterfly mark at 94% optical scale + Plus Jakarta Sans SemiBold). */
|
||||
export function PaseoLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandLockup asset={PASEO_LOCKUP} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Paseo Hub lockup (flower mark + Plus Jakarta Sans SemiBold). */
|
||||
export function PaseoHubLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandLockup asset={PASEO_HUB_LOCKUP} props={props} />;
|
||||
}
|
||||
|
||||
/** Canonical Hub lockup (flower mark + "Hub"), used where Paseo is already on screen. */
|
||||
export function HubLockup(props: React.SVGProps<SVGSVGElement>) {
|
||||
return <BrandLockup asset={HUB_LOCKUP} props={props} />;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { PLUGINS_LINKED } from "~/plugins/launch";
|
||||
import "~/styles.css";
|
||||
import { DiscordIcon, GitHubIcon } from "~/components/brand-icons";
|
||||
import { LanguageSelector } from "~/components/language-selector";
|
||||
import { PaseoLockup } from "~/components/paseo-brand";
|
||||
import { useLocalizePath } from "~/i18n";
|
||||
import { useStars } from "~/routes/__root";
|
||||
|
||||
@@ -14,9 +15,12 @@ export function SiteHeader() {
|
||||
const { stars } = useStars();
|
||||
return (
|
||||
<header className="flex flex-col items-center gap-4 md:flex-row md:justify-between">
|
||||
<a href={localize("/")} className="flex items-center gap-3">
|
||||
<img src="/logo.svg" alt="Paseo" className="w-6 h-6" />
|
||||
<span className="text-lg font-medium">Paseo</span>
|
||||
<a
|
||||
href={localize("/")}
|
||||
aria-label="Paseo"
|
||||
className="inline-flex items-center text-foreground"
|
||||
>
|
||||
<PaseoLockup className="h-[22px] w-auto" />
|
||||
</a>
|
||||
<div className="flex flex-wrap items-center justify-center gap-4">
|
||||
{PLUGINS_LINKED && (
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { buildDocsNavTree, getDoc, getDocs } from "~/docs";
|
||||
import { splitLocalePath, useLocale, useLocalizePath } from "~/i18n";
|
||||
import { LanguageSelector } from "~/components/language-selector";
|
||||
import { PaseoLockup } from "~/components/paseo-brand";
|
||||
import "~/styles.css";
|
||||
|
||||
export const Route = createFileRoute("/{-$locale}/docs")({
|
||||
@@ -35,9 +36,12 @@ function DocsLayout() {
|
||||
{/* Mobile header */}
|
||||
<header className="lg:hidden sticky top-0 z-50 bg-background border-b border-border">
|
||||
<div className="flex items-center justify-between p-4">
|
||||
<Link to={localize("/")} className="flex items-center gap-3">
|
||||
<img src="/logo.svg" alt="Paseo" className="w-6 h-6" />
|
||||
<span className="text-lg font-medium">Paseo</span>
|
||||
<Link
|
||||
to={localize("/")}
|
||||
aria-label="Paseo"
|
||||
className="inline-flex items-center text-foreground"
|
||||
>
|
||||
<PaseoLockup className="h-[22px] w-auto" />
|
||||
</Link>
|
||||
<div className="flex items-center gap-3">
|
||||
<LanguageSelector />
|
||||
@@ -63,9 +67,12 @@ function DocsLayout() {
|
||||
{/* Desktop sidebar */}
|
||||
<aside className="hidden lg:block sticky top-0 h-screen w-60 shrink-0 border-r border-border p-6 overflow-y-auto">
|
||||
<div className="flex items-center justify-between gap-3 mb-8">
|
||||
<Link to={localize("/")} className="flex items-center gap-3">
|
||||
<img src="/logo.svg" alt="Paseo" className="w-6 h-6" />
|
||||
<span className="text-lg font-medium">Paseo</span>
|
||||
<Link
|
||||
to={localize("/")}
|
||||
aria-label="Paseo"
|
||||
className="inline-flex items-center text-foreground"
|
||||
>
|
||||
<PaseoLockup className="h-[22px] w-auto" />
|
||||
</Link>
|
||||
<LanguageSelector />
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
PiIcon,
|
||||
} from "~/components/agent-icons";
|
||||
import { DiscordIcon, GitHubIcon, SlackIcon } from "~/components/brand-icons";
|
||||
import { HubLockup, PaseoHubLockup, PaseoHubMark } from "~/components/paseo-brand";
|
||||
import { AGENT_PAGES } from "~/data/agent-pages";
|
||||
import { FAQItem } from "~/components/faq-item";
|
||||
import { SiteShell } from "~/components/site-shell";
|
||||
@@ -63,7 +64,10 @@ function Hub() {
|
||||
const { plans } = Route.useLoaderData();
|
||||
return (
|
||||
<SiteShell width="default">
|
||||
<h1 className="text-3xl font-medium tracking-tight mb-4">{t("hub.title")}</h1>
|
||||
<h1 className="mb-5">
|
||||
<PaseoHubLockup className="h-9 md:h-10 w-auto text-foreground" />
|
||||
<span className="sr-only">{t("hub.title")}</span>
|
||||
</h1>
|
||||
<p className="text-lg text-white/70 leading-relaxed max-w-2xl">{t("hub.intro")}</p>
|
||||
<p className="text-white/40 text-sm mt-3">{t("hub.runIt")}</p>
|
||||
|
||||
@@ -379,7 +383,7 @@ function DemoMessage({
|
||||
<div className="flex gap-3">
|
||||
<div className="flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full border border-white/10 bg-white/[0.06]">
|
||||
{bot ? (
|
||||
<img src="/logo.svg" alt="" className="h-4 w-4" />
|
||||
<PaseoHubMark className="h-5 w-5 text-white" />
|
||||
) : (
|
||||
<span className="text-xs font-medium text-white/60">M</span>
|
||||
)}
|
||||
@@ -478,8 +482,11 @@ function Shape() {
|
||||
<Connector label={t("hub.shape.webhooks")} />
|
||||
|
||||
<div className="w-full max-w-xs rounded-xl border border-white/20 bg-white/[0.06] px-6 py-5 text-center">
|
||||
<p className="font-medium">{t("hub.shape.hub")}</p>
|
||||
<p className="text-xs text-muted-foreground mt-1">{t("hub.shape.hubHosting")}</p>
|
||||
<p className="flex justify-center">
|
||||
<HubLockup className="h-[22px] w-auto text-foreground" />
|
||||
<span className="sr-only">{t("hub.shape.hub")}</span>
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground mt-1.5">{t("hub.shape.hubHosting")}</p>
|
||||
</div>
|
||||
|
||||
<Connector label={t("hub.shape.sameRpcs")} />
|
||||
|
||||
+5
@@ -2,3 +2,8 @@ declare module "*.md?raw" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module "*.svg?raw" {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
@@ -65,9 +65,46 @@ it("discovers the resolved account and maps the CLI's quota buckets", async () =
|
||||
expect(await source.fetch(accounts[0]!.input)).toMatchObject({
|
||||
status: "available",
|
||||
windows: [
|
||||
{ id: "gemini-5h", usedPct: 75, remainingPct: 25, resetsAt: "2026-11-19T14:25:08Z" },
|
||||
{ id: "gemini-weekly", usedPct: expect.closeTo(30), summary: true },
|
||||
{ id: "disabled", usedPct: null, remainingPct: null },
|
||||
{
|
||||
id: "gemini-5h",
|
||||
shortLabel: "5h",
|
||||
usedPct: 75,
|
||||
remainingPct: 25,
|
||||
resetsAt: "2026-11-19T14:25:08Z",
|
||||
},
|
||||
{ id: "gemini-weekly", shortLabel: "wk", usedPct: expect.closeTo(30), summary: true },
|
||||
{ id: "disabled", shortLabel: "wk", usedPct: null, remainingPct: null },
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("uses compact group and period shorthands when multiple groups are reported", async () => {
|
||||
const directory = await mkdtemp(path.join(tmpdir(), "paseo-antigravity-usage-"));
|
||||
directories.push(directory);
|
||||
const cli = path.join(directory, "cli.cjs");
|
||||
await writeFile(
|
||||
cli,
|
||||
`
|
||||
console.log(JSON.stringify({ status: 'SUCCESS', command: { name: 'usage', data: { groups: [
|
||||
{ name: 'Gemini Models', buckets: [
|
||||
{ id: 'gemini-weekly', name: 'Weekly Limit Remaining', window: 'weekly', remaining_fraction: 0.9 },
|
||||
{ id: 'gemini-5h', name: 'Five Hour Limit Remaining', window: '5h', remaining_fraction: 0.8 }
|
||||
] },
|
||||
{ name: 'Claude and GPT models', buckets: [
|
||||
{ id: '3p-weekly', name: 'Weekly Limit Remaining', window: 'weekly', remaining_fraction: 1 }
|
||||
] }
|
||||
] } } }));
|
||||
`,
|
||||
);
|
||||
const launch = { command: process.execPath, args: [cli, "acp"], env: { HOME: directory } };
|
||||
const source = new Usage().registration();
|
||||
const [account] = await source.discover({ kind: "global", launch });
|
||||
expect(await source.fetch(account!.input)).toMatchObject({
|
||||
status: "available",
|
||||
windows: [
|
||||
{ id: "gemini-weekly", shortLabel: "Gemini wk" },
|
||||
{ id: "gemini-5h", shortLabel: "Gemini 5h" },
|
||||
{ id: "3p-weekly", shortLabel: "Claude and GPT wk" },
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -48,6 +48,28 @@ function accountKey(env: ProviderLaunch["env"]): string {
|
||||
);
|
||||
}
|
||||
|
||||
function shortWindow(window: string): string {
|
||||
const trimmed = window.trim();
|
||||
const normalized = trimmed.toLowerCase();
|
||||
if (normalized === "weekly") return "wk";
|
||||
if (normalized === "monthly") return "mo";
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
function shortGroupName(name: string): string {
|
||||
return name
|
||||
.trim()
|
||||
.replace(/\s+models$/i, "")
|
||||
.trim();
|
||||
}
|
||||
|
||||
function formatShortLabel(groupName: string, window: string, includeGroup: boolean): string {
|
||||
const period = shortWindow(window);
|
||||
if (!includeGroup) return period;
|
||||
const scope = shortGroupName(groupName);
|
||||
return scope ? `${scope} ${period}` : period;
|
||||
}
|
||||
|
||||
export class Usage {
|
||||
private readonly launches = new Map<string, ProviderLaunch>();
|
||||
|
||||
@@ -94,7 +116,9 @@ export class Usage {
|
||||
throw new Error(data.error || data.response || `agy usage returned ${data.status}`);
|
||||
}
|
||||
if (!data.command) throw new Error("agy did not return usage data");
|
||||
const windows = data.command.data.groups.flatMap((group) =>
|
||||
const groups = data.command.data.groups;
|
||||
const includeGroup = groups.length > 1;
|
||||
const windows = groups.flatMap((group) =>
|
||||
group.buckets.flatMap((bucket) => {
|
||||
if (!bucket.disabled && bucket.remaining_fraction == null) return [];
|
||||
const used = bucket.disabled ? null : (1 - bucket.remaining_fraction!) * 100;
|
||||
@@ -102,7 +126,7 @@ export class Usage {
|
||||
windowFromUsedPct({
|
||||
id: bucket.id,
|
||||
label: `${group.name} · ${bucket.name}${bucket.disabled ? " · Disabled" : ""}`,
|
||||
shortLabel: `${group.name} ${bucket.window}`,
|
||||
shortLabel: formatShortLabel(group.name, bucket.window, includeGroup),
|
||||
summary: !bucket.disabled && bucket.window === "weekly",
|
||||
utilizationPct: used,
|
||||
resetsAt: bucket.disabled ? null : bucket.reset_time,
|
||||
|
||||
Reference in New Issue
Block a user