Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,32 @@
import { isCloud } from '$lib/system';
import { sdk } from '$lib/stores/sdk';
import { capitalize } from '$lib/helpers/string';
import { regionalProtocol } from '$routes/(console)/project-[region]-[project]/store';
export let deployment: Models.Deployment;
export let proxyRuleList: Models.ProxyRuleList;
export let hideQRCode = false;
export let variant: 'primary' | 'secondary' = 'primary';
let {
deployment,
proxyRuleList,
hideQRCode = false,
variant = 'primary'
}: {
deployment: Models.Deployment;
proxyRuleList: Models.ProxyRuleList;
hideQRCode?: boolean;
variant?: 'primary' | 'secondary';
} = $props();
let show = false;
let show = $state(false);
$: totalSize = humanFileSize(deployment?.totalSize ?? 0);
let totalSize = $derived(humanFileSize(deployment?.totalSize ?? 0));
let sortedDomains = $derived(
proxyRuleList?.rules?.slice()?.sort((a, b) => {
if (a?.trigger === 'manual' && b?.trigger !== 'manual') return -1;
if (a?.trigger !== 'manual' && b?.trigger === 'manual') return 1;
return 0;
})
);
let primaryDomain = $derived(sortedDomains?.[0]?.domain);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const since these are derived and don't require/need a manual change.

function getScreenshot(theme: string, deployment: Models.Deployment) {
if (theme === 'dark') {
Expand Down Expand Up @@ -59,13 +76,29 @@
<Card padding="s" radius="m" {variant}>
<Layout.Stack gap="l">
<div class="card-grid">
<Image
border
radius="s"
ratio="16/9"
style="width: 100%; align-self: start"
src={getScreenshot($app.themeInUse, deployment)}
alt="Screenshot" />
{#if primaryDomain}
<a
href={`${$regionalProtocol}${primaryDomain}`}
target="_blank"
rel="noopener noreferrer"
aria-label="Open site">
Comment on lines +80 to +84
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have a Card.Link from Pink and a helper Card component with href prop in src/lib/components that we should use.

<Image
border
radius="s"
ratio="16/9"
style="width: 100%; align-self: start"
src={getScreenshot($app.themeInUse, deployment)}
alt="Screenshot" />
</a>
{:else}
<Image
border
radius="s"
ratio="16/9"
style="width: 100%; align-self: start"
src={getScreenshot($app.themeInUse, deployment)}
alt="Screenshot" />
{/if}

<Layout.Stack gap="xl">
<Layout.Stack direction="row" alignItems="flex-start">
Expand Down