mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-24 10:12:44 +00:00
Streamline sidebar usage and stacked sheet interactions (#5805)
* feat(app): streamline sidebar usage and stacked sheets * fix(app): restore compact sidebar navigation clicks The close button container emitted box-none through Unistyles as invalid CSS and intercepted New workspace clicks. Let React Native apply click-through behavior at the view boundary. Keep the import journey on its existing New workspace screen and assert only the visible transcript. * fix(app): cap menu sheets at eighty percent height Keep long sidebar usage reports recognizably sheet-sized while allowing the content to scroll. Short menu sheets retain dynamic sizing.
This commit is contained in:
@@ -103,7 +103,31 @@ test("coerces credit balance and marks a 96 percent window dangerous", async ()
|
||||
expect.objectContaining({ id: "weekly", tone: "danger" }),
|
||||
]),
|
||||
);
|
||||
expect(report.balances).toEqual([expect.objectContaining({ remaining: 0, tone: "danger" })]);
|
||||
expect(report.balances).toEqual([
|
||||
expect.objectContaining({ remaining: 0, unit: "credits", tone: "danger" }),
|
||||
]);
|
||||
});
|
||||
|
||||
test("summarizes the session and weekly windows by default, not code review", async () => {
|
||||
const report = await fetchUsage(
|
||||
{},
|
||||
async () =>
|
||||
new Response(
|
||||
JSON.stringify({
|
||||
rate_limit: {
|
||||
primary_window: { used_percent: 12 },
|
||||
secondary_window: { used_percent: 40 },
|
||||
},
|
||||
code_review_rate_limit: { primary_window: { used_percent: 5 } },
|
||||
}),
|
||||
{ status: 200 },
|
||||
),
|
||||
);
|
||||
expect(report.windows.map((window) => [window.id, window.summary ?? false])).toEqual([
|
||||
["session", true],
|
||||
["weekly", true],
|
||||
["code_review", false],
|
||||
]);
|
||||
});
|
||||
|
||||
test("HTML usage body is unavailable", async () => {
|
||||
|
||||
@@ -57,15 +57,13 @@ export async function readAuth(
|
||||
}
|
||||
|
||||
function usageWindow(
|
||||
id: string,
|
||||
label: string,
|
||||
spec: { id: string; label: string; shortLabel: string; summary?: boolean },
|
||||
value: z.infer<typeof windowSchema> | null | undefined,
|
||||
): UsageWindow | null {
|
||||
if (!value) return null;
|
||||
const usedPct = value.used_percent ?? 0;
|
||||
return windowFromUsedPct({
|
||||
id,
|
||||
label,
|
||||
...spec,
|
||||
utilizationPct: usedPct,
|
||||
resetsAt: value.reset_at != null ? new Date(value.reset_at * 1000).toISOString() : null,
|
||||
tone: toneFromUsedPct(usedPct),
|
||||
@@ -95,9 +93,18 @@ export async function fetchUsage(
|
||||
if (text.trim().startsWith("<")) return { status: "unavailable", windows: [] };
|
||||
const usage = responseSchema.parse(JSON.parse(text));
|
||||
const windows = [
|
||||
usageWindow("session", "Session", usage.rate_limit?.primary_window),
|
||||
usageWindow("weekly", "Weekly", usage.rate_limit?.secondary_window),
|
||||
usageWindow("code_review", "Code review", usage.code_review_rate_limit?.primary_window),
|
||||
usageWindow(
|
||||
{ id: "session", label: "Session", shortLabel: "5h", summary: true },
|
||||
usage.rate_limit?.primary_window,
|
||||
),
|
||||
usageWindow(
|
||||
{ id: "weekly", label: "Weekly", shortLabel: "wk", summary: true },
|
||||
usage.rate_limit?.secondary_window,
|
||||
),
|
||||
usageWindow(
|
||||
{ id: "code_review", label: "Code review", shortLabel: "review" },
|
||||
usage.code_review_rate_limit?.primary_window,
|
||||
),
|
||||
].filter((window): window is UsageWindow => window !== null);
|
||||
const balance = usage.credits?.balance;
|
||||
return {
|
||||
@@ -112,7 +119,7 @@ export async function fetchUsage(
|
||||
id: "credits",
|
||||
label: "Credits",
|
||||
remaining: balance,
|
||||
unit: "usd",
|
||||
unit: "credits",
|
||||
tone: balanceToneFromRemaining(balance),
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user