Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/features/app/components/MainApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { useMainAppSidebarMenuOrchestration } from "@app/hooks/useMainAppSidebar
import { useMainAppWorktreeState } from "@app/hooks/useMainAppWorktreeState";
import { useMainAppWorkspaceActions } from "@app/hooks/useMainAppWorkspaceActions";
import { useMainAppWorkspaceLifecycle } from "@app/hooks/useMainAppWorkspaceLifecycle";
import { useHomeAccount } from "@app/hooks/useHomeAccount";
import type {
ComposerEditorSettings,
ServiceTier,
Expand Down Expand Up @@ -1170,6 +1171,20 @@ export default function MainApp() {
const activeRateLimits = activeWorkspaceId
? rateLimitsByWorkspace[activeWorkspaceId] ?? null
: null;
const {
homeAccount,
homeRateLimits,
} = useHomeAccount({
showHome,
usageWorkspaceId,
workspaces,
threadsByWorkspace,
threadListLoadingByWorkspace,
rateLimitsByWorkspace,
accountByWorkspace,
refreshAccountInfo,
refreshAccountRateLimits,
});
const activeTokenUsage = activeThreadId
? tokenUsageByThread[activeThreadId] ?? null
: null;
Expand Down Expand Up @@ -1707,6 +1722,8 @@ export default function MainApp() {
approvals,
activeRateLimits,
activeAccount,
homeRateLimits,
homeAccount,
accountSwitching,
onSwitchAccount: handleSwitchAccount,
onCancelSwitchAccount: handleCancelSwitchAccount,
Expand Down
24 changes: 24 additions & 0 deletions src/features/app/components/Sidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,30 @@ describe("Sidebar", () => {
expect(onSetThreadListOrganizeMode).toHaveBeenCalledWith("threads_only");
});

it("renders available credits in the footer when present", () => {
render(
<Sidebar
{...baseProps}
accountRateLimits={{
primary: {
usedPercent: 62,
windowDurationMins: 300,
resetsAt: Math.round(Date.now() / 1000) + 3600,
},
secondary: null,
credits: {
hasCredits: true,
unlimited: false,
balance: "120",
},
planType: "pro",
}}
/>,
);

expect(screen.getByText("Available credits: 120")).toBeTruthy();
});

it("renders threads-only mode as a global chronological list", () => {
const older = Date.now() - 10_000;
const newer = Date.now();
Expand Down
Loading
Loading