Skip to content

Commit 2d5ec52

Browse files
authored
fix(web): user admin pages (#24185)
fix: user admin pages
1 parent 5226898 commit 2d5ec52

File tree

23 files changed

+129
-173
lines changed

23 files changed

+129
-173
lines changed

e2e/src/web/specs/user-admin.e2e-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ test.describe('User Administration', () => {
5454

5555
await page.getByRole('button', { name: 'Edit' }).click();
5656
await expect(page.getByLabel('Admin User')).not.toBeChecked();
57-
await page.getByText('Admin User').click();
57+
await page.getByLabel('Admin User').click();
5858
await expect(page.getByLabel('Admin User')).toBeChecked();
5959
await page.getByRole('button', { name: 'Confirm' }).click();
6060

@@ -83,7 +83,7 @@ test.describe('User Administration', () => {
8383

8484
await page.getByRole('button', { name: 'Edit' }).click();
8585
await expect(page.getByLabel('Admin User')).toBeChecked();
86-
await page.getByText('Admin User').click();
86+
await page.getByLabel('Admin User').click();
8787
await expect(page.getByLabel('Admin User')).not.toBeChecked();
8888
await page.getByRole('button', { name: 'Confirm' }).click();
8989

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@formatjs/icu-messageformat-parser": "^2.9.8",
2929
"@immich/justified-layout-wasm": "^0.4.3",
3030
"@immich/sdk": "file:../open-api/typescript-sdk",
31-
"@immich/ui": "^0.45.0",
31+
"@immich/ui": "^0.49.1",
3232
"@mapbox/mapbox-gl-rtl-text": "0.2.3",
3333
"@mdi/js": "^7.4.47",
3434
"@photo-sphere-viewer/core": "^5.14.0",

web/src/app.css

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,6 @@
7676
--immich-dark-gray: 33 33 33;
7777
}
7878

79-
*,
80-
::after,
81-
::before,
82-
::backdrop,
83-
::file-selector-button {
84-
border-color: rgb(var(--immich-ui-default-border));
85-
}
86-
8779
button:not(:disabled),
8880
[role='button']:not(:disabled) {
8981
cursor: pointer;
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<script lang="ts">
2-
import type { ActionItem } from '$lib/types';
3-
import { IconButton, type IconButtonProps } from '@immich/ui';
2+
import { IconButton, type ActionItem } from '@immich/ui';
43
54
type Props = {
65
action: ActionItem;
76
};
87
98
const { action }: Props = $props();
10-
const { title, icon, color = 'secondary', props: other = {}, onSelect } = $derived(action);
11-
const onclick = (event: Event) => onSelect?.({ event, item: action });
9+
const { title, icon, color = 'secondary', onAction } = $derived(action);
1210
</script>
1311

1412
{#if action.$if?.() ?? true}
15-
<IconButton variant="ghost" {color} shape="round" {...other as IconButtonProps} {icon} aria-label={title} {onclick} />
13+
<IconButton variant="ghost" shape="round" {color} {icon} aria-label={title} onclick={() => onAction(action)} />
1614
{/if}
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
<script lang="ts">
2-
import type { ActionItem } from '$lib/types';
3-
import { Button, type ButtonProps, Text } from '@immich/ui';
2+
import { type ActionItem, Button, Text } from '@immich/ui';
43
54
type Props = {
65
action: ActionItem;
6+
title?: string;
77
};
88
9-
const { action }: Props = $props();
10-
const { title, icon, color = 'secondary', props: other = {}, onSelect } = $derived(action);
11-
const onclick = (event: Event) => onSelect?.({ event, item: action });
9+
const { action, title: titleAttr }: Props = $props();
10+
const { title, icon, color = 'secondary', onAction } = $derived(action);
1211
</script>
1312

1413
{#if action.$if?.() ?? true}
15-
<Button variant="ghost" size="small" {color} {...other as ButtonProps} leadingIcon={icon} {onclick}>
14+
<Button variant="ghost" size="small" {color} leadingIcon={icon} onclick={() => onAction(action)} title={titleAttr}>
1615
<Text class="hidden md:block">{title}</Text>
1716
</Button>
1817
{/if}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
<script lang="ts">
2-
import type { ActionItem } from '$lib/types';
3-
import { IconButton, type IconButtonProps } from '@immich/ui';
2+
import { IconButton, type ActionItem } from '@immich/ui';
43
54
type Props = {
65
action: ActionItem;
76
};
87
98
const { action }: Props = $props();
10-
const { title, icon, props: other = {}, onSelect } = $derived(action);
11-
const onclick = (event: Event) => onSelect?.({ event, item: action });
9+
const { title, icon, onAction } = $derived(action);
1210
</script>
1311

1412
{#if action.$if?.() ?? true}
15-
<IconButton shape="round" color="primary" {...other as IconButtonProps} {icon} aria-label={title} {onclick} />
13+
<IconButton shape="round" color="primary" {icon} aria-label={title} onclick={() => onAction(action)} />
1614
{/if}

web/src/lib/components/album-page/album-shared-link.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
.filter(Boolean)
3333
.join('');
3434
35-
const SharedLinkActions = $derived(getSharedLinkActions($t, sharedLink));
35+
const { ViewQrCode, Copy } = $derived(getSharedLinkActions($t, sharedLink));
3636
</script>
3737

3838
<div class="flex justify-between items-center">
@@ -41,7 +41,7 @@
4141
<Text size="tiny" color="muted">{getShareProperties()}</Text>
4242
</div>
4343
<div class="flex">
44-
<ActionButton action={SharedLinkActions.ViewQrCode} />
45-
<ActionButton action={SharedLinkActions.Copy} />
44+
<ActionButton action={ViewQrCode} />
45+
<ActionButton action={Copy} />
4646
</div>
4747
</div>

web/src/lib/components/layouts/AdminPageLayout.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
import NavigationBar from '$lib/components/shared-components/navigation-bar/navigation-bar.svelte';
55
import AdminSidebar from '$lib/sidebars/AdminSidebar.svelte';
66
import { sidebarStore } from '$lib/stores/sidebar.svelte';
7-
import { AppShell, AppShellHeader, AppShellSidebar, Scrollable } from '@immich/ui';
7+
import { AppShell, AppShellHeader, AppShellSidebar, Scrollable, type BreadcrumbItem } from '@immich/ui';
88
import type { Snippet } from 'svelte';
99
1010
type Props = {
11-
title: string;
11+
breadcrumbs: BreadcrumbItem[];
1212
buttons?: Snippet;
1313
children?: Snippet;
1414
};
1515
16-
let { title, buttons, children }: Props = $props();
16+
let { breadcrumbs, buttons, children }: Props = $props();
1717
</script>
1818

1919
<AppShell>
@@ -24,7 +24,7 @@
2424
<AdminSidebar />
2525
</AppShellSidebar>
2626

27-
<TitleLayout {title} {buttons}>
27+
<TitleLayout {breadcrumbs} {buttons}>
2828
<Scrollable class="grow">
2929
<PageContent>
3030
{@render children?.()}

web/src/lib/components/layouts/TitleLayout.svelte

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
<script lang="ts">
2-
import { Text } from '@immich/ui';
2+
import { Breadcrumbs, type BreadcrumbItem } from '@immich/ui';
3+
import { mdiSlashForward } from '@mdi/js';
34
import type { Snippet } from 'svelte';
45
5-
interface Props {
6-
id?: string;
7-
title?: string;
8-
description?: string;
6+
type Props = {
7+
breadcrumbs: BreadcrumbItem[];
98
buttons?: Snippet;
109
children?: Snippet;
11-
}
10+
};
1211
13-
let { id, title, description, buttons, children }: Props = $props();
12+
let { breadcrumbs, buttons, children }: Props = $props();
1413
</script>
1514

1615
<div class="h-full flex flex-col">
1716
<div class="flex h-16 w-full place-items-center justify-between border-b p-2">
18-
<div class="flex gap-1">
19-
<div class="font-medium outline-none" tabindex="-1" {id}>{title}</div>
20-
{#if description}
21-
<Text color="muted">{description}</Text>
22-
{/if}
23-
</div>
17+
<Breadcrumbs items={breadcrumbs} separator={mdiSlashForward} />
2418
{@render buttons?.()}
2519
</div>
2620
{@render children?.()}

0 commit comments

Comments
 (0)