Files
open-webui/src/lib/components/OnBoarding.svelte
T
2026-11-21 13:27:07 +04:00

129 lines
3.9 KiB
Svelte

<script>
import { getContext } from 'svelte';
import { WEBUI_NAME } from '$lib/stores';
const i18n = getContext('i18n');
export let show = true;
export let getStartedHandler = () => {};
let videoElement;
let playOnInteractionRegistered = false;
function playBackgroundVideo() {
if (!videoElement) {
return;
}
videoElement.play().catch(() => {
if (playOnInteractionRegistered) {
return;
}
playOnInteractionRegistered = true;
const playOnInteraction = () => {
videoElement.play().catch(() => {});
document.removeEventListener('click', playOnInteraction);
document.removeEventListener('touchstart', playOnInteraction);
playOnInteractionRegistered = false;
};
document.addEventListener('click', playOnInteraction);
document.addEventListener('touchstart', playOnInteraction);
});
}
$: if (show && videoElement) {
playBackgroundVideo();
}
</script>
{#if show}
<div class="relative h-screen max-h-[100dvh] w-full overflow-hidden text-white">
<div class="fixed top-6 left-6 z-50 sm:top-10 sm:left-10">
<!-- LICENSE covers this Open WebUI onboarding logo.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<img
id="logo"
crossorigin="anonymous"
src="/static/favicon.png"
class="size-6 rounded-full"
alt="{$WEBUI_NAME} logo"
/>
</div>
<video
bind:this={videoElement}
class="absolute inset-0 h-full w-full object-cover"
src="/assets/welcome.mp4"
autoplay
muted
loop
playsinline
preload="auto"
poster="/assets/welcome.webp"
aria-hidden="true"
></video>
<div class="absolute inset-0 bg-linear-to-t from-base-1000/80 via-base-1000/20 to-transparent"></div>
<div class="absolute inset-0 bg-linear-to-r from-base-1000/50 via-base-1000/10 to-transparent"></div>
<div class="relative z-10 flex h-screen max-h-[100dvh] w-full">
<div class="flex w-full flex-col justify-end px-6 pb-8 sm:px-10 sm:pb-10 lg:px-16 lg:pb-14">
<div class="max-w-3xl">
<!-- LICENSE covers this Open WebUI welcome identifier.
Do not alter, remove, obscure, or replace it except as LICENSE permits:
https://docs.openwebui.com/license. -->
<div class="mb-4 text-[0.6875rem] font-medium tracking-[0.18em] uppercase opacity-35">
Open WebUI
</div>
<h1
class="m-0 max-w-3xl text-[22px] leading-[1.15] font-light tracking-tight lg:text-[33px]"
>
{$i18n.t('Welcome to your AI home.')}
</h1>
<p class="mt-6 max-w-xl text-sm leading-relaxed font-light text-base-0/60 lg:text-base">
{$i18n.t(
'Run AI on your own terms. Connect any model, extend with code, and protect what matters without compromise. Your models, your data, your machine, wherever you open it.'
)}
</p>
<div class="mt-8 flex flex-col items-start gap-6 sm:flex-row sm:items-center sm:gap-7">
<button
aria-label={$i18n.t('Get started')}
class="group relative z-20 inline-flex h-10 w-[220px] max-w-full items-center justify-between gap-2 rounded-none bg-base-0 px-4 text-[13px] font-normal text-base-1000 transition hover:bg-base-0/90 focus:ring-2 focus:ring-base-0/50 focus:outline-hidden"
on:click={() => {
getStartedHandler();
}}
>
{$i18n.t('Get started')}
<svg
class="h-3.5 w-3.5 shrink-0 transition group-hover:translate-x-0.5"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="1.5"
aria-hidden="true"
>
<path stroke-linecap="round" stroke-linejoin="round" d="M17 8l4 4m0 0l-4 4m4-4H3" />
</svg>
</button>
<a
class="inline-flex items-center text-sm text-base-0/60 transition hover:text-white"
href="https://docs.openwebui.com/"
target="_blank"
rel="noopener noreferrer"
>
{$i18n.t('Read the docs')}
</a>
</div>
</div>
</div>
</div>
</div>
{/if}