mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 17:25:11 +03:00
fix: shared link expiration and small styling
This commit is contained in:
@@ -5,7 +5,8 @@
|
|||||||
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, Icon, MenuItemType, Text } from '@immich/ui';
|
||||||
|
import { mdiDownload, mdiInformationOutline, mdiLink, mdiLock, mdiUpload } from '@mdi/js';
|
||||||
import { DateTime, type ToRelativeUnit } from 'luxon';
|
import { DateTime, type ToRelativeUnit } from 'luxon';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
@@ -44,8 +45,19 @@
|
|||||||
>
|
>
|
||||||
<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">
|
||||||
|
<Text size="tiny" color={isExpired ? 'danger' : 'muted'} class="font-medium">
|
||||||
|
{#if isExpired}
|
||||||
|
{$t('expired')}
|
||||||
|
{:else if expiresAt}
|
||||||
|
{$t('expires_date', { values: { date: getCountDownExpirationDate(expiresAt, now) } })}
|
||||||
|
{:else}
|
||||||
|
{$t('expires_date', { values: { date: '∞' } })}
|
||||||
|
{/if}
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<Text size="large" color="primary" class="flex place-items-center gap-2 break-all font-medium">
|
||||||
{#if sharedLink.type === SharedLinkType.Album}
|
{#if sharedLink.type === SharedLinkType.Album}
|
||||||
{sharedLink.album?.albumName}
|
{sharedLink.album?.albumName}
|
||||||
{:else if sharedLink.type === SharedLinkType.Individual}
|
{:else if sharedLink.type === SharedLinkType.Individual}
|
||||||
@@ -53,42 +65,33 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</Text>
|
</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) } })}
|
|
||||||
</Badge>
|
|
||||||
{:else}
|
|
||||||
<Badge size="small" color="secondary">{$t('expires_date', { values: { date: '∞' } })}</Badge>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if sharedLink.slug}
|
|
||||||
<Badge size="small" color="secondary">{$t('custom_url')}</Badge>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
{#if sharedLink.allowUpload}
|
|
||||||
<Badge size="small" color="secondary">{$t('upload')}</Badge>
|
|
||||||
{/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}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{#if sharedLink.description}
|
{#if sharedLink.description}
|
||||||
<Text size="small" class="line-clamp-1">{sharedLink.description}</Text>
|
<Text size="small" class="line-clamp-1">{sharedLink.description}</Text>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-wrap gap-1">
|
||||||
|
{#if sharedLink.slug}
|
||||||
|
<Icon icon={mdiLink} size="18" title={$t('custom_url')} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if sharedLink.allowUpload}
|
||||||
|
<Icon icon={mdiUpload} size="18" title={$t('upload')} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if sharedLink.showMetadata && sharedLink.allowDownload}
|
||||||
|
<Icon icon={mdiDownload} size="18" title={$t('download')} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if sharedLink.showMetadata}
|
||||||
|
<Icon icon={mdiInformationOutline} size="18" title={$t('exif')} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if sharedLink.password}
|
||||||
|
<Icon icon={mdiLock} size="18" title={$t('password')} />
|
||||||
|
{/if}
|
||||||
|
</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">
|
||||||
<div class="sm:flex hidden">
|
<div class="sm:flex hidden">
|
||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
type SharedLinkResponseDto,
|
type SharedLinkResponseDto,
|
||||||
} from '@immich/sdk';
|
} from '@immich/sdk';
|
||||||
import { modalManager, toastManager, type ActionItem } from '@immich/ui';
|
import { modalManager, toastManager, type ActionItem } from '@immich/ui';
|
||||||
import { mdiContentCopy, mdiPencilOutline, mdiQrcode, mdiTrashCanOutline } from '@mdi/js';
|
import { mdiContentCopy, mdiDeleteOutline, mdiPencilOutline, mdiQrcode } from '@mdi/js';
|
||||||
import type { MessageFormatter } from 'svelte-i18n';
|
import type { MessageFormatter } from 'svelte-i18n';
|
||||||
|
|
||||||
export const getSharedLinkActions = ($t: MessageFormatter, sharedLink: SharedLinkResponseDto) => {
|
export const getSharedLinkActions = ($t: MessageFormatter, sharedLink: SharedLinkResponseDto) => {
|
||||||
@@ -29,7 +29,7 @@ export const getSharedLinkActions = ($t: MessageFormatter, sharedLink: SharedLin
|
|||||||
|
|
||||||
const Delete: ActionItem = {
|
const Delete: ActionItem = {
|
||||||
title: $t('delete_link'),
|
title: $t('delete_link'),
|
||||||
icon: mdiTrashCanOutline,
|
icon: mdiDeleteOutline,
|
||||||
color: 'danger',
|
color: 'danger',
|
||||||
onAction: () => handleDeleteSharedLink(sharedLink),
|
onAction: () => handleDeleteSharedLink(sharedLink),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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';
|
||||||
|
|||||||
Reference in New Issue
Block a user