fix: shared link expiration and small styling (#24566)
* fix: shared link expiration and small styling * Use text color of enable/disable shared link propertiespull/24204/head^2
parent
276d02e12b
commit
f0b069adb9
|
|
@ -5,7 +5,7 @@
|
||||||
import { getSharedLinkActions } from '$lib/services/shared-link.service';
|
import { getSharedLinkActions } from '$lib/services/shared-link.service';
|
||||||
import { locale } from '$lib/stores/preferences.store';
|
import { locale } from '$lib/stores/preferences.store';
|
||||||
import { SharedLinkType, type SharedLinkResponseDto } from '@immich/sdk';
|
import { SharedLinkType, type SharedLinkResponseDto } from '@immich/sdk';
|
||||||
import { Badge, ContextMenuButton, MenuItemType, Text } from '@immich/ui';
|
import { ContextMenuButton, MenuItemType, Text } from '@immich/ui';
|
||||||
import { DateTime, type ToRelativeUnit } from 'luxon';
|
import { DateTime, type ToRelativeUnit } from 'luxon';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
|
|
@ -32,6 +32,28 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
const { Edit, Copy, Delete } = $derived(getSharedLinkActions($t, sharedLink));
|
const { Edit, Copy, Delete } = $derived(getSharedLinkActions($t, sharedLink));
|
||||||
|
|
||||||
|
const capabilities = $derived.by(() => {
|
||||||
|
const items = [];
|
||||||
|
|
||||||
|
if (sharedLink.allowUpload) {
|
||||||
|
items.push($t('upload'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sharedLink.allowDownload) {
|
||||||
|
items.push($t('download'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sharedLink.showMetadata) {
|
||||||
|
items.push($t('exif'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sharedLink.password) {
|
||||||
|
items.push($t('password'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
@ -44,50 +66,41 @@
|
||||||
>
|
>
|
||||||
<ShareCover class="transition-all duration-300 hover:shadow-lg" {sharedLink} />
|
<ShareCover class="transition-all duration-300 hover:shadow-lg" {sharedLink} />
|
||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-4 justify-between">
|
||||||
<Text size="large" color="primary" class="flex place-items-center gap-2 break-all">
|
<div class="flex flex-col">
|
||||||
{#if sharedLink.type === SharedLinkType.Album}
|
<Text size="tiny" color={isExpired ? 'danger' : 'muted'} class="font-medium">
|
||||||
{sharedLink.album?.albumName}
|
{#if isExpired}
|
||||||
{:else if sharedLink.type === SharedLinkType.Individual}
|
{$t('expired')}
|
||||||
{$t('individual_share')}
|
{:else if expiresAt}
|
||||||
{/if}
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<div class="flex flex-wrap gap-1">
|
|
||||||
{#if isExpired}
|
|
||||||
<Badge size="small" color="danger">{$t('expired')}</Badge>
|
|
||||||
{:else if expiresAt}
|
|
||||||
<Badge size="small" color="secondary">
|
|
||||||
{$t('expires_date', { values: { date: getCountDownExpirationDate(expiresAt, now) } })}
|
{$t('expires_date', { values: { date: getCountDownExpirationDate(expiresAt, now) } })}
|
||||||
</Badge>
|
{:else}
|
||||||
{:else}
|
{$t('expires_date', { values: { date: '∞' } })}
|
||||||
<Badge size="small" color="secondary">{$t('expires_date', { values: { date: '∞' } })}</Badge>
|
{/if}
|
||||||
{/if}
|
</Text>
|
||||||
|
|
||||||
{#if sharedLink.slug}
|
<Text size="large" color="primary" class="flex place-items-center gap-2 break-all font-medium">
|
||||||
<Badge size="small" color="secondary">{$t('custom_url')}</Badge>
|
{#if sharedLink.type === SharedLinkType.Album}
|
||||||
{/if}
|
{sharedLink.album?.albumName}
|
||||||
|
{:else if sharedLink.type === SharedLinkType.Individual}
|
||||||
|
{$t('individual_share')}
|
||||||
|
{/if}
|
||||||
|
</Text>
|
||||||
|
|
||||||
{#if sharedLink.allowUpload}
|
{#if sharedLink.description}
|
||||||
<Badge size="small" color="secondary">{$t('upload')}</Badge>
|
<Text size="small" class="line-clamp-1">{sharedLink.description}</Text>
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if sharedLink.showMetadata && sharedLink.allowDownload}
|
|
||||||
<Badge size="small" color="secondary">{$t('download')}</Badge>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if sharedLink.showMetadata}
|
|
||||||
<Badge size="small" color="secondary">{$t('exif')}</Badge>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if sharedLink.password}
|
|
||||||
<Badge size="small" color="secondary">{$t('password')}</Badge>
|
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if sharedLink.description}
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
<Text size="small" class="line-clamp-1">{sharedLink.description}</Text>
|
{#each capabilities as capability, index (index)}
|
||||||
{/if}
|
<Text size="small" color="primary" class="font-medium">
|
||||||
|
{capability}
|
||||||
|
</Text>
|
||||||
|
{#if index < capabilities.length - 1}
|
||||||
|
<Text size="small" color="muted">•</Text>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</svelte:element>
|
</svelte:element>
|
||||||
<div class="flex flex-auto flex-col place-content-center place-items-end text-end ms-4">
|
<div class="flex flex-auto flex-col place-content-center place-items-end text-end ms-4">
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
import { page } from '$app/state';
|
import { page } from '$app/state';
|
||||||
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
|
||||||
import OnEvents from '$lib/components/OnEvents.svelte';
|
import OnEvents from '$lib/components/OnEvents.svelte';
|
||||||
import SharedLinkCard from '$lib/components/sharedlinks-page/shared-link-card.svelte';
|
import SharedLinkCard from '$lib/components/sharedlinks-page/SharedLinkCard.svelte';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
import GroupTab from '$lib/elements/GroupTab.svelte';
|
import GroupTab from '$lib/elements/GroupTab.svelte';
|
||||||
import SharedLinkUpdateModal from '$lib/modals/SharedLinkUpdateModal.svelte';
|
import SharedLinkUpdateModal from '$lib/modals/SharedLinkUpdateModal.svelte';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue