File size: 2,185 Bytes
b4668c2
7c43dbf
d433b55
48059af
566c2fc
b4668c2
e99e7c2
67577d7
612f16b
e99e7c2
612f16b
7bf1507
 
 
 
 
 
b4668c2
 
7bf1507
911412b
a8a9533
911412b
 
67577d7
48059af
911412b
57dd8f3
48059af
911412b
57dd8f3
48059af
cc38b64
 
612f16b
d433b55
612f16b
 
56821e6
566c2fc
67577d7
db9d593
56821e6
 
 
67577d7
612f16b
566c2fc
 
cc38b64
a1a6daf
e99e7c2
 
 
 
7bf1507
e99e7c2
566c2fc
 
 
 
612f16b
911412b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<script lang="ts">
	import { base } from "$app/paths";
	import { page } from "$app/state";

	import LogoHuggingFaceBorderless from "$lib/components/icons/LogoHuggingFaceBorderless.svelte";
	import Modal from "$lib/components/Modal.svelte";
	import { cookiesAreEnabled } from "$lib/utils/cookiesAreEnabled";
	import Logo from "./icons/Logo.svelte";
	import { usePublicConfig } from "$lib/utils/PublicConfig.svelte";

	const publicConfig = usePublicConfig();

	interface Props {
		onclose?: () => void;
	}

	let { onclose }: Props = $props();
</script>

<Modal onclose={() => onclose?.()} width="!max-w-[400px] !m-4">
	<div
		class="from-primary-500/40 via-primary-500/10 to-primary-500/0 flex w-full flex-col items-center gap-6 bg-gradient-to-b px-5 pb-8 pt-9 text-center"
	>
		<h2 class="flex items-center text-2xl font-semibold text-gray-800">
			<Logo classNames="mr-1" />
			{publicConfig.PUBLIC_APP_NAME}
		</h2>
		<p class="text-balance text-lg font-semibold leading-snug text-gray-800">
			{publicConfig.PUBLIC_APP_DESCRIPTION}
		</p>
		<p class="text-balance rounded-xl border bg-white/80 p-2 text-base text-gray-800">
			{publicConfig.PUBLIC_APP_GUEST_MESSAGE}
		</p>

		<div class="flex w-full flex-col items-center gap-2">
			{#if page.data.loginRequired}
				<a
					href="{base}/login"
					class="flex w-full flex-wrap items-center justify-center whitespace-nowrap rounded-full bg-black px-5 py-2 text-center text-lg font-semibold text-gray-100 transition-colors hover:bg-gray-900"
				>
					Sign in
					{#if publicConfig.isHuggingChat}
						<span class="flex items-center">
							&nbsp;with <LogoHuggingFaceBorderless classNames="text-xl mr-1 ml-1.5" /> Hugging Face
						</span>
					{/if}
				</a>
			{:else}
				<button
					class="flex w-full items-center justify-center whitespace-nowrap rounded-full border-2 border-black bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-gray-900"
					onclick={(e) => {
						if (!cookiesAreEnabled()) {
							e.preventDefault();
							window.open(window.location.href, "_blank");
						}
						onclose?.();
					}}
				>
					Start chatting
				</button>
			{/if}
		</div>
	</div>
</Modal>