Skip to content

Commit dd35bd7

Browse files
committed
chore: refactor ErrorLayout
1 parent 006d02c commit dd35bd7

File tree

1 file changed

+61
-78
lines changed

1 file changed

+61
-78
lines changed
Lines changed: 61 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
<script lang="ts">
22
import { copyToClipboard } from '$lib/utils';
3-
import { Icon, IconButton, Logo } from '@immich/ui';
4-
import { mdiCodeTags, mdiContentCopy, mdiMessage, mdiPartyPopper } from '@mdi/js';
3+
import {
4+
Card,
5+
CardBody,
6+
CardFooter,
7+
CardHeader,
8+
CardTitle,
9+
Icon,
10+
IconButton,
11+
Link,
12+
Logo,
13+
Text,
14+
VStack,
15+
} from '@immich/ui';
16+
import { mdiAlarmLight, mdiCodeTags, mdiContentCopy, mdiMessage, mdiPartyPopper } from '@mdi/js';
517
import { t } from 'svelte-i18n';
618
719
interface Props {
@@ -19,90 +31,61 @@
1931
};
2032
</script>
2133

22-
<div class="h-dvh w-dvw">
34+
<div class="flex flex-col h-dvh w-dvw">
2335
<section>
2436
<div class="flex place-items-center border-b px-6 py-4 dark:border-b-immich-dark-gray">
25-
<a class="flex place-items-center gap-2 hover:cursor-pointer" href="/photos">
37+
<Link href="/photos">
2638
<Logo variant="inline" />
27-
</a>
39+
</Link>
2840
</div>
2941
</section>
3042

31-
<div class="fixed top-0 flex h-full w-full place-content-center place-items-center overflow-hidden bg-black/50">
32-
<div>
33-
<div
34-
class="w-125 max-w-[95vw] rounded-3xl border shadow-sm dark:border-immich-dark-gray dark:text-immich-dark-fg bg-subtle/80"
35-
>
36-
<div>
37-
<div class="flex items-center justify-between gap-4 px-4 py-4">
38-
<h1 class="font-medium text-primary">
39-
🚨 {$t('error_title')}
40-
</h1>
41-
<div class="flex justify-end">
42-
<IconButton
43-
shape="round"
44-
color="primary"
45-
icon={mdiContentCopy}
46-
aria-label={$t('copy_error')}
47-
onclick={() => handleCopy()}
48-
/>
49-
</div>
50-
</div>
43+
<div class="flex flex-1 w-full place-content-center place-items-center overflow-hidden bg-black/30">
44+
<div class="max-w-[95vw]">
45+
<Card color="secondary">
46+
<CardHeader class="flex-row justify-between gap-12">
47+
<CardTitle tag="h1" size="medium" class="text-primary flex place-items-center gap-4">
48+
<Icon icon={mdiAlarmLight} color="red" size="32" />
49+
{$t('error_title')}
50+
</CardTitle>
51+
<IconButton
52+
shape="round"
53+
color="primary"
54+
icon={mdiContentCopy}
55+
aria-label={$t('copy_error')}
56+
onclick={handleCopy}
57+
/>
58+
</CardHeader>
5159

52-
<hr />
60+
<CardBody class="flex flex-col gap-2">
61+
<Text color="danger">{error?.message} (HTTP {error?.code})</Text>
62+
{#if error?.stack}
63+
<label for="stacktrace">{$t('stacktrace')}</label>
64+
<pre id="stacktrace" class="text-xs">{error.stack}</pre>
65+
{/if}
66+
</CardBody>
5367

54-
<div class="immich-scrollbar max-h-[75vh] min-h-75 gap-4 overflow-y-auto p-4 pb-4">
55-
<div class="flex w-full flex-col gap-2">
56-
<p class="text-red-500">{error?.message} ({error?.code})</p>
57-
{#if error?.stack}
58-
<label for="stacktrace">{$t('stacktrace')}</label>
59-
<pre id="stacktrace" class="text-xs">{error?.stack || 'No stack'}</pre>
60-
{/if}
61-
</div>
62-
</div>
63-
64-
<hr />
65-
66-
<div class="flex place-content-center place-items-center justify-around">
67-
<!-- href="https://github.com/immich-app/immich/issues/new" -->
68-
<a
69-
href="https://discord.immich.app"
70-
target="_blank"
71-
rel="noopener noreferrer"
72-
class="flex grow basis-0 justify-center p-4"
73-
>
74-
<div class="flex flex-col place-content-center place-items-center gap-2">
75-
<Icon icon={mdiMessage} size="24" />
76-
<p class="text-sm">{$t('get_help')}</p>
77-
</div>
78-
</a>
79-
80-
<a
81-
href="https://github.com/immich-app/immich/releases"
82-
target="_blank"
83-
rel="noopener noreferrer"
84-
class="flex grow basis-0 justify-center p-4"
85-
>
86-
<div class="flex flex-col place-content-center place-items-center gap-2">
87-
<Icon icon={mdiPartyPopper} size="24" />
88-
<p class="text-sm">{$t('read_changelog')}</p>
89-
</div>
90-
</a>
91-
92-
<a
93-
href="https://docs.immich.app/guides/docker-help"
94-
target="_blank"
95-
rel="noopener noreferrer"
96-
class="flex grow basis-0 justify-center p-4"
97-
>
98-
<div class="flex flex-col place-content-center place-items-center gap-2">
99-
<Icon icon={mdiCodeTags} size="24" />
100-
<p class="text-sm">{$t('check_logs')}</p>
101-
</div>
102-
</a>
103-
</div>
104-
</div>
105-
</div>
68+
<CardFooter>
69+
<Link href="https://discord.immich.app" class="flex grow basis-0 justify-center">
70+
<VStack>
71+
<Icon icon={mdiMessage} size="24" />
72+
<Text size="small">{$t('get_help')}</Text>
73+
</VStack>
74+
</Link>
75+
<Link href="https://github.com/immich-app/immich/releases" class="flex grow basis-0 justify-center">
76+
<VStack>
77+
<Icon icon={mdiPartyPopper} size="24" />
78+
<Text size="small">{$t('read_changelog')}</Text>
79+
</VStack>
80+
</Link>
81+
<Link href="https://docs.immich.app/guides/docker-help" class="flex grow basis-0 justify-center">
82+
<VStack>
83+
<Icon icon={mdiCodeTags} size="24" />
84+
<Text size="small">{$t('check_logs')}</Text>
85+
</VStack>
86+
</Link>
87+
</CardFooter>
88+
</Card>
10689
</div>
10790
</div>
10891
</div>

0 commit comments

Comments
 (0)