1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-06 03:46:47 +01:00

try to fix identation

This commit is contained in:
Yonggan 2023-06-10 15:03:06 +02:00
parent 6f09f28206
commit 40c727b74a
6 changed files with 460 additions and 460 deletions

View file

@ -8,13 +8,13 @@
</script> </script>
<script lang="ts"> <script lang="ts">
import { page } from '$app/stores'; import {page} from '$app/stores';
import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte'; import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte';
import { handleError } from '$lib/utils/handle-error'; import {handleError} from '$lib/utils/handle-error';
import { AssetResponseDto, SharedLinkResponseDto, ThumbnailFormat } from '@api'; import {AssetResponseDto, SharedLinkResponseDto, ThumbnailFormat} from '@api';
import AssetViewer from '../../asset-viewer/asset-viewer.svelte'; import AssetViewer from '../../asset-viewer/asset-viewer.svelte';
import { flip } from 'svelte/animate'; import {flip} from 'svelte/animate';
import { archivedAsset } from '$lib/stores/archived-asset.store'; import {archivedAsset} from '$lib/stores/archived-asset.store';
export let assets: AssetResponseDto[]; export let assets: AssetResponseDto[];
export let sharedLink: SharedLinkResponseDto | undefined = undefined; export let sharedLink: SharedLinkResponseDto | undefined = undefined;
@ -46,7 +46,7 @@
} }
const viewAssetHandler = (event: CustomEvent) => { const viewAssetHandler = (event: CustomEvent) => {
const { asset }: { asset: AssetResponseDto } = event.detail; const {asset}: { asset: AssetResponseDto } = event.detail;
currentViewAssetIndex = assets.findIndex((a) => a.id == asset.id); currentViewAssetIndex = assets.findIndex((a) => a.id == asset.id);
selectedAsset = assets[currentViewAssetIndex]; selectedAsset = assets[currentViewAssetIndex];
@ -55,7 +55,7 @@
}; };
const selectAssetHandler = (event: CustomEvent) => { const selectAssetHandler = (event: CustomEvent) => {
const { asset }: { asset: AssetResponseDto } = event.detail; const {asset}: { asset: AssetResponseDto } = event.detail;
let temp = new Set(selectedAssets); let temp = new Set(selectedAssets);
if (selectedAssets.has(asset)) { if (selectedAssets.has(asset)) {
@ -114,34 +114,34 @@
</script> </script>
{#if assets.length > 0} {#if assets.length > 0}
<div class="flex flex-wrap gap-1 w-full pb-20" bind:clientWidth={viewWidth}> <div class="flex flex-wrap gap-1 w-full pb-20" bind:clientWidth={viewWidth}>
{#each assets as asset (asset.id)} {#each assets as asset (asset.id)}
<div animate:flip={{ duration: 500 }}> <div animate:flip={{ duration: 500 }}>
<Thumbnail <Thumbnail
{asset} {asset}
{thumbnailSize} {thumbnailSize}
readonly={disableAssetSelect} readonly={disableAssetSelect}
publicSharedKey={sharedLink?.key} publicSharedKey={sharedLink?.key}
format={assets.length < 7 ? ThumbnailFormat.Jpeg : ThumbnailFormat.Webp} format={assets.length < 7 ? ThumbnailFormat.Jpeg : ThumbnailFormat.Webp}
on:click={(e) => (isMultiSelectionMode ? selectAssetHandler(e) : viewAssetHandler(e))} on:click={(e) => (isMultiSelectionMode ? selectAssetHandler(e) : viewAssetHandler(e))}
on:select={selectAssetHandler} on:select={selectAssetHandler}
selected={selectedAssets.has(asset)} selected={selectedAssets.has(asset)}
{showArchiveIcon} {showArchiveIcon}
/> />
</div> </div>
{/each} {/each}
</div> </div>
{/if} {/if}
<!-- Overlay Asset Viewer --> <!-- Overlay Asset Viewer -->
{#if isShowAssetViewer} {#if isShowAssetViewer}
<AssetViewer <AssetViewer
asset={selectedAsset} asset={selectedAsset}
publicSharedKey={sharedLink?.key} publicSharedKey={sharedLink?.key}
{sharedLink} {sharedLink}
on:navigate-previous={navigateAssetBackward} on:navigate-previous={navigateAssetBackward}
on:navigate-next={navigateAssetForward} on:navigate-next={navigateAssetForward}
on:close={closeViewer} on:close={closeViewer}
on:unarchived={handleUnarchivedSuccess} on:unarchived={handleUnarchivedSuccess}
/> />
{/if} {/if}

View file

@ -10,15 +10,15 @@
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte'; import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte'; import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
import SelectAll from 'svelte-material-icons/SelectAll.svelte'; import SelectAll from 'svelte-material-icons/SelectAll.svelte';
import { archivedAsset } from '$lib/stores/archived-asset.store'; import {archivedAsset} from '$lib/stores/archived-asset.store';
import { handleError } from '$lib/utils/handle-error'; import {handleError} from '$lib/utils/handle-error';
import { api, AssetResponseDto } from '@api'; import {api, AssetResponseDto} from '@api';
import { onMount } from 'svelte'; import {onMount} from 'svelte';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte'; import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
import Plus from 'svelte-material-icons/Plus.svelte'; import Plus from 'svelte-material-icons/Plus.svelte';
import type { PageData } from './$types'; import type {PageData} from './$types';
import CircleIconButton from "$lib/components/elements/buttons/circle-icon-button.svelte"; import CircleIconButton from "$lib/components/elements/buttons/circle-icon-button.svelte";
export let data: PageData; export let data: PageData;
@ -28,7 +28,7 @@
onMount(async () => { onMount(async () => {
try { try {
const { data: assets } = await api.assetApi.getAllAssets({ const {data: assets} = await api.assetApi.getAllAssets({
isArchived: true, isArchived: true,
withoutThumbs: true withoutThumbs: true
}); });
@ -41,41 +41,41 @@
const onAssetDelete = (assetId: string) => { const onAssetDelete = (assetId: string) => {
$archivedAsset = $archivedAsset.filter((a) => a.id !== assetId); $archivedAsset = $archivedAsset.filter((a) => a.id !== assetId);
}; };
const handleSelectAll = () => { const handleSelectAll = () => {
selectedAssets = new Set($archivedAsset) selectedAssets = new Set($archivedAsset)
} }
</script> </script>
<UserPageLayout user={data.user} hideNavbar={isMultiSelectionMode} title={data.meta.title}> <UserPageLayout user={data.user} hideNavbar={isMultiSelectionMode} title={data.meta.title}>
<!-- Empty Message --> <!-- Empty Message -->
{#if $archivedAsset.length === 0} {#if $archivedAsset.length === 0}
<EmptyPlaceholder <EmptyPlaceholder
text="Archive photos and videos to hide them from your Photos view" text="Archive photos and videos to hide them from your Photos view"
alt="Empty archive" alt="Empty archive"
/> />
{/if} {/if}
<svelte:fragment slot="header"> <svelte:fragment slot="header">
{#if isMultiSelectionMode} {#if isMultiSelectionMode}
<AssetSelectControlBar <AssetSelectControlBar
assets={selectedAssets} assets={selectedAssets}
clearSelect={() => (selectedAssets = new Set())} clearSelect={() => (selectedAssets = new Set())}
> >
<ArchiveAction unarchive onAssetArchive={(asset) => onAssetDelete(asset.id)} /> <ArchiveAction unarchive onAssetArchive={(asset) => onAssetDelete(asset.id)}/>
<CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll}/> <CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll}/>
<CreateSharedLink /> <CreateSharedLink/>
<AssetSelectContextMenu icon={Plus} title="Add"> <AssetSelectContextMenu icon={Plus} title="Add">
<AddToAlbum /> <AddToAlbum/>
<AddToAlbum shared /> <AddToAlbum shared/>
</AssetSelectContextMenu> </AssetSelectContextMenu>
<DeleteAssets {onAssetDelete} /> <DeleteAssets {onAssetDelete}/>
<AssetSelectContextMenu icon={DotsVertical} title="Add"> <AssetSelectContextMenu icon={DotsVertical} title="Add">
<DownloadAction menuItem /> <DownloadAction menuItem/>
<FavoriteAction menuItem removeFavorite={isAllFavorite} /> <FavoriteAction menuItem removeFavorite={isAllFavorite}/>
</AssetSelectContextMenu> </AssetSelectContextMenu>
</AssetSelectControlBar> </AssetSelectControlBar>
{/if} {/if}
</svelte:fragment> </svelte:fragment>
<GalleryViewer assets={$archivedAsset} bind:selectedAssets viewFrom="archive-page" /> <GalleryViewer assets={$archivedAsset} bind:selectedAssets viewFrom="archive-page"/>
</UserPageLayout> </UserPageLayout>

View file

@ -2,13 +2,13 @@
import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte'; import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte';
import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte'; import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte'; import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import { AppRoute } from '$lib/constants'; import {AppRoute} from '$lib/constants';
import { AssetTypeEnum, SearchExploreResponseDto, api } from '@api'; import {AssetTypeEnum, SearchExploreResponseDto, api} from '@api';
import ClockOutline from 'svelte-material-icons/ClockOutline.svelte'; import ClockOutline from 'svelte-material-icons/ClockOutline.svelte';
import HeartMultipleOutline from 'svelte-material-icons/HeartMultipleOutline.svelte'; import HeartMultipleOutline from 'svelte-material-icons/HeartMultipleOutline.svelte';
import MotionPlayOutline from 'svelte-material-icons/MotionPlayOutline.svelte'; import MotionPlayOutline from 'svelte-material-icons/MotionPlayOutline.svelte';
import PlayCircleOutline from 'svelte-material-icons/PlayCircleOutline.svelte'; import PlayCircleOutline from 'svelte-material-icons/PlayCircleOutline.svelte';
import type { PageData } from './$types'; import type {PageData} from './$types';
export let data: PageData; export let data: PageData;
@ -31,127 +31,127 @@
</script> </script>
<UserPageLayout user={data.user} title={data.meta.title}> <UserPageLayout user={data.user} title={data.meta.title}>
{#if people.length > 0} {#if people.length > 0}
<div class="mb-6 mt-2"> <div class="mb-6 mt-2">
<div class="flex justify-between"> <div class="flex justify-between">
<p class="mb-4 dark:text-immich-dark-fg font-medium">People</p> <p class="mb-4 dark:text-immich-dark-fg font-medium">People</p>
{#if data.people.length > MAX_ITEMS} {#if data.people.length > MAX_ITEMS}
<a <a
href={AppRoute.PEOPLE} href={AppRoute.PEOPLE}
class="font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary dark:text-immich-dark-fg" class="font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary dark:text-immich-dark-fg"
draggable="false">View All</a draggable="false">View All</a
> >
{/if} {/if}
</div> </div>
<div class="flex flex-row flex-wrap gap-4"> <div class="flex flex-row flex-wrap gap-4">
{#each people as person (person.id)} {#each people as person (person.id)}
<a href="/people/{person.id}" class="w-24 text-center"> <a href="/people/{person.id}" class="w-24 text-center">
<ImageThumbnail <ImageThumbnail
circle circle
shadow shadow
url={api.getPeopleThumbnailUrl(person.id)} url={api.getPeopleThumbnailUrl(person.id)}
altText={person.name} altText={person.name}
widthStyle="100%" widthStyle="100%"
/> />
<p class="font-medium mt-2 text-ellipsis text-sm dark:text-white">{person.name}</p> <p class="font-medium mt-2 text-ellipsis text-sm dark:text-white">{person.name}</p>
</a> </a>
{/each} {/each}
</div> </div>
</div> </div>
{/if} {/if}
{#if places.length > 0} {#if places.length > 0}
<div class="mb-6 mt-2"> <div class="mb-6 mt-2">
<div> <div>
<p class="mb-4 dark:text-immich-dark-fg font-medium">Places</p> <p class="mb-4 dark:text-immich-dark-fg font-medium">Places</p>
</div> </div>
<div class="flex flex-row flex-wrap gap-4"> <div class="flex flex-row flex-wrap gap-4">
{#each places as item} {#each places as item}
<a class="relative" href="/search?{Field.CITY}={item.value}" draggable="false"> <a class="relative" href="/search?{Field.CITY}={item.value}" draggable="false">
<div <div
class="filter brightness-75 rounded-xl overflow-hidden w-[calc((100vw-(72px+5rem))/2)] max-w-[156px] flex justify-center" class="filter brightness-75 rounded-xl overflow-hidden w-[calc((100vw-(72px+5rem))/2)] max-w-[156px] flex justify-center"
> >
<Thumbnail thumbnailSize={156} asset={item.data} readonly /> <Thumbnail thumbnailSize={156} asset={item.data} readonly/>
</div> </div>
<span <span
class="capitalize absolute bottom-2 w-full text-center text-sm font-medium text-white text-ellipsis w-100 px-1 hover:cursor-pointer backdrop-blur-[1px]" class="capitalize absolute bottom-2 w-full text-center text-sm font-medium text-white text-ellipsis w-100 px-1 hover:cursor-pointer backdrop-blur-[1px]"
> >
{item.value} {item.value}
</span> </span>
</a> </a>
{/each} {/each}
</div> </div>
</div> </div>
{/if} {/if}
{#if things.length > 0} {#if things.length > 0}
<div class="mb-6 mt-2"> <div class="mb-6 mt-2">
<div> <div>
<p class="mb-4 dark:text-immich-dark-fg font-medium">Things</p> <p class="mb-4 dark:text-immich-dark-fg font-medium">Things</p>
</div> </div>
<div class="flex flex-row flex-wrap gap-4"> <div class="flex flex-row flex-wrap gap-4">
{#each things as item} {#each things as item}
<a class="relative" href="/search?{Field.OBJECTS}={item.value}" draggable="false"> <a class="relative" href="/search?{Field.OBJECTS}={item.value}" draggable="false">
<div <div
class="filter brightness-75 rounded-xl overflow-hidden w-[calc((100vw-(72px+5rem))/2)] max-w-[156px] justify-center flex" class="filter brightness-75 rounded-xl overflow-hidden w-[calc((100vw-(72px+5rem))/2)] max-w-[156px] justify-center flex"
> >
<Thumbnail thumbnailSize={156} asset={item.data} readonly /> <Thumbnail thumbnailSize={156} asset={item.data} readonly/>
</div> </div>
<span <span
class="capitalize absolute bottom-2 w-full text-center text-sm font-medium text-white text-ellipsis w-100 px-1 hover:cursor-pointer backdrop-blur-[1px]" class="capitalize absolute bottom-2 w-full text-center text-sm font-medium text-white text-ellipsis w-100 px-1 hover:cursor-pointer backdrop-blur-[1px]"
> >
{item.value} {item.value}
</span> </span>
</a> </a>
{/each} {/each}
</div> </div>
</div> </div>
{/if} {/if}
<hr class="dark:border-immich-dark-gray mb-4" /> <hr class="dark:border-immich-dark-gray mb-4"/>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-8"> <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-8">
<div class="flex flex-col gap-6 dark:text-immich-dark-fg"> <div class="flex flex-col gap-6 dark:text-immich-dark-fg">
<p class="text-sm">YOUR ACTIVITY</p> <p class="text-sm">YOUR ACTIVITY</p>
<div class="flex flex-col gap-4 dark:text-immich-dark-fg/80"> <div class="flex flex-col gap-4 dark:text-immich-dark-fg/80">
<a <a
href={AppRoute.FAVORITES} href={AppRoute.FAVORITES}
class="w-full flex text-sm font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary content-center gap-2" class="w-full flex text-sm font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary content-center gap-2"
draggable="false" draggable="false"
> >
<HeartMultipleOutline size={24} /> <HeartMultipleOutline size={24}/>
<span>Favorites</span> <span>Favorites</span>
</a> </a>
<a <a
href="/search?recent=true" href="/search?recent=true"
class="w-full flex text-sm font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary content-center gap-2" class="w-full flex text-sm font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary content-center gap-2"
draggable="false" draggable="false"
> >
<ClockOutline size={24} /> <ClockOutline size={24}/>
<span>Recently added</span> <span>Recently added</span>
</a> </a>
</div> </div>
</div> </div>
<div class="flex flex-col gap-6 dark:text-immich-dark-fg"> <div class="flex flex-col gap-6 dark:text-immich-dark-fg">
<p class="text-sm">CATEGORIES</p> <p class="text-sm">CATEGORIES</p>
<div class="flex flex-col gap-4 dark:text-immich-dark-fg/80"> <div class="flex flex-col gap-4 dark:text-immich-dark-fg/80">
<a <a
href="/search?type={AssetTypeEnum.Video}" href="/search?type={AssetTypeEnum.Video}"
class="w-full flex text-sm font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary items-center gap-2" class="w-full flex text-sm font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary items-center gap-2"
> >
<PlayCircleOutline size={24} /> <PlayCircleOutline size={24}/>
<span>Videos</span> <span>Videos</span>
</a> </a>
<div> <div>
<a <a
href="/search?motion=true" href="/search?motion=true"
class="w-full flex text-sm font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary items-center gap-2" class="w-full flex text-sm font-medium hover:text-immich-primary dark:hover:text-immich-dark-primary items-center gap-2"
> >
<MotionPlayOutline size={24} /> <MotionPlayOutline size={24}/>
<span>Motion photos</span> <span>Motion photos</span>
</a> </a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</UserPageLayout> </UserPageLayout>

View file

@ -1,81 +1,81 @@
<script lang="ts"> <script lang="ts">
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte'; import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte'; import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte';
import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte'; import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte';
import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte'; import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte';
import DeleteAssets from '$lib/components/photos-page/actions/delete-assets.svelte'; import DeleteAssets from '$lib/components/photos-page/actions/delete-assets.svelte';
import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte'; import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte';
import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte'; import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte';
import AssetSelectContextMenu from '$lib/components/photos-page/asset-select-context-menu.svelte'; import AssetSelectContextMenu from '$lib/components/photos-page/asset-select-context-menu.svelte';
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte'; import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte'; import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte'; import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import SelectAll from 'svelte-material-icons/SelectAll.svelte'; import SelectAll from 'svelte-material-icons/SelectAll.svelte';
import {handleError} from '$lib/utils/handle-error'; import {handleError} from '$lib/utils/handle-error';
import {api, AssetResponseDto} from '@api'; import {api, AssetResponseDto} from '@api';
import {onMount} from 'svelte'; import {onMount} from 'svelte';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte'; import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
import Plus from 'svelte-material-icons/Plus.svelte'; import Plus from 'svelte-material-icons/Plus.svelte';
import Error from '../../+error.svelte'; import Error from '../../+error.svelte';
import type {PageData} from './$types'; import type {PageData} from './$types';
let favorites: AssetResponseDto[] = []; let favorites: AssetResponseDto[] = [];
let selectedAssets: Set<AssetResponseDto> = new Set(); let selectedAssets: Set<AssetResponseDto> = new Set();
export let data: PageData; export let data: PageData;
$: isMultiSelectionMode = selectedAssets.size > 0; $: isMultiSelectionMode = selectedAssets.size > 0;
$: isAllArchive = Array.from(selectedAssets).every((asset) => asset.isArchived); $: isAllArchive = Array.from(selectedAssets).every((asset) => asset.isArchived);
onMount(async () => { onMount(async () => {
try { try {
const {data: assets} = await api.assetApi.getAllAssets({ const {data: assets} = await api.assetApi.getAllAssets({
isFavorite: true, isFavorite: true,
withoutThumbs: true withoutThumbs: true
}); });
favorites = assets; favorites = assets;
} catch { } catch {
handleError(Error, 'Unable to load favorites'); handleError(Error, 'Unable to load favorites');
} }
}); });
const handleSelectAll = () => { const handleSelectAll = () => {
selectedAssets = new Set(favorites); selectedAssets = new Set(favorites);
}; };
const onAssetDelete = (assetId: string) => { const onAssetDelete = (assetId: string) => {
favorites = favorites.filter((a) => a.id !== assetId); favorites = favorites.filter((a) => a.id !== assetId);
}; };
</script> </script>
<!-- Multiselection mode app bar --> <!-- Multiselection mode app bar -->
{#if isMultiSelectionMode} {#if isMultiSelectionMode}
<AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}> <AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}>
<FavoriteAction removeFavorite onAssetFavorite={(asset) => onAssetDelete(asset.id)}/> <FavoriteAction removeFavorite onAssetFavorite={(asset) => onAssetDelete(asset.id)}/>
<CreateSharedLink/> <CreateSharedLink/>
<CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll}/> <CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll}/>
<AssetSelectContextMenu icon={Plus} title="Add"> <AssetSelectContextMenu icon={Plus} title="Add">
<AddToAlbum/> <AddToAlbum/>
<AddToAlbum shared/> <AddToAlbum shared/>
</AssetSelectContextMenu> </AssetSelectContextMenu>
<DeleteAssets {onAssetDelete}/> <DeleteAssets {onAssetDelete}/>
<AssetSelectContextMenu icon={DotsVertical} title="Menu"> <AssetSelectContextMenu icon={DotsVertical} title="Menu">
<DownloadAction menuItem/> <DownloadAction menuItem/>
<ArchiveAction menuItem unarchive={isAllArchive}/> <ArchiveAction menuItem unarchive={isAllArchive}/>
</AssetSelectContextMenu> </AssetSelectContextMenu>
</AssetSelectControlBar> </AssetSelectControlBar>
{/if} {/if}
<UserPageLayout user={data.user} hideNavbar={isMultiSelectionMode} title={data.meta.title}> <UserPageLayout user={data.user} hideNavbar={isMultiSelectionMode} title={data.meta.title}>
<section> <section>
<!-- Empty Message --> <!-- Empty Message -->
{#if favorites.length === 0} {#if favorites.length === 0}
<EmptyPlaceholder <EmptyPlaceholder
text="Add favorites to quickly find your best pictures and videos" text="Add favorites to quickly find your best pictures and videos"
alt="Empty favorites" alt="Empty favorites"
/> />
{/if} {/if}
<GalleryViewer assets={favorites} bind:selectedAssets viewFrom="favorites-page"/> <GalleryViewer assets={favorites} bind:selectedAssets viewFrom="favorites-page"/>
</section> </section>
</UserPageLayout> </UserPageLayout>

View file

@ -1,134 +1,134 @@
<script lang="ts"> <script lang="ts">
import {afterNavigate, goto} from '$app/navigation'; import {afterNavigate, goto} from '$app/navigation';
import {page} from '$app/stores'; import {page} from '$app/stores';
import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte'; import ImageThumbnail from '$lib/components/assets/thumbnail/image-thumbnail.svelte';
import EditNameInput from '$lib/components/faces-page/edit-name-input.svelte'; import EditNameInput from '$lib/components/faces-page/edit-name-input.svelte';
import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte'; import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte';
import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte'; import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte';
import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte'; import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte';
import DeleteAssets from '$lib/components/photos-page/actions/delete-assets.svelte'; import DeleteAssets from '$lib/components/photos-page/actions/delete-assets.svelte';
import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte'; import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte';
import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte'; import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte';
import AssetSelectContextMenu from '$lib/components/photos-page/asset-select-context-menu.svelte'; import AssetSelectContextMenu from '$lib/components/photos-page/asset-select-context-menu.svelte';
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte'; import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte'; import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
import SelectAll from 'svelte-material-icons/SelectAll.svelte'; import SelectAll from 'svelte-material-icons/SelectAll.svelte';
import {AppRoute} from '$lib/constants'; import {AppRoute} from '$lib/constants';
import {handleError} from '$lib/utils/handle-error'; import {handleError} from '$lib/utils/handle-error';
import {AssetResponseDto, api} from '@api'; import {AssetResponseDto, api} from '@api';
import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte'; import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte'; import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
import Plus from 'svelte-material-icons/Plus.svelte'; import Plus from 'svelte-material-icons/Plus.svelte';
import type {PageData} from './$types'; import type {PageData} from './$types';
import {archivedAsset} from "$lib/stores/archived-asset.store"; import {archivedAsset} from "$lib/stores/archived-asset.store";
import CircleIconButton from "$lib/components/elements/buttons/circle-icon-button.svelte"; import CircleIconButton from "$lib/components/elements/buttons/circle-icon-button.svelte";
export let data: PageData; export let data: PageData;
let isEditName = false; let isEditName = false;
let previousRoute: string = AppRoute.EXPLORE; let previousRoute: string = AppRoute.EXPLORE;
let selectedAssets: Set<AssetResponseDto> = new Set(); let selectedAssets: Set<AssetResponseDto> = new Set();
$: isMultiSelectionMode = selectedAssets.size > 0; $: isMultiSelectionMode = selectedAssets.size > 0;
$: isAllArchive = Array.from(selectedAssets).every((asset) => asset.isArchived); $: isAllArchive = Array.from(selectedAssets).every((asset) => asset.isArchived);
$: isAllFavorite = Array.from(selectedAssets).every((asset) => asset.isFavorite); $: isAllFavorite = Array.from(selectedAssets).every((asset) => asset.isFavorite);
afterNavigate(({from}) => { afterNavigate(({from}) => {
// Prevent setting previousRoute to the current page. // Prevent setting previousRoute to the current page.
if (from && from.route.id !== $page.route.id) { if (from && from.route.id !== $page.route.id) {
previousRoute = from.url.href; previousRoute = from.url.href;
} }
}); });
const handleNameChange = async (name: string) => { const handleNameChange = async (name: string) => {
try { try {
isEditName = false; isEditName = false;
data.person.name = name; data.person.name = name;
await api.personApi.updatePerson({id: data.person.id, personUpdateDto: {name}}); await api.personApi.updatePerson({id: data.person.id, personUpdateDto: {name}});
} catch (error) { } catch (error) {
handleError(error, 'Unable to save name'); handleError(error, 'Unable to save name');
} }
}; };
const onAssetDelete = (assetId: string) => { const onAssetDelete = (assetId: string) => {
data.assets = data.assets.filter((asset: AssetResponseDto) => asset.id !== assetId); data.assets = data.assets.filter((asset: AssetResponseDto) => asset.id !== assetId);
}; };
const handleSelectAll = () => { const handleSelectAll = () => {
selectedAssets = new Set(data.assets) selectedAssets = new Set(data.assets)
} }
</script> </script>
{#if isMultiSelectionMode} {#if isMultiSelectionMode}
<AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}> <AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}>
<CreateSharedLink/> <CreateSharedLink/>
<CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll}/> <CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll}/>
<AssetSelectContextMenu icon={Plus} title="Add"> <AssetSelectContextMenu icon={Plus} title="Add">
<AddToAlbum/> <AddToAlbum/>
<AddToAlbum shared/> <AddToAlbum shared/>
</AssetSelectContextMenu> </AssetSelectContextMenu>
<DeleteAssets {onAssetDelete}/> <DeleteAssets {onAssetDelete}/>
<AssetSelectContextMenu icon={DotsVertical} title="Add"> <AssetSelectContextMenu icon={DotsVertical} title="Add">
<DownloadAction menuItem/> <DownloadAction menuItem/>
<FavoriteAction menuItem removeFavorite={isAllFavorite}/> <FavoriteAction menuItem removeFavorite={isAllFavorite}/>
<ArchiveAction <ArchiveAction
menuItem menuItem
unarchive={isAllArchive} unarchive={isAllArchive}
onAssetArchive={(asset) => onAssetDelete(asset.id)} onAssetArchive={(asset) => onAssetDelete(asset.id)}
/> />
</AssetSelectContextMenu> </AssetSelectContextMenu>
</AssetSelectControlBar> </AssetSelectControlBar>
{:else} {:else}
<ControlAppBar <ControlAppBar
showBackButton showBackButton
backIcon={ArrowLeft} backIcon={ArrowLeft}
on:close-button-click={() => goto(previousRoute)} on:close-button-click={() => goto(previousRoute)}
/> />
{/if} {/if}
<!-- Face information block --> <!-- Face information block -->
<section class="pt-24 px-4 sm:px-6 flex place-items-center"> <section class="pt-24 px-4 sm:px-6 flex place-items-center">
{#if isEditName} {#if isEditName}
<EditNameInput <EditNameInput
person={data.person} person={data.person}
on:change={(event) => handleNameChange(event.detail)} on:change={(event) => handleNameChange(event.detail)}
on:cancel={() => (isEditName = false)} on:cancel={() => (isEditName = false)}
/> />
{:else} {:else}
<ImageThumbnail <ImageThumbnail
circle circle
shadow shadow
url={api.getPeopleThumbnailUrl(data.person.id)} url={api.getPeopleThumbnailUrl(data.person.id)}
altText={data.person.name} altText={data.person.name}
widthStyle="3.375rem" widthStyle="3.375rem"
heightStyle="3.375rem" heightStyle="3.375rem"
/> />
<button <button
title="Edit name" title="Edit name"
class="px-4 text-immich-primary dark:text-immich-dark-primary" class="px-4 text-immich-primary dark:text-immich-dark-primary"
on:click={() => (isEditName = true)} on:click={() => (isEditName = true)}
> >
{#if data.person.name} {#if data.person.name}
<p class="font-medium py-2">{data.person.name}</p> <p class="font-medium py-2">{data.person.name}</p>
{:else} {:else}
<p class="font-medium w-fit">Add a name</p> <p class="font-medium w-fit">Add a name</p>
<p class="text-sm text-gray-500 dark:text-immich-gray"> <p class="text-sm text-gray-500 dark:text-immich-gray">
Find them fast by name with search Find them fast by name with search
</p> </p>
{/if} {/if}
</button> </button>
{/if} {/if}
</section> </section>
<!-- Gallery Block --> <!-- Gallery Block -->
<section class="relative pt-8 sm:px-4 mb-12 bg-immich-bg dark:bg-immich-dark-bg"> <section class="relative pt-8 sm:px-4 mb-12 bg-immich-bg dark:bg-immich-dark-bg">
<section class="overflow-y-auto relative immich-scrollbar"> <section class="overflow-y-auto relative immich-scrollbar">
<section id="search-content" class="relative bg-immich-bg dark:bg-immich-dark-bg"> <section id="search-content" class="relative bg-immich-bg dark:bg-immich-dark-bg">
<GalleryViewer <GalleryViewer
assets={data.assets} assets={data.assets}
viewFrom="search-page" viewFrom="search-page"
showArchiveIcon={true} showArchiveIcon={true}
bind:selectedAssets bind:selectedAssets
/> />
</section>
</section> </section>
</section>
</section> </section>

View file

@ -1,105 +1,105 @@
<script lang="ts"> <script lang="ts">
import {afterNavigate, goto} from '$app/navigation'; import {afterNavigate, goto} from '$app/navigation';
import {page} from '$app/stores'; import {page} from '$app/stores';
import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte'; import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte';
import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte'; import ArchiveAction from '$lib/components/photos-page/actions/archive-action.svelte';
import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte'; import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte';
import DeleteAssets from '$lib/components/photos-page/actions/delete-assets.svelte'; import DeleteAssets from '$lib/components/photos-page/actions/delete-assets.svelte';
import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte'; import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte';
import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte'; import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte';
import AssetSelectContextMenu from '$lib/components/photos-page/asset-select-context-menu.svelte'; import AssetSelectContextMenu from '$lib/components/photos-page/asset-select-context-menu.svelte';
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte'; import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte'; import ControlAppBar from '$lib/components/shared-components/control-app-bar.svelte';
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte'; import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
import SearchBar from '$lib/components/shared-components/search-bar/search-bar.svelte'; import SearchBar from '$lib/components/shared-components/search-bar/search-bar.svelte';
import type {AssetResponseDto} from '@api'; import type {AssetResponseDto} from '@api';
import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte'; import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte'; import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
import ImageOffOutline from 'svelte-material-icons/ImageOffOutline.svelte'; import ImageOffOutline from 'svelte-material-icons/ImageOffOutline.svelte';
import Plus from 'svelte-material-icons/Plus.svelte'; import Plus from 'svelte-material-icons/Plus.svelte';
import type {PageData} from './$types'; import type {PageData} from './$types';
import SelectAll from 'svelte-material-icons/SelectAll.svelte'; import SelectAll from 'svelte-material-icons/SelectAll.svelte';
import CircleIconButton from "$lib/components/elements/buttons/circle-icon-button.svelte"; import CircleIconButton from "$lib/components/elements/buttons/circle-icon-button.svelte";
export let data: PageData; export let data: PageData;
// The GalleryViewer pushes it's own history state, which causes weird // The GalleryViewer pushes it's own history state, which causes weird
// behavior for history.back(). To prevent that we store the previous page // behavior for history.back(). To prevent that we store the previous page
// manually and navigate back to that. // manually and navigate back to that.
let previousRoute = '/explore'; let previousRoute = '/explore';
afterNavigate(({from}) => { afterNavigate(({from}) => {
// Prevent setting previousRoute to the current page. // Prevent setting previousRoute to the current page.
if (from && from.route.id !== $page.route.id) { if (from && from.route.id !== $page.route.id) {
previousRoute = from.url.href; previousRoute = from.url.href;
} }
}); });
$: term = $page.url.searchParams.get('q') || data.term || ''; $: term = $page.url.searchParams.get('q') || data.term || '';
let selectedAssets: Set<AssetResponseDto> = new Set(); let selectedAssets: Set<AssetResponseDto> = new Set();
$: isMultiSelectionMode = selectedAssets.size > 0; $: isMultiSelectionMode = selectedAssets.size > 0;
$: isAllArchived = Array.from(selectedAssets).every((asset) => asset.isArchived); $: isAllArchived = Array.from(selectedAssets).every((asset) => asset.isArchived);
$: isAllFavorite = Array.from(selectedAssets).every((asset) => asset.isFavorite); $: isAllFavorite = Array.from(selectedAssets).every((asset) => asset.isFavorite);
$: searchResultAssets = data.results.assets.items; $: searchResultAssets = data.results.assets.items;
const onAssetDelete = (assetId: string) => { const onAssetDelete = (assetId: string) => {
searchResultAssets = searchResultAssets.filter((a: AssetResponseDto) => a.id !== assetId); searchResultAssets = searchResultAssets.filter((a: AssetResponseDto) => a.id !== assetId);
}; };
const handleSelectAll = () => { const handleSelectAll = () => {
selectedAssets = new Set(searchResultAssets) selectedAssets = new Set(searchResultAssets)
} }
</script> </script>
<section> <section>
{#if isMultiSelectionMode} {#if isMultiSelectionMode}
<AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}> <AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}>
<CreateSharedLink/> <CreateSharedLink/>
<CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll}/> <CircleIconButton title="Select all" logo={SelectAll} on:click={handleSelectAll}/>
<AssetSelectContextMenu icon={Plus} title="Add"> <AssetSelectContextMenu icon={Plus} title="Add">
<AddToAlbum/> <AddToAlbum/>
<AddToAlbum shared/> <AddToAlbum shared/>
</AssetSelectContextMenu> </AssetSelectContextMenu>
<DeleteAssets {onAssetDelete}/> <DeleteAssets {onAssetDelete}/>
<AssetSelectContextMenu icon={DotsVertical} title="Add"> <AssetSelectContextMenu icon={DotsVertical} title="Add">
<DownloadAction menuItem/> <DownloadAction menuItem/>
<FavoriteAction menuItem removeFavorite={isAllFavorite}/> <FavoriteAction menuItem removeFavorite={isAllFavorite}/>
<ArchiveAction menuItem unarchive={isAllArchived}/> <ArchiveAction menuItem unarchive={isAllArchived}/>
</AssetSelectContextMenu> </AssetSelectContextMenu>
</AssetSelectControlBar> </AssetSelectControlBar>
{:else} {:else}
<ControlAppBar on:close-button-click={() => goto(previousRoute)} backIcon={ArrowLeft}> <ControlAppBar on:close-button-click={() => goto(previousRoute)} backIcon={ArrowLeft}>
<div class="w-full max-w-2xl flex-1 pl-4"> <div class="w-full max-w-2xl flex-1 pl-4">
<SearchBar grayTheme={false} value={term}/> <SearchBar grayTheme={false} value={term}/>
</div> </div>
</ControlAppBar> </ControlAppBar>
{/if} {/if}
</section> </section>
<section class="relative pt-32 mb-12 bg-immich-bg dark:bg-immich-dark-bg"> <section class="relative pt-32 mb-12 bg-immich-bg dark:bg-immich-dark-bg">
<section class="overflow-y-auto relative immich-scrollbar"> <section class="overflow-y-auto relative immich-scrollbar">
<section id="search-content" class="relative bg-immich-bg dark:bg-immich-dark-bg"> <section id="search-content" class="relative bg-immich-bg dark:bg-immich-dark-bg">
{#if data.results?.assets?.items.length > 0} {#if data.results?.assets?.items.length > 0}
<div class="pl-4"> <div class="pl-4">
<GalleryViewer <GalleryViewer
assets={searchResultAssets} assets={searchResultAssets}
bind:selectedAssets bind:selectedAssets
viewFrom="search-page" viewFrom="search-page"
showArchiveIcon={true} showArchiveIcon={true}
/> />
</div> </div>
{:else} {:else}
<div <div
class="flex items-center place-content-center w-full min-h-[calc(66vh_-_11rem)] dark:text-white" class="flex items-center place-content-center w-full min-h-[calc(66vh_-_11rem)] dark:text-white"
> >
<div class="flex flex-col content-center items-center text-center"> <div class="flex flex-col content-center items-center text-center">
<ImageOffOutline size="3.5em"/> <ImageOffOutline size="3.5em"/>
<p class="font-medium text-3xl mt-5">No results</p> <p class="font-medium text-3xl mt-5">No results</p>
<p class="text-base font-normal">Try a synonym or more general keyword</p> <p class="text-base font-normal">Try a synonym or more general keyword</p>
</div> </div>
</div> </div>
{/if} {/if}
</section>
</section> </section>
</section>
</section> </section>