1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-26 10:50:29 +02:00

Added page navigation progress indicator

This commit is contained in:
Alex 2022-08-25 13:02:36 -07:00
parent e344503834
commit 658b64df74
No known key found for this signature in database
GPG Key ID: 53CD082B3A5E1082
4 changed files with 40 additions and 9 deletions

View File

@ -0,0 +1,18 @@
<script lang="ts">
import { onMount } from 'svelte';
import { cubicOut } from 'svelte/easing';
import { tweened } from 'svelte/motion';
const progress = tweened(0, {
duration: 1000,
easing: cubicOut
});
onMount(() => {
progress.set(90);
});
</script>
<div class="absolute top-0 left-0 w-screen h-[3px] bg-white z-[999999999]">
<span class="absolute bg-immich-primary h-[3px]" style:width={`${$progress}%`} />
</div>

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation';
import { AppSideBarSelection } from '$lib/models/admin-sidebar-selection'; import { AppSideBarSelection } from '$lib/models/admin-sidebar-selection';
import { onMount } from 'svelte'; import { onMount } from 'svelte';
@ -24,7 +23,7 @@
</script> </script>
<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">
<a sveltekit:prefetch href={$page.routeId != 'photos' ? `/photos` : null}> <a sveltekit:prefetch sveltekit:noscroll href={$page.routeId !== 'photos' ? `/photos` : null}>
<SideBarButton <SideBarButton
title="Photos" title="Photos"
logo={ImageOutline} logo={ImageOutline}
@ -32,7 +31,7 @@
isSelected={selectedAction === AppSideBarSelection.PHOTOS} isSelected={selectedAction === AppSideBarSelection.PHOTOS}
/></a /></a
> >
<a sveltekit:prefetch href={$page.routeId != 'sharing' ? `/sharing` : null}> <a sveltekit:prefetch href={$page.routeId !== 'sharing' ? `/sharing` : null}>
<SideBarButton <SideBarButton
title="Sharing" title="Sharing"
logo={AccountMultipleOutline} logo={AccountMultipleOutline}
@ -43,7 +42,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}> <a sveltekit:prefetch href={$page.routeId !== 'albums' ? `/albums` : null}>
<SideBarButton <SideBarButton
title="Albums" title="Albums"
logo={ImageAlbum} logo={ImageAlbum}

View File

@ -8,10 +8,13 @@
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { checkAppVersion } from '$lib/utils/check-app-version'; import { checkAppVersion } from '$lib/utils/check-app-version';
import { page } from '$app/stores'; import { page } from '$app/stores';
import { afterNavigate, beforeNavigate } from '$app/navigation';
import NavigationLoadingBar from '$lib/components/shared-components/navigation-loading-bar.svelte';
let shouldShowAnnouncement: boolean; let shouldShowAnnouncement: boolean;
let localVersion: string; let localVersion: string;
let remoteVersion: string; let remoteVersion: string;
let showNavigationLoadingBar = false;
onMount(async () => { onMount(async () => {
const res = await checkAppVersion(); const res = await checkAppVersion();
@ -20,11 +23,23 @@
localVersion = res.localVersion ?? 'unknown'; localVersion = res.localVersion ?? 'unknown';
remoteVersion = res.remoteVersion ?? 'unknown'; remoteVersion = res.remoteVersion ?? 'unknown';
}); });
beforeNavigate(() => {
showNavigationLoadingBar = true;
});
afterNavigate(() => {
showNavigationLoadingBar = false;
});
</script> </script>
<main> <main>
{#key $page.url} {#key $page.url}
<div in:fade={{ duration: 100 }}> <div in:fade={{ duration: 100 }}>
{#if showNavigationLoadingBar}
<NavigationLoadingBar />
{/if}
<slot /> <slot />
<DownloadPanel /> <DownloadPanel />

View File

@ -3,10 +3,6 @@
import { fade } from 'svelte/transition'; import { fade } from 'svelte/transition';
import LoginForm from '$lib/components/forms/login-form.svelte'; import LoginForm from '$lib/components/forms/login-form.svelte';
const onLoginSuccess = () => {
goto('/photos');
};
</script> </script>
<svelte:head> <svelte:head>
@ -15,6 +11,9 @@
<section class="h-screen w-screen flex place-items-center place-content-center"> <section class="h-screen w-screen flex place-items-center place-content-center">
<div in:fade={{ duration: 100 }} out:fade={{ duration: 100 }}> <div in:fade={{ duration: 100 }} out:fade={{ duration: 100 }}>
<LoginForm on:success={onLoginSuccess} on:first-login={() => goto('/auth/change-password')} /> <LoginForm
on:success={() => goto('/photos')}
on:first-login={() => goto('/auth/change-password')}
/>
</div> </div>
</section> </section>