mirror of
https://github.com/immich-app/immich.git
synced 2025-12-17 01:11:13 +03:00
chore(web): migration svelte 5 syntax (#13883)
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
import { afterNavigate, beforeNavigate } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import DownloadPanel from '$lib/components/asset-viewer/download-panel.svelte';
|
||||
@@ -16,23 +18,21 @@
|
||||
import { user } from '$lib/stores/user.store';
|
||||
import { closeWebsocketConnection, openWebsocketConnection } from '$lib/stores/websocket';
|
||||
import { copyToClipboard, setKey } from '$lib/utils';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import { onDestroy, onMount, type Snippet } from 'svelte';
|
||||
import '../app.css';
|
||||
import { isAssetViewerRoute, isSharedLinkRoute } from '$lib/utils/navigation';
|
||||
import DialogWrapper from '$lib/components/shared-components/dialog/dialog-wrapper.svelte';
|
||||
import { t } from 'svelte-i18n';
|
||||
import Error from '$lib/components/error.svelte';
|
||||
import { shortcut } from '$lib/actions/shortcut';
|
||||
|
||||
let showNavigationLoadingBar = false;
|
||||
$: changeTheme($colorTheme);
|
||||
|
||||
$: if ($user) {
|
||||
openWebsocketConnection();
|
||||
} else {
|
||||
closeWebsocketConnection();
|
||||
interface Props {
|
||||
children?: Snippet;
|
||||
}
|
||||
|
||||
let { children }: Props = $props();
|
||||
|
||||
let showNavigationLoadingBar = $state(false);
|
||||
|
||||
const changeTheme = (theme: ThemeSetting) => {
|
||||
if (theme.system) {
|
||||
theme.value = window.matchMedia('(prefers-color-scheme: dark)').matches ? Theme.DARK : Theme.LIGHT;
|
||||
@@ -82,6 +82,16 @@
|
||||
afterNavigate(() => {
|
||||
showNavigationLoadingBar = false;
|
||||
});
|
||||
run(() => {
|
||||
changeTheme($colorTheme);
|
||||
});
|
||||
run(() => {
|
||||
if ($user) {
|
||||
openWebsocketConnection();
|
||||
} else {
|
||||
closeWebsocketConnection();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -135,7 +145,7 @@
|
||||
{#if $page.data.error}
|
||||
<Error error={$page.data.error}></Error>
|
||||
{:else}
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
{/if}
|
||||
|
||||
{#if showNavigationLoadingBar}
|
||||
|
||||
Reference in New Issue
Block a user