feat: changelog modal auto popup

This commit is contained in:
Timothy J. Baek 2024-02-23 00:47:54 -08:00
parent a84070c6d3
commit 05aea9edf9
5 changed files with 25 additions and 17 deletions

View file

@ -1,10 +1,14 @@
<script lang="ts">
import Modal from './common/Modal.svelte';
import { Confetti } from 'svelte-confetti';
import { WEBUI_NAME, WEB_UI_VERSION } from '$lib/constants';
import { onMount } from 'svelte';
import { Confetti } from 'svelte-confetti';
import { config } from '$lib/stores';
import { WEBUI_NAME, WEB_UI_VERSION } from '$lib/constants';
import { getChangelog } from '$lib/apis';
import Modal from './common/Modal.svelte';
export let show = false;
let changelog = null;
@ -79,11 +83,12 @@
<div class="flex justify-end pt-3 text-sm font-medium">
<button
on:click={() => {
localStorage.version = $config.version;
show = false;
}}
class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded"
>
<span class="relative">Ok, let's go!</span>
<span class="relative">Okay, Let's Go!</span>
</button>
</div>
</div>

View file

@ -35,13 +35,13 @@
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class=" fixed top-0 right-0 left-0 bottom-0 bg-black/60 w-full min-h-screen h-screen flex justify-center z-50 overflow-hidden overscroll-contain"
transition:fade={{ duration: 50 }}
in:fade={{ duration: 10 }}
>
<div
class=" modal-content m-auto rounded-xl max-w-full {sizeToWidth(
size
)} mx-2 bg-gray-50 dark:bg-gray-900 shadow-3xl"
transition:fade={{ duration: 50 }}
in:fade={{ duration: 10 }}
on:click={(e) => {
e.stopPropagation();
}}

View file

@ -563,7 +563,7 @@
<div
id="dropdownDots"
class="absolute z-40 bottom-[70px] 4.5rem rounded-lg shadow w-[240px] bg-gray-900"
transition:slide={{ duration: 300 }}
in:slide={{ duration: 150 }}
>
<div class="py-2 w-full">
{#if $user.role === 'admin'}

View file

@ -32,3 +32,4 @@ export const documents = writable([
export const settings = writable({});
export const showSettings = writable(false);
export const showChangelog = writable(false);

View file

@ -1,17 +1,18 @@
<script lang="ts">
import toast from 'svelte-french-toast';
import { openDB, deleteDB } from 'idb';
import { onMount, tick } from 'svelte';
import { goto } from '$app/navigation';
import fileSaver from 'file-saver';
const { saveAs } = fileSaver;
import { onMount, tick } from 'svelte';
import { goto } from '$app/navigation';
import { getOllamaModels, getOllamaVersion } from '$lib/apis/ollama';
import { getModelfiles } from '$lib/apis/modelfiles';
import { getPrompts } from '$lib/apis/prompts';
import { getOpenAIModels } from '$lib/apis/openai';
import { getDocs } from '$lib/apis/documents';
import { getAllChatTags } from '$lib/apis/chats';
import {
user,
@ -21,16 +22,16 @@
modelfiles,
prompts,
documents,
tags
tags,
showChangelog,
config
} from '$lib/stores';
import { REQUIRED_OLLAMA_VERSION, WEBUI_API_BASE_URL } from '$lib/constants';
import { checkVersion } from '$lib/utils';
import SettingsModal from '$lib/components/chat/SettingsModal.svelte';
import Sidebar from '$lib/components/layout/Sidebar.svelte';
import { checkVersion } from '$lib/utils';
import ShortcutsModal from '$lib/components/chat/ShortcutsModal.svelte';
import { getDocs } from '$lib/apis/documents';
import { getAllChatTags } from '$lib/apis/chats';
import ChangelogModal from '$lib/components/ChangelogModal.svelte';
let ollamaVersion = '';
@ -183,6 +184,8 @@
}
});
showChangelog.set(localStorage.version !== $config.version);
await tick();
}
@ -349,8 +352,6 @@
</div>
</div>
</div>
{:else}
<ChangelogModal show={true} />
{/if}
<div
@ -358,6 +359,7 @@
>
<Sidebar />
<SettingsModal bind:show={$showSettings} />
<ChangelogModal bind:show={$showChangelog} />
<slot />
</div>
</div>