open-webui/src/lib/components/ChangelogModal.svelte

108 lines
2.9 KiB
Svelte
Raw Normal View History

2024-02-23 08:30:26 +00:00
<script lang="ts">
2024-02-23 08:47:54 +00:00
import { onMount } from 'svelte';
2024-02-23 08:30:26 +00:00
import { Confetti } from 'svelte-confetti';
2024-02-23 08:47:54 +00:00
import { config } from '$lib/stores';
2024-02-23 08:30:26 +00:00
import { WEBUI_NAME, WEB_UI_VERSION } from '$lib/constants';
import { getChangelog } from '$lib/apis';
2024-02-23 08:47:54 +00:00
import Modal from './common/Modal.svelte';
2024-02-23 08:30:26 +00:00
export let show = false;
let changelog = null;
onMount(async () => {
const res = await getChangelog();
changelog = res;
});
</script>
<Modal bind:show>
<div class="px-5 py-4 dark:text-gray-300">
<div class="flex justify-between items-start">
<div class="text-xl font-bold">
2024-02-23 08:59:48 +00:00
Whats New in {WEBUI_NAME}
2024-02-23 08:30:26 +00:00
<!-- <Confetti x={[-1, -0.25]} y={[0, 0.5]} /> -->
</div>
<button
class="self-center"
on:click={() => {
show = false;
}}
>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="w-5 h-5"
>
<path
d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
/>
</svg>
</button>
</div>
<div class=" pb-3 flex items-center mt-2">
<div class="text-sm dark:text-gray-200">Release Notes</div>
<div class="flex self-center w-[1px] h-6 mx-2.5 bg-gray-200 dark:bg-gray-700" />
<div class="text-sm dark:text-gray-200">
v{WEB_UI_VERSION}
</div>
</div>
<hr class=" dark:border-gray-800" />
<div class=" overflow-y-scroll max-h-80">
<div class="my-3">
{#if changelog}
{#each Object.keys(changelog) as version}
<div class="font-bold text-xl mb-1">
v{version} - {changelog[version].date}
</div>
{#each Object.keys(changelog[version]).filter((section) => section !== 'date') as section}
2024-02-23 08:59:48 +00:00
<div class="">
<div
class="font-bold capitalize text-xs {section === 'added'
? 'text-white bg-blue-500'
: section === 'fixed'
? 'text-white bg-green-500'
: section === 'changed'
? 'text-white bg-yellow-500'
: section === 'removed'
? 'text-white bg-red-500'
: ''} w-fit px-3 rounded-full my-3"
>
{section}
</div>
2024-02-23 08:30:26 +00:00
<div class="my-2">
{#each Object.keys(changelog[version][section]) as item}
<div class="text-sm mb-2">
<div class="font-semibold">
{changelog[version][section][item].title}
</div>
<div class="my-1.5">{changelog[version][section][item].content}</div>
</div>
{/each}
</div>
</div>
{/each}
{/each}
{/if}
</div>
</div>
<div class="flex justify-end pt-3 text-sm font-medium">
<button
on:click={() => {
2024-02-23 08:47:54 +00:00
localStorage.version = $config.version;
2024-02-23 08:30:26 +00:00
show = false;
}}
class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded"
>
2024-02-23 08:47:54 +00:00
<span class="relative">Okay, Let's Go!</span>
2024-02-23 08:30:26 +00:00
</button>
</div>
</div>
</Modal>