Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(settings): consolidate account panel and add usage bar

Steven Enamakelc023b8b6f2b9
diff --git a/app/src/components/settings/LogoutAndClearActions.tsx b/app/src/components/settings/LogoutAndClearActions.tsx
index 387d736bca..e401a874a9 100644
--- a/app/src/components/settings/LogoutAndClearActions.tsx
+++ b/app/src/components/settings/LogoutAndClearActions.tsx
@@ -83,6 +83,9 @@ const LogoutAndClearActions = () => {
return (
<>
+ {/* Log out and Clear app data share one card, but the wipe keeps its
+ danger styling (coral button, irreversible note) and sits behind a
+ confirm — so the two still don't read as peers. */}
<Card title={t('settings.account.session')}>
<Field
label={t('settings.logOut')}
@@ -103,27 +106,23 @@ const LogoutAndClearActions = () => {
/>
{/* The confirm dialog owns error display while it is open. */}
{!confirmOpen && error && <div className="px-4 py-3">{errorAlert('logout-error')}</div>}
- </Card>
-
- <Card
- title={t('settings.account.dangerZone')}
- className="border-coral-500/30"
- data-testid="account-destructive-zone">
- <Field
- label={t('settings.clearAppData')}
- description={`${t('settings.clearAppDataDesc')} ${t('settings.clearAppDataIrreversible')}`}
- control={
- <Button
- variant="secondary"
- tone="danger"
- size="sm"
- leadingIcon={<Trash2 className="h-3.5 w-3.5" aria-hidden />}
- onClick={() => setConfirmOpen(true)}
- data-testid="settings-nav-logout-and-clear">
- {t('settings.clearAppDataAction')}
- </Button>
- }
- />
+ <div data-testid="account-destructive-zone">
+ <Field
+ label={t('settings.clearAppData')}
+ description={`${t('settings.clearAppDataDesc')} ${t('settings.clearAppDataIrreversible')}`}
+ control={
+ <Button
+ variant="secondary"
+ tone="danger"
+ size="sm"
+ leadingIcon={<Trash2 className="h-3.5 w-3.5" aria-hidden />}
+ onClick={() => setConfirmOpen(true)}
+ data-testid="settings-nav-logout-and-clear">
+ {t('settings.clearAppDataAction')}
+ </Button>
+ }
+ />
+ </div>
</Card>
<AlertDialogRoot open={confirmOpen} onOpenChange={closeConfirm}>
diff --git a/app/src/components/settings/panels/AccountPanel.tsx b/app/src/components/settings/panels/AccountPanel.tsx
index dc323d4e71..aebefdea80 100644
--- a/app/src/components/settings/panels/AccountPanel.tsx
+++ b/app/src/components/settings/panels/AccountPanel.tsx
@@ -7,7 +7,7 @@ import type { PlanTier } from '../../../types/api';
import { BILLING_DASHBOARD_URL } from '../../../utils/links';
import { openUrl } from '../../../utils/openUrl';
import LanguageSelect from '../../LanguageSelect';
-import { Badge, Button, Card, Field } from '../../ui';
+import { Badge, Button, Card, Field, Progress } from '../../ui';
import SettingsPanel from '../layout/SettingsPanel';
import LogoutAndClearActions from '../LogoutAndClearActions';
import { PLANS } from './billingHelpers';
@@ -28,22 +28,27 @@ const AccountPanel = () => {
const user = snapshot.currentUser;
// The usage hook fetches the live plan; the snapshot's embedded
// subscription is the fallback until it lands (or when billing is offline).
- const { currentPlan } = useUsageState();
+ const { currentPlan, teamUsage, usagePct } = useUsageState();
const name = user ? [user.firstName, user.lastName].filter(Boolean).join(' ') || null : null;
const tier: PlanTier | null = currentPlan?.plan ?? user?.subscription?.plan ?? null;
+ const usd = (n: number) => `$${n.toFixed(2)}`;
+ const resetsOn = teamUsage?.cycleEndsAt ? new Date(teamUsage.cycleEndsAt) : null;
return (
<SettingsPanel
testId="account-panel"
description={t('pages.settings.accountSection.description')}>
- {/* The username on the user record is the linked Telegram handle, not
- an account identity, so the profile card shows the name only. */}
- {user && name && (
- <Card padded data-testid="account-profile">
- <div className="flex items-center gap-4">
- <div className="min-w-0 flex-1">
+ {/* ── Profile & plan: who is signed in, what they're on, how much is
+ left this cycle, and the one place to manage billing. ─────────── */}
+ {user && (
+ <Card data-testid="account-profile">
+ <div className="flex items-center justify-between gap-4 p-4">
+ <div className="min-w-0">
{name && <div className="truncate text-base font-semibold text-content">{name}</div>}
+ <div className="mt-0.5 text-xs text-content-muted">
+ {t('settings.account.signedIn')}
+ </div>
</div>
{tier && (
<Badge variant={tier === 'FREE' ? 'neutral' : 'primary'} data-testid="account-plan">
@@ -51,11 +56,28 @@ const AccountPanel = () => {
</Badge>
)}
</div>
- </Card>
- )}
- {user && (
- <Card title={t('nav.avatarMenu.billing')}>
+ {teamUsage && teamUsage.cycleBudgetUsd > 0 && (
+ <div className="space-y-2 px-4 py-3" data-testid="account-usage">
+ <div className="flex items-baseline justify-between gap-3 text-xs">
+ <span className="font-medium text-content">
+ {t('settings.account.usageThisCycle')}
+ </span>
+ <span className="tabular-nums text-content-muted">
+ {t('settings.account.usageOf')
+ .replace('{spent}', usd(teamUsage.cycleSpentUsd))
+ .replace('{budget}', usd(teamUsage.cycleBudgetUsd))}
+ </span>
+ </div>
+ <Progress value={Math.round(usagePct * 100)} />
+ {resetsOn && !Number.isNaN(resetsOn.getTime()) && (
+ <div className="text-[11px] text-content-faint">
+ {t('settings.account.resetsOn').replace('{date}', resetsOn.toLocaleDateString())}
+ </div>
+ )}
+ </div>
+ )}
+
<Field
label={t('settings.account.manageBilling')}
description={t('settings.account.manageBillingDesc')}
@@ -73,7 +95,8 @@ const AccountPanel = () => {
</Card>
)}
- <Card>
+ {/* ── Preferences ─────────────────────────────────────────────────── */}
+ <Card title={t('settings.account.preferences')}>
<Field
label={t('settings.language')}
description={t('settings.languageDesc')}
@@ -81,6 +104,7 @@ const AccountPanel = () => {
/>
</Card>
+ {/* ── Session: log out, or wipe this device ───────────────────────── */}
<LogoutAndClearActions />
</SettingsPanel>
);
diff --git a/app/src/lib/i18n/en.ts b/app/src/lib/i18n/en.ts
index 515c8b21e8..f2071882dd 100644
--- a/app/src/lib/i18n/en.ts
+++ b/app/src/lib/i18n/en.ts
@@ -398,6 +398,11 @@ const en: TranslationMap = {
'settings.account.connections': 'Connections',
'settings.account.connectionsDesc': 'Manage linked accounts and services',
'settings.account.session': 'Session',
+ 'settings.account.signedIn': 'Signed in to OpenHuman',
+ 'settings.account.usageThisCycle': 'Usage this cycle',
+ 'settings.account.usageOf': '{spent} of {budget}',
+ 'settings.account.resetsOn': 'Resets {date}',
+ 'settings.account.preferences': 'Preferences',
'settings.account.dangerZone': 'Danger zone',
'settings.account.manageBilling': 'Plan & billing',
'settings.account.manageBillingDesc': 'Manage your subscription, credits, and invoices',