feat(web): Update to latest version of SvelteKit (#705)

This commit is contained in:
Alex 2022-09-16 23:13:22 -05:00 committed by GitHub
parent 75c2067836
commit 0d13b25f56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 5522 additions and 2273 deletions

7744
web/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@
notificationController, notificationController,
NotificationType NotificationType
} from '../shared-components/notification/notification'; } from '../shared-components/notification/notification';
import { browser } from '$app/env'; import { browser } from '$app/environment';
import { albumAssetSelectionStore } from '$lib/stores/album-asset-selection.store'; import { albumAssetSelectionStore } from '$lib/stores/album-asset-selection.store';
export let album: AlbumResponseDto; export let album: AlbumResponseDto;
@ -69,9 +69,9 @@
$: isMultiSelectionMode = multiSelectAsset.size > 0; $: isMultiSelectionMode = multiSelectAsset.size > 0;
afterNavigate(({ from }) => { afterNavigate(({ from }) => {
backUrl = from?.pathname ?? '/albums'; backUrl = from?.url.pathname ?? '/albums';
if (from?.pathname === '/sharing') { if (from?.url.pathname === '/sharing') {
isCreatingSharedAlbum = true; isCreatingSharedAlbum = true;
} }
}); });

View file

@ -6,7 +6,7 @@
import MapMarkerOutline from 'svelte-material-icons/MapMarkerOutline.svelte'; import MapMarkerOutline from 'svelte-material-icons/MapMarkerOutline.svelte';
import moment from 'moment'; import moment from 'moment';
import { createEventDispatcher, onMount } from 'svelte'; import { createEventDispatcher, onMount } from 'svelte';
import { browser } from '$app/env'; import { browser } from '$app/environment';
import { env } from '$env/dynamic/public'; import { env } from '$env/dynamic/public';
import { AssetResponseDto, AlbumResponseDto } from '@api'; import { AssetResponseDto, AlbumResponseDto } from '@api';
@ -216,7 +216,7 @@
<p class="text-sm pb-4">APPEARS IN</p> <p class="text-sm pb-4">APPEARS IN</p>
{/if} {/if}
{#each albums as album} {#each albums as album}
<a sveltekit:prefetch href={`/albums/${album.id}`}> <a data-sveltekit-prefetch href={`/albums/${album.id}`}>
<div class="flex gap-4 py-2 hover:cursor-pointer" on:click={() => dispatch('click', album)}> <div class="flex gap-4 py-2 hover:cursor-pointer" on:click={() => dispatch('click', album)}>
<div> <div>
<img <img

View file

@ -3,7 +3,7 @@
import { quintOut } from 'svelte/easing'; import { quintOut } from 'svelte/easing';
import Close from 'svelte-material-icons/Close.svelte'; import Close from 'svelte-material-icons/Close.svelte';
import { createEventDispatcher, onMount, onDestroy } from 'svelte'; import { createEventDispatcher, onMount, onDestroy } from 'svelte';
import { browser } from '$app/env'; import { browser } from '$app/environment';
import CircleIconButton from './circle-icon-button.svelte'; import CircleIconButton from './circle-icon-button.svelte';
import { clickOutside } from '$lib/utils/click-outside'; import { clickOutside } from '$lib/utils/click-outside';

View file

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { browser } from '$app/env'; import { browser } from '$app/environment';
import { createEventDispatcher, onDestroy, onMount } from 'svelte'; import { createEventDispatcher, onDestroy, onMount } from 'svelte';
import Close from 'svelte-material-icons/Close.svelte'; import Close from 'svelte-material-icons/Close.svelte';

View file

@ -44,7 +44,11 @@
<section id="dashboard-navbar" class="fixed w-screen z-[100] bg-immich-bg text-sm"> <section id="dashboard-navbar" class="fixed w-screen z-[100] bg-immich-bg text-sm">
<div class="flex border-b place-items-center px-6 py-2 "> <div class="flex border-b place-items-center px-6 py-2 ">
<a sveltekit:prefetch class="flex gap-2 place-items-center hover:cursor-pointer" href="/photos"> <a
data-sveltekit-prefetch
class="flex gap-2 place-items-center hover:cursor-pointer"
href="/photos"
>
<img src="/immich-logo.svg" alt="immich logo" height="35" width="35" /> <img src="/immich-logo.svg" alt="immich logo" height="35" width="35" />
<h1 class="font-immich-title text-2xl text-immich-primary">IMMICH</h1> <h1 class="font-immich-title text-2xl text-immich-primary">IMMICH</h1>
</a> </a>
@ -67,7 +71,7 @@
{/if} {/if}
{#if user.isAdmin} {#if user.isAdmin}
<a sveltekit:prefetch href={`admin`}> <a data-sveltekit-prefetch href={`admin`}>
<button <button
class={`flex place-items-center place-content-center gap-2 hover:bg-immich-primary/5 p-2 rounded-lg font-medium ${ class={`flex place-items-center place-content-center gap-2 hover:bg-immich-primary/5 p-2 rounded-lg font-medium ${
$page.url.pathname == '/admin' && 'text-immich-primary underline' $page.url.pathname == '/admin' && 'text-immich-primary underline'

View file

@ -55,8 +55,8 @@
<section id="sidebar" class="flex flex-col gap-1 pt-8 pr-6"> <section id="sidebar" class="flex flex-col gap-1 pt-8 pr-6">
<!-- {domCount} --> <!-- {domCount} -->
<a <a
sveltekit:prefetch data-sveltekit-prefetch
sveltekit:noscroll data-sveltekit-noscroll
href={$page.routeId !== 'photos' ? `/photos` : null} href={$page.routeId !== 'photos' ? `/photos` : null}
class="relative" class="relative"
> >
@ -92,7 +92,11 @@
</div> </div>
</a> </a>
<a sveltekit:prefetch href={$page.routeId !== 'sharing' ? `/sharing` : null} class="relative"> <a
data-sveltekit-prefetch
href={$page.routeId !== 'sharing' ? `/sharing` : null}
class="relative"
>
<SideBarButton <SideBarButton
title="Sharing" title="Sharing"
logo={AccountMultipleOutline} logo={AccountMultipleOutline}
@ -126,7 +130,7 @@
<div class="text-xs ml-5 my-4"> <div class="text-xs ml-5 my-4">
<p>LIBRARY</p> <p>LIBRARY</p>
</div> </div>
<a sveltekit:prefetch href={$page.routeId !== 'albums' ? `/albums` : null} class="relative"> <a data-sveltekit-prefetch href={$page.routeId !== 'albums' ? `/albums` : null} class="relative">
<SideBarButton <SideBarButton
title="Albums" title="Albums"
logo={ImageAlbum} logo={ImageAlbum}

View file

@ -1,2 +1,2 @@
import { env } from '$env/dynamic/public'; import { env } from '$env/dynamic/public';
export const loginPageMessage: string = env.PUBLIC_LOGIN_PAGE_MESSAGE; export const loginPageMessage: string | undefined = env.PUBLIC_LOGIN_PAGE_MESSAGE;

View file

@ -7,12 +7,12 @@
<code class="text-xs text-red-500">Error code {$page.status}</code> <code class="text-xs text-red-500">Error code {$page.status}</code>
<br /> <br />
<code class="text-sm"> <code class="text-sm">
{$page.error.message} {$page.error?.message}
</code> </code>
<br /> <br />
<div class="mt-5"> <div class="mt-5">
<p class="text-sm font-medium">Verbose</p> <p class="text-sm font-medium">Verbose</p>
<pre class="text-xs">{Object.values($page.error)}</pre> <pre class="text-xs">{JSON.stringify($page.error)}</pre>
</div> </div>
<a <a

View file

@ -1,8 +1,8 @@
export const prerender = false; export const prerender = false;
import { redirect } from '@sveltejs/kit'; import { redirect } from '@sveltejs/kit';
import { api } from '@api'; import { api } from '@api';
import { browser } from '$app/env';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
import { browser } from '$app/environment';
export const load: PageLoad = async ({ parent }) => { export const load: PageLoad = async ({ parent }) => {
const { user } = await parent(); const { user } = await parent();

View file

@ -72,7 +72,7 @@
<div class="flex flex-wrap gap-8"> <div class="flex flex-wrap gap-8">
{#each $albums as album} {#each $albums as album}
{#key album.id} {#key album.id}
<a sveltekit:prefetch href={`albums/${album.id}`}> <a data-sveltekit-prefetch href={`albums/${album.id}`}>
<AlbumCard <AlbumCard
{album} {album}
on:showalbumcontextmenu={(e) => showAlbumContextMenu(e.detail, album)} on:showalbumcontextmenu={(e) => showAlbumContextMenu(e.detail, album)}

View file

@ -70,7 +70,7 @@
<!-- Share Album List --> <!-- Share Album List -->
<div class="w-full flex flex-col place-items-center"> <div class="w-full flex flex-col place-items-center">
{#each data.sharedAlbums as album} {#each data.sharedAlbums as album}
<a sveltekit:prefetch href={`albums/${album.id}`}> <a data-sveltekit-prefetch href={`albums/${album.id}`}>
<SharedAlbumListTile {album} user={data.user} /> <SharedAlbumListTile {album} user={data.user} />
</a> </a>
{/each} {/each}

View file

@ -6,10 +6,7 @@ const config = {
preprocess: preprocess(), preprocess: preprocess(),
kit: { kit: {
adapter: adapter({ out: 'build' }), adapter: adapter({ out: 'build' })
methodOverride: {
allowed: ['PATCH', 'DELETE']
}
} }
}; };