your personal website on atproto - mirror
blento.app
1<script lang="ts">
2 import '../app.css';
3
4 import { ThemeToggle, Toaster, toast } from '@foxui/core';
5 import { onMount } from 'svelte';
6 import { initClient } from '$lib/atproto';
7 import YoutubeVideoPlayer, { videoPlayer } from '$lib/components/YoutubeVideoPlayer.svelte';
8 import { page } from '$app/state';
9 import { goto } from '$app/navigation';
10 import LoginModal from '$lib/atproto/UI/LoginModal.svelte';
11
12 let { children } = $props();
13
14 const errorMessages: Record<string, (params: URLSearchParams) => string> = {
15 handle_not_found: (p) => `Handle ${p.get('handle') ?? ''} not found!`
16 };
17
18 onMount(() => {
19 initClient();
20
21 const error = page.url.searchParams.get('error');
22 if (error) {
23 const msg = errorMessages[error]?.(page.url.searchParams) ?? error;
24 toast.error(msg);
25 goto(page.url.pathname, { replaceState: true });
26 }
27 });
28</script>
29
30{@render children()}
31
32<ThemeToggle class="fixed top-2 left-2 z-10" />
33<Toaster />
34
35{#if videoPlayer.id}
36 <YoutubeVideoPlayer />
37{/if}
38
39<LoginModal />