mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-14 13:22:37 +00:00
* fix(usage): keep details hoverable and restore compact sidebar sheets Share hover-card mechanics with workspace details so context usage can stay open while users press Refresh. Honor Retry-After for rate-limited usage requests, and let both sidebar entry points share the compact sheet. * fix(usage): restore settings cog with a fitted popover and compact sheet Keep shared Usage preferences in the title controls on every surface. Settings rows use the menu surface directly, avoiding the trailing margin and duplicate card border from the page layout. * fix(app): show account usage before the first agent turn Keep the context meter available for existing agents without context readings so account usage can be opened before a turn. Show an empty ring and an explicit no-data state until readings arrive. * fix(usage): preserve keyboard access and hover card positioning Context details must remain reachable by keyboard after replacing the tooltip. Keep focus within the card, restore side flipping, and dismiss detached cards when the viewport moves. Prune expired cooldowns even after credential rotation. * chore: remove QA screenshots from the source tree * fix(app): let hover cards claim Escape before agent shortcuts Register hover surfaces with the shared overlay keyboard owner without moving or trapping focus on pointer hover. Component-local Escape handling ran after the global interrupt shortcut and cancelled the underlying turn. * fix(app): reopen focused hover cards with button keys Keep focused triggers registered with overlay arbitration after dismissal so activation keys are handled before composer shortcuts. * fix(app): release overlay ownership when hover cards close Closed triggers handle activation locally, so a dismissed card does not block pane Find. Open cards retain shared Escape arbitration to protect running turns. * test(app): pin Linux keyboard identity for composer Find * test(app): synchronize context usage hover journeys Return focus to the composer before asserting pointer dismissal, wait for the card to reach the viewport, and park the pointer before reloading so it cannot consume the next scripted usage response early.
73 lines
2.1 KiB
TypeScript
73 lines
2.1 KiB
TypeScript
import { useIsFocused } from "@react-navigation/native";
|
|
import { router } from "expo-router";
|
|
import { useMemo, type ReactNode } from "react";
|
|
import { View } from "react-native";
|
|
import { PageLayout } from "@/components/page-layout";
|
|
import { useHostUsageWithControls } from "./controls";
|
|
import { usageCopy } from "./copy";
|
|
import { useUsagePreferences } from "./display";
|
|
import { useUsageHostSelection } from "./hosts";
|
|
import type { UsageHost } from "./model";
|
|
import { UsageBody, UsageMessage } from "./usage-section";
|
|
|
|
// The screen is reachable by URL, so there may be no history to go back to.
|
|
function leaveUsage(): void {
|
|
if (router.canGoBack()) {
|
|
router.back();
|
|
return;
|
|
}
|
|
router.replace("/");
|
|
}
|
|
|
|
export function UsageScreen() {
|
|
const isFocused = useIsFocused();
|
|
if (!isFocused) return <UsagePage>{null}</UsagePage>;
|
|
return <FocusedUsageScreen />;
|
|
}
|
|
|
|
function UsagePage({ actions, children }: { actions?: ReactNode; children: ReactNode }) {
|
|
return (
|
|
<PageLayout title={usageCopy.title} onBack={leaveUsage} actions={actions} testID="usage-screen">
|
|
{children}
|
|
</PageLayout>
|
|
);
|
|
}
|
|
|
|
function FocusedUsageScreen() {
|
|
const { serverId, connectedHosts, select } = useUsageHostSelection();
|
|
if (!serverId) {
|
|
return (
|
|
<UsagePage>
|
|
<UsageMessage text={usageCopy.noHosts} />
|
|
</UsagePage>
|
|
);
|
|
}
|
|
return (
|
|
<HostUsage key={serverId} serverId={serverId} hosts={connectedHosts} onSelectHost={select} />
|
|
);
|
|
}
|
|
|
|
function HostUsage({
|
|
serverId,
|
|
hosts,
|
|
onSelectHost,
|
|
}: {
|
|
serverId: string;
|
|
hosts: UsageHost[];
|
|
onSelectHost: (serverId: string) => void;
|
|
}) {
|
|
const { display } = useUsagePreferences();
|
|
const hostSelection = useMemo(
|
|
() => ({ hosts, serverId, onSelect: onSelectHost }),
|
|
[hosts, onSelectHost, serverId],
|
|
);
|
|
const { view, refresh, controls } = useHostUsageWithControls(hostSelection);
|
|
return (
|
|
<UsagePage actions={controls}>
|
|
<View testID={`usage-host-${serverId}`}>
|
|
<UsageBody serverId={serverId} view={view} display={display} onRefresh={refresh} />
|
|
</View>
|
|
</UsagePage>
|
|
);
|
|
}
|