Skip to content

Commit e19885d

Browse files
committed
style usage breakdown
1 parent 4a0e158 commit e19885d

File tree

1 file changed

+86
-13
lines changed
  • packages/web/workspace/src/pages/workspace/settings

1 file changed

+86
-13
lines changed

packages/web/workspace/src/pages/workspace/settings/index.tsx

Lines changed: 86 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,50 @@ const UsageStatTier = styled("span", {
163163
const UsagePlanCopy = styled("p", {
164164
base: {
165165
fontSize: theme.font.size.sm,
166-
color: theme.color.text.secondary.base,
167166
lineHeight: theme.font.lineHeight,
167+
color: theme.color.text.secondary.base,
168+
},
169+
});
170+
171+
const UsageShowMore = styled("button", {
172+
base: {
173+
textDecoration: "underline",
174+
},
175+
});
176+
177+
const UsageTable = styled("table", {
178+
base: {
179+
borderCollapse: "separate",
180+
borderSpacing: 0,
181+
},
182+
});
183+
184+
const UsageTableHeaderCell = styled("th", {
185+
base: {
186+
padding: `${theme.space[2]} ${theme.space[3]} calc(${theme.space[2]} + 1px)`,
187+
textAlign: "left",
188+
backgroundColor: theme.color.background.surface,
189+
},
190+
});
191+
192+
const UsageTableHeaderCopy = styled("span", {
193+
base: {
194+
color: theme.color.text.dimmed.base,
195+
fontSize: theme.font.size.mono_xs,
196+
fontFamily: theme.font.family.code,
197+
fontWeight: theme.font.weight.medium,
198+
letterSpacing: 0.5,
199+
textTransform: "uppercase",
200+
lineHeight: 1,
201+
},
202+
});
203+
204+
const UsageTableCell = styled("td", {
205+
base: {
206+
padding: `${theme.space[3]} ${theme.space[3]}`,
207+
fontSize: theme.font.size.xs,
208+
color: theme.color.text.secondary.base,
209+
borderBottom: `1px solid ${theme.color.divider.base}`,
168210
},
169211
});
170212

@@ -212,6 +254,7 @@ export function SettingsRoute() {
212254
};
213255
});
214256
const stripe = StripeStore.get.watch(rep, () => []);
257+
const [usageDetails, showUsageDetails] = createSignal(false);
215258

216259
let portalLink: Promise<Response> | undefined;
217260
let checkoutLink: Promise<Response> | undefined;
@@ -261,7 +304,6 @@ export function SettingsRoute() {
261304
window.location.href = result.url;
262305
}
263306

264-
console.log(WorkspaceStore);
265307
const workspaceInfo = createSubscription(() => {
266308
const workspaceID = useWorkspace();
267309
return (tx) => WorkspaceStore.get(tx, workspaceID().id);
@@ -383,7 +425,7 @@ export function SettingsRoute() {
383425
</UsagePlanCopy>
384426
</Stack>
385427
</Show>
386-
<Stack space="2">
428+
<Stack space="3">
387429
<UsagePanel>
388430
<UsageStat stretch>
389431
<Text code uppercase size="mono_xs" color="dimmed">
@@ -474,18 +516,49 @@ export function SettingsRoute() {
474516
{stageCount() === 1
475517
? "1 updated stage"
476518
: `${stageCount()} updated stages`}{" "}
477-
during {cycle().start}{cycle().end}. Feel free to{" "}
478-
<a href="mailto:hello@sst.dev">contact us</a> if you have any
479-
questions.
480-
</UsagePlanCopy>
481-
<Show when={["frank", "sst"].includes(workspace().slug)}>
519+
during {cycle().start}{cycle().end}.
482520
<Show when={stageResources().length > 0}>
483-
{stageResources().map((resource) => (
484-
<Text size="sm" color="dimmed">
485-
{resource.app} / {resource.stage} - ({resource.count})
486-
</Text>
487-
))}
521+
&nbsp;
522+
<UsageShowMore
523+
onClick={() => showUsageDetails(!usageDetails())}
524+
>
525+
{usageDetails() ? "Hide" : "Show details"}
526+
</UsageShowMore>
488527
</Show>
528+
</UsagePlanCopy>
529+
<Show when={usageDetails()}>
530+
<UsageTable>
531+
<thead>
532+
<tr>
533+
<UsageTableHeaderCell>
534+
<UsageTableHeaderCopy>App</UsageTableHeaderCopy>
535+
</UsageTableHeaderCell>
536+
<UsageTableHeaderCell>
537+
<UsageTableHeaderCopy>Stage</UsageTableHeaderCopy>
538+
</UsageTableHeaderCell>
539+
<UsageTableHeaderCell>
540+
<UsageTableHeaderCopy>Resources</UsageTableHeaderCopy>
541+
</UsageTableHeaderCell>
542+
</tr>
543+
</thead>
544+
<tbody>
545+
{stageResources().map((resource) => (
546+
<tr>
547+
<UsageTableCell>{resource.app}</UsageTableCell>
548+
<UsageTableCell>{resource.stage}</UsageTableCell>
549+
<UsageTableCell>
550+
<Text color="secondary" code size="mono_xs">
551+
{resource.count}
552+
</Text>
553+
</UsageTableCell>
554+
</tr>
555+
))}
556+
</tbody>
557+
</UsageTable>
558+
<UsagePlanCopy>
559+
Feel free to <a href="mailto:hello@sst.dev">contact us</a> if
560+
you have any questions.
561+
</UsagePlanCopy>
489562
</Show>
490563
</Stack>
491564
</Stack>

0 commit comments

Comments
 (0)