File size: 2,268 Bytes
e71d24a
a1d7896
7bb6a57
f05d33c
0bfd10c
7bb6a57
e71d24a
a084673
f6be94e
a1d7896
 
5770977
47bc57c
3740d71
b1a4d81
 
e8410db
a1d7896
 
 
 
 
 
47bc57c
 
3740d71
4c7c347
3740d71
 
 
62c9fe7
 
25d4967
 
3740d71
47bc57c
e71d24a
 
a382c22
47bc57c
e71d24a
eb29a95
e71d24a
 
f05d33c
a1d7896
502ba41
 
 
 
 
 
a1d7896
 
 
 
 
 
 
 
 
 
f6be94e
a1d7896
f6be94e
a1d7896
 
 
e71d24a
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
66
67
68
69
70
<script>
	import { get } from "svelte/store";
	import Icon from "@iconify/svelte";
	import { SvelteToast } from '@zerodevx/svelte-toast'
	import { init } from "@huggingface/space-header"

	import Sidebar from "$lib/components/sidebar/Sidebar.svelte";
	import "$lib/styles/tailwind.css"
	import { openWindowLogin, userStore } from "$lib/stores/use-user";
	import Dialog from "$lib/components/dialog/Dialog.svelte";
	import { loginModalStore } from "$lib/stores/use-login-modal";
	import SpaceMiniHeader from "$lib/components/spaceheader/SpaceMiniHeader.svelte";
	import { onMount } from "svelte";
	import { browser } from "$app/environment";

	export let data;
	userStore.set(data?.user?.user);

	let open = get(loginModalStore);

	loginModalStore.subscribe((v) => {
		open = v;
  });

	onMount(() => {
		if (browser) {
			console.log(window.location)
			if (window.location.host === "enzostvs-lora-studio.hf.space") {
				window.location.href = "https://lorastudio.co";
			}
			const hasAncestorOrigin = Object.values(window.location.ancestorOrigins).some((origin) => origin.includes("huggingface.co"));
			if (!hasAncestorOrigin) {
				init("enzostvs/lora-studio")
			}
		}
	})
</script>

<div class="flex items-start">
	<!-- <SpaceMiniHeader /> -->
	<Sidebar />
	<main id="app" class="flex-1 h-screen overflow-y-auto">
		<slot />
	</main>
	<SvelteToast />
	<Dialog {open} onClose={() => loginModalStore.set(false)}>
		<div class="grid grid-cols-1 gap-7 text-center relative">
			<!-- close icon -->
			<button class="absolute top-5 right-5" on:click={() => loginModalStore.set(false)}>
				<Icon icon="carbon:close" class="w-6 h-6 text-white cursor-pointer" />
			</button>
			
			<Icon icon="fluent-emoji:sparkles" class="w-12 h-12 mx-auto" />
			<header>
				<p class="text-white font-semibold text-lg">
					Login to LoRA Studio
				</p>
				<p class="text-neutral-300 text-base mt-1">
					Login to get a full access and get the most out of LoRA Studio.
				</p>
			</header>
			<main>
				<button class="inline-block" on:click={openWindowLogin}>
					<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/sign-in-with-huggingface-lg.svg" alt="Sign in with Hugging Face" class="mx-auto" />
				</button>
			</main>
		</div>
	</Dialog>
</div>