diff --git a/src/renderer/src/components/billing/PlanBillingUsageHistory.tsx b/src/renderer/src/components/billing/PlanBillingUsageHistory.tsx index 8320be5651f..a787dd88775 100644 --- a/src/renderer/src/components/billing/PlanBillingUsageHistory.tsx +++ b/src/renderer/src/components/billing/PlanBillingUsageHistory.tsx @@ -1,6 +1,5 @@ import { InlineError } from '@/components/ui/inline-error' import { Skeleton } from '@/components/ui/skeleton' -import { SettingsGroupHeader } from '@/components/settings/section-layout/SettingsGroup' import { useTranslate } from '@/i18n/use-translate' import { formatHoursUsed } from './plan-billing-format' import { @@ -18,6 +17,22 @@ const LOADING_BAR_HEIGHTS = Array.from({ length: 30 }, (_, index) => Math.round(30 + 25 * Math.sin(index / 3) + 20 * Math.cos(index / 5) + 25) ) +/** A part of Plan & billing, so a step below its section header (the size of "Overage"). */ +function UsageHistoryHeading({ + title, + total = null +}: { + title: string + total?: string | null +}): React.JSX.Element { + return ( +
+

{title}

+ {total ? {total} : null} +
+ ) +} + /** "Last 30 days": the team's daily hours; owners and admins also see the top workspaces and members. */ export function PlanBillingUsageHistory({ state, @@ -31,7 +46,7 @@ export function PlanBillingUsageHistory({ if (state.status === 'failed') { return (
- + - + {/* Shaped like the chart it stands in for, so it reads as "loading", not an empty panel. */}
{LOADING_BAR_HEIGHTS.map((height, index) => ( @@ -64,16 +79,9 @@ export function PlanBillingUsageHistory({ const empty = history.totalSeconds <= 0 return (
- - {usageWindowTotalLine(history.totalSeconds, t)} - - ) - } + total={empty ? null : usageWindowTotalLine(history.totalSeconds, t)} /> {empty ? (

diff --git a/src/renderer/src/components/settings/orca-cloud/OrcaAccountBillingPane.fixture.tsx b/src/renderer/src/components/settings/orca-cloud/OrcaAccountBillingPane.fixture.tsx index 379cbfcb3c2..f04d9c82c88 100644 --- a/src/renderer/src/components/settings/orca-cloud/OrcaAccountBillingPane.fixture.tsx +++ b/src/renderer/src/components/settings/orca-cloud/OrcaAccountBillingPane.fixture.tsx @@ -52,8 +52,16 @@ function page(status: OrcaProfileAuthStatus, billing: React.ReactNode) { width: 760, store: { orcaProfileAuthStatus: status }, // The account part re-reads auth status on mount; answer with the same state. + // Orca Cloud builds (the only ones with this page) have a control plane. setup: () => { Object.assign(window.api.orcaProfiles, { authStatus: () => Promise.resolve(status) }) + Object.assign(window.api, { + cloudApi: { + ...window.api.cloudApi, + availability: () => + Promise.resolve({ status: 'ready' as const, controlPlaneUrl: 'https://cloud.example' }) + } + }) }, render: () => (

diff --git a/src/renderer/src/components/settings/orca-cloud/OrcaAccountBillingPane.tsx b/src/renderer/src/components/settings/orca-cloud/OrcaAccountBillingPane.tsx index e40779b7f80..9cdae236e5c 100644 --- a/src/renderer/src/components/settings/orca-cloud/OrcaAccountBillingPane.tsx +++ b/src/renderer/src/components/settings/orca-cloud/OrcaAccountBillingPane.tsx @@ -16,7 +16,7 @@ export function AccountBillingLayout({ }): React.JSX.Element { const t = useTranslate() return ( -
+
{billing ? ( -
+ // The page's second half: the same rule as under the page subtitle, then its header. +