From c754c53906ff401fb0b8a11258704b3de4c9f0bb Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 26 Sep 2024 04:05:28 +0200 Subject: [PATCH] refac --- .../components/layout/UpdateInfoToast.svelte | 2 +- src/routes/(app)/+layout.svelte | 21 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/lib/components/layout/UpdateInfoToast.svelte b/src/lib/components/layout/UpdateInfoToast.svelte index 266ed56dd..bb75de94f 100644 --- a/src/lib/components/layout/UpdateInfoToast.svelte +++ b/src/lib/components/layout/UpdateInfoToast.svelte @@ -14,7 +14,7 @@
{$i18n.t(`A new version (v{{LATEST_VERSION}}) is now available.`, { diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 794e6c383..ad2f085cf 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -46,6 +46,7 @@ import { compareVersion } from '$lib/utils'; import UpdateInfoToast from '$lib/components/layout/UpdateInfoToast.svelte'; + import { fade } from 'svelte/transition'; const i18n = getContext('i18n'); @@ -53,6 +54,8 @@ let DB = null; let localDBChats = []; + let version; + const getModels = async () => { return _getModels(localStorage.token); }; @@ -216,28 +219,24 @@ }); const checkForVersionUpdates = async () => { - const version = await getVersionUpdates(localStorage.token).catch((error) => { + version = await getVersionUpdates(localStorage.token).catch((error) => { return { current: WEBUI_VERSION, latest: WEBUI_VERSION }; }); - - if (compareVersion(version.latest, version.current)) { - toast.custom(UpdateInfoToast, { - duration: Number.POSITIVE_INFINITY, - position: 'bottom-right', - componentProps: { - version - } - }); - } }; +{#if version && compareVersion(version.latest, version.current)} +
+ +
+{/if} +