Skip to content

Commit

Permalink
chore(astro): clean up app page
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonianb committed Aug 2, 2024
1 parent cad9506 commit dd60d32
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
4 changes: 2 additions & 2 deletions packages/codius-astro/src/components/AppBilling.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const workerBilling = await billing.getWorkerBilling()
const totalCost = getWorkerTotalCost(workerBilling)
---

<>
<div class="grid w-full items-center gap-4">
<CardField
label="Requests"
content={workerBilling.requests.total.toString()}
Expand All @@ -45,4 +45,4 @@ const totalCost = getWorkerTotalCost(workerBilling)
label="Balance"
content={nanoUSDToString(workerBilling.funding.totalNanoUSD - totalCost)}
/>
</>
</div>
2 changes: 1 addition & 1 deletion packages/codius-astro/src/components/CardField.astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const { label, content, link, linkTarget = "_blank" } = Astro.props
---

<div class="flex flex-col space-y-1.5">
<Label>{label}</Label>
{label && <Label>{label}</Label>}
<slot name="label" />
<div class="rounded-md border p-3">
{
Expand Down
32 changes: 15 additions & 17 deletions packages/codius-astro/src/pages/apps/[id].astro
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ if (app.status !== "deployed" && !userIsDeployer) {
<main>
<Card>
<CardHeader>
<CardTitle>{app.id}</CardTitle>
<CardTitle>
<a
href={`https://${app.id}.${Astro.locals.runtime.env.DISPATHER_HOSTNAME}`}
target="_blank"
rel="noopener noreferrer"
>{`${app.id}.${Astro.locals.runtime.env.DISPATHER_HOSTNAME}`}</a
>
</CardTitle>
<CardDescription
>Deployed by <a
href={`https://github.com/${app.deployer.username}`}
Expand All @@ -51,7 +58,7 @@ if (app.status !== "deployed" && !userIsDeployer) {
<CardContent>
{
userIsDeployer && (
<div class="flex justify-start items-center mb-4 space-x-4">
<div class="flex flex-col items-start mb-4 gap-4">
<CardField label="Status">
<Badge
className="inline-flex"
Expand Down Expand Up @@ -84,11 +91,6 @@ if (app.status !== "deployed" && !userIsDeployer) {
}
<div class="grid grid-cols-2 gap-4">
<div class="col-span-1 grid gap-4">
<CardField
label="URL"
content={`https://${app.id}.${Astro.locals.runtime.env.DISPATHER_HOSTNAME}`}
link={`https://${app.id}.${Astro.locals.runtime.env.DISPATHER_HOSTNAME}`}
/>
<CardField label="Repo">
<a
href={`https://github.com/${app.githubOwner}/${app.repo}`}
Expand All @@ -111,15 +113,11 @@ if (app.status !== "deployed" && !userIsDeployer) {
content={app.commitHash}
link={`https://github.com/${app.githubOwner}/${app.repo}/tree/${app.commitHash}`}
/>
{
app.directory && (
<CardField
label="Directory"
content={app.directory}
link={`https://github.com/${app.githubOwner}/${app.repo}/tree/${app.commitHash}/${app.directory}`}
/>
)
}
<CardField
label="Directory"
content={app.directory || "/"}
link={`https://github.com/${app.githubOwner}/${app.repo}/tree/${app.commitHash}/${app.directory}`}
/>
<CardField
label="Created At"
content={new Date(app.createdAt + "Z").toUTCString()}
Expand All @@ -141,7 +139,7 @@ if (app.status !== "deployed" && !userIsDeployer) {
</div>
<div class="col-span-1 grid gap-4">
<AppBilling appId={app.id} />
<div class="mb-4">
<div>
<Button
className="top-up-balance"
data-app-id={app.id}
Expand Down
4 changes: 1 addition & 3 deletions packages/codius-astro/src/pages/apps/[id]/402.astro
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ if (!appId) {
<CardHeader>
<CardTitle>{appId}</CardTitle>
<CardContent>
<div class="grid w-full items-center gap-4">
<AppBilling appId={appId} />
</div>
<AppBilling appId={appId} />
</CardContent>
<div class="mb-4">
<Button className="top-up-balance" data-app-id={appId}>
Expand Down

0 comments on commit dd60d32

Please sign in to comment.