1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-23 02:06:15 +02:00

feat(web): empty external library placeholder (#7848)

This commit is contained in:
Jason Rasmussen 2024-03-11 11:29:21 -04:00 committed by GitHub
parent ae34e4f59f
commit a41ffb5131
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,9 +1,10 @@
<script lang="ts"> <script lang="ts">
import Button from '$lib/components/elements/buttons/button.svelte';
import Icon from '$lib/components/elements/icon.svelte'; import Icon from '$lib/components/elements/icon.svelte';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import LibraryImportPathsForm from '$lib/components/forms/library-import-paths-form.svelte'; import LibraryImportPathsForm from '$lib/components/forms/library-import-paths-form.svelte';
import LibraryRenameForm from '$lib/components/forms/library-rename-form.svelte'; import LibraryRenameForm from '$lib/components/forms/library-rename-form.svelte';
import LibraryScanSettingsForm from '$lib/components/forms/library-scan-settings-form.svelte'; import LibraryScanSettingsForm from '$lib/components/forms/library-scan-settings-form.svelte';
import LibraryUserPickerForm from '$lib/components/forms/library-user-picker-form.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte'; import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte'; import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
import ContextMenu from '$lib/components/shared-components/context-menu/context-menu.svelte'; import ContextMenu from '$lib/components/shared-components/context-menu/context-menu.svelte';
@ -18,25 +19,25 @@
import { getContextMenuPosition } from '$lib/utils/context-menu'; import { getContextMenuPosition } from '$lib/utils/context-menu';
import { handleError } from '$lib/utils/handle-error'; import { handleError } from '$lib/utils/handle-error';
import { import {
LibraryType,
createLibrary, createLibrary,
deleteLibrary, deleteLibrary,
getAllLibraries,
getLibraryStatistics, getLibraryStatistics,
getUserById,
LibraryType,
removeOfflineFiles, removeOfflineFiles,
scanLibrary, scanLibrary,
updateLibrary, updateLibrary,
type CreateLibraryDto,
type LibraryResponseDto, type LibraryResponseDto,
type LibraryStatsResponseDto, type LibraryStatsResponseDto,
getAllLibraries,
type UserResponseDto, type UserResponseDto,
getUserById,
type CreateLibraryDto,
} from '@immich/sdk'; } from '@immich/sdk';
import { mdiDatabase, mdiDotsVertical, mdiUpload } from '@mdi/js'; import { mdiDatabase, mdiDotsVertical, mdiPlusBoxOutline, mdiSync, mdiUpload } from '@mdi/js';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { fade, slide } from 'svelte/transition'; import { fade, slide } from 'svelte/transition';
import LinkButton from '../../../lib/components/elements/buttons/link-button.svelte';
import type { PageData } from './$types'; import type { PageData } from './$types';
import LibraryUserPickerForm from '$lib/components/forms/library-user-picker-form.svelte';
export let data: PageData; export let data: PageData;
@ -320,6 +321,22 @@
{/if} {/if}
<UserPageLayout title={data.meta.title} admin> <UserPageLayout title={data.meta.title} admin>
<div class="flex justify-end gap-2" slot="buttons">
{#if libraries.length > 0}
<LinkButton on:click={() => handleScanAll()}>
<div class="flex gap-1 text-sm">
<Icon path={mdiSync} size="18" />
<span>Scan All Libraries</span>
</div>
</LinkButton>
{/if}
<LinkButton on:click={() => (toCreateLibrary = true)}>
<div class="flex gap-1 text-sm">
<Icon path={mdiPlusBoxOutline} size="18" />
<span>Create Library</span>
</div>
</LinkButton>
</div>
<section class="my-4"> <section class="my-4">
<div class="flex flex-col gap-2" in:fade={{ duration: 500 }}> <div class="flex flex-col gap-2" in:fade={{ duration: 500 }}>
{#if libraries.length > 0} {#if libraries.length > 0}
@ -440,11 +457,15 @@
{/each} {/each}
</tbody> </tbody>
</table> </table>
<!-- Empty message -->
{:else}
<EmptyPlaceholder
text="Create an external library to view your photos and videos"
actionHandler={() => (toCreateLibrary = true)}
alt="Empty albums"
/>
{/if} {/if}
<div class="my-2 flex justify-end gap-2">
<Button size="sm" on:click={() => handleScanAll()}>Scan All Libraries</Button>
<Button size="sm" on:click={() => (toCreateLibrary = true)}>Create Library</Button>
</div>
</div> </div>
</section> </section>
</UserPageLayout> </UserPageLayout>