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

118 lines
3.3 KiB
Svelte
Raw Normal View History

2024-02-23 08:30:26 +00:00
<script lang="ts">
import { onMount, getContext } from 'svelte';
2024-02-23 08:30:26 +00:00
import { Confetti } from 'svelte-confetti';
2024-02-23 08:47:54 +00:00
2024-02-24 01:12:19 +00:00
import { WEBUI_NAME, config } from '$lib/stores';
2024-02-23 08:47:54 +00:00
2024-02-24 01:12:19 +00:00
import { WEBUI_VERSION } from '$lib/constants';
2024-02-23 08:30:26 +00:00
import { getChangelog } from '$lib/apis';
2024-02-23 08:47:54 +00:00
import Modal from './common/Modal.svelte';
const i18n = getContext('i18n');
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>
2024-05-06 23:29:57 +00:00
<div class="px-5 pt-4 dark:text-gray-300 text-gray-700">
2024-02-23 08:30:26 +00:00
<div class="flex justify-between items-start">
2024-07-08 20:35:25 +00:00
<div class="text-xl font-semibold">
2024-03-04 08:53:56 +00:00
{$i18n.t('Whats New in')}
{$WEBUI_NAME}
2024-02-23 09:18:30 +00:00
<Confetti x={[-1, -0.25]} y={[0, 0.5]} />
2024-02-23 08:30:26 +00:00
</div>
<button
class="self-center"
on:click={() => {
2024-04-16 21:01:12 +00:00
localStorage.version = $config.version;
2024-02-23 08:30:26 +00:00
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>
2024-02-23 09:18:30 +00:00
<div class="flex items-center mt-1">
<div class="text-sm dark:text-gray-200">{$i18n.t('Release Notes')}</div>
2024-02-23 08:30:26 +00:00
<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">
2024-02-24 01:12:19 +00:00
v{WEBUI_VERSION}
2024-02-23 08:30:26 +00:00
</div>
</div>
2024-02-23 09:18:30 +00:00
</div>
2024-05-02 09:47:16 +00:00
<div class=" w-full p-4 px-5 text-gray-700 dark:text-gray-100">
2024-05-15 06:16:22 +00:00
<div class=" overflow-y-scroll max-h-80 scrollbar-hidden">
2024-02-23 09:18:30 +00:00
<div class="mb-3">
2024-02-23 08:30:26 +00:00
{#if changelog}
{#each Object.keys(changelog) as version}
2024-02-23 09:31:28 +00:00
<div class=" mb-3 pr-2">
2024-07-08 20:35:25 +00:00
<div class="font-semibold text-xl mb-1 dark:text-white">
2024-02-23 09:31:28 +00:00
v{version} - {changelog[version].date}
</div>
2024-02-23 08:30:26 +00:00
2024-02-23 09:31:28 +00:00
<hr class=" dark:border-gray-800 my-2" />
2024-02-23 09:18:30 +00:00
2024-02-23 09:31:28 +00:00
{#each Object.keys(changelog[version]).filter((section) => section !== 'date') as section}
<div class="">
<div
2024-07-08 20:35:25 +00:00
class="font-semibold uppercase text-xs {section === 'added'
2024-02-23 09:31:28 +00:00
? 'text-white bg-blue-600'
: section === 'fixed'
2024-08-13 10:12:35 +00:00
? 'text-white bg-green-600'
: section === 'changed'
? 'text-white bg-yellow-600'
: section === 'removed'
? 'text-white bg-red-600'
: ''} w-fit px-3 rounded-full my-2.5"
2024-02-23 09:31:28 +00:00
>
{section}
</div>
2024-02-23 08:30:26 +00:00
2024-02-23 09:32:32 +00:00
<div class="my-2.5 px-1.5">
2024-02-23 09:31:28 +00:00
{#each Object.keys(changelog[version][section]) as item}
<div class="text-sm mb-2">
<div class="font-semibold uppercase">
{changelog[version][section][item].title}
</div>
<div class="mb-2 mt-1">{changelog[version][section][item].content}</div>
2024-02-23 08:30:26 +00:00
</div>
2024-02-23 09:31:28 +00:00
{/each}
</div>
2024-02-23 08:30:26 +00:00
</div>
2024-02-23 09:31:28 +00:00
{/each}
</div>
2024-02-23 08:30:26 +00:00
{/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;
}}
2024-04-28 01:20:43 +00:00
class=" px-4 py-2 bg-emerald-700 hover:bg-emerald-800 text-gray-100 transition rounded-lg"
2024-02-23 08:30:26 +00:00
>
<span class="relative">{$i18n.t("Okay, Let's Go!")}</span>
2024-02-23 08:30:26 +00:00
</button>
</div>
</div>
</Modal>