mirror of
https://github.com/immich-app/immich.git
synced 2025-01-19 18:26:46 +01:00
feat(web): go back on the onboarding (#6171)
* feat: go back on the onboarding * fix: state * rename variable
This commit is contained in:
parent
ba4a20a181
commit
4f6f79a392
2 changed files with 29 additions and 7 deletions
|
@ -28,7 +28,10 @@
|
||||||
|
|
||||||
<div class="flex gap-4 mb-6">
|
<div class="flex gap-4 mb-6">
|
||||||
<button
|
<button
|
||||||
class="w-1/2 aspect-square bg-immich-bg rounded-3xl transition-all shadow-sm hover:shadow-xl"
|
class="w-1/2 aspect-square bg-immich-bg rounded-3xl transition-all shadow-sm hover:shadow-xl {$colorTheme ==
|
||||||
|
'light'
|
||||||
|
? 'border-[3px] border-immich-dark-primary/80 border-immich-primary'
|
||||||
|
: 'border border-transparent'}"
|
||||||
on:click={toggleLightTheme}
|
on:click={toggleLightTheme}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -39,7 +42,9 @@
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
class="w-1/2 aspect-square bg-immich-dark-bg rounded-3xl border border-transparent"
|
class="w-1/2 aspect-square bg-immich-dark-bg rounded-3xl {$colorTheme == 'dark'
|
||||||
|
? 'border-[3px] border-immich-dark-primary/80 border-immich-primary'
|
||||||
|
: 'border border-transparent'}"
|
||||||
on:click={toggleDarkTheme}
|
on:click={toggleDarkTheme}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -5,21 +5,38 @@
|
||||||
import { api } from '@api';
|
import { api } from '@api';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
|
import { page } from '$app/stores';
|
||||||
|
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
|
||||||
let onboardingSteps = [OnboardingHello, OnboardingTheme, OnboadingStorageTemplate];
|
interface OnboardingStep {
|
||||||
|
name: string;
|
||||||
|
component: typeof OnboardingHello | typeof OnboardingTheme | typeof OnboadingStorageTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
let onboardingSteps: OnboardingStep[] = [
|
||||||
|
{ name: 'hello', component: OnboardingHello },
|
||||||
|
{ name: 'theme', component: OnboardingTheme },
|
||||||
|
{ name: 'storage', component: OnboadingStorageTemplate },
|
||||||
|
];
|
||||||
|
|
||||||
|
$: {
|
||||||
|
const stepState = $page.url.searchParams.get('step');
|
||||||
|
const tempIndex = onboardingSteps.findIndex((step) => step.name === stepState);
|
||||||
|
index = tempIndex >= 0 ? tempIndex : 0;
|
||||||
|
}
|
||||||
|
|
||||||
const handleDoneClicked = async () => {
|
const handleDoneClicked = async () => {
|
||||||
index++;
|
if (index >= onboardingSteps.length - 1) {
|
||||||
|
|
||||||
if (index >= onboardingSteps.length) {
|
|
||||||
await api.serverInfoApi.setAdminOnboarding();
|
await api.serverInfoApi.setAdminOnboarding();
|
||||||
goto(AppRoute.PHOTOS);
|
goto(AppRoute.PHOTOS);
|
||||||
|
} else {
|
||||||
|
index++;
|
||||||
|
goto(`${AppRoute.AUTH_ONBOARDING}?step=${onboardingSteps[index].name}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section id="onboarding-page" class="min-w-screen flex min-h-screen place-content-center place-items-center p-4">
|
<section id="onboarding-page" class="min-w-screen flex min-h-screen place-content-center place-items-center p-4">
|
||||||
<svelte:component this={onboardingSteps[index]} on:done={handleDoneClicked} />
|
<svelte:component this={onboardingSteps[index].component} on:done={handleDoneClicked} />
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Reference in a new issue