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
11 let { children } = $props();
12
13 const errorMessages: Record<string, (params: URLSearchParams) => string> = {
14 handle_not_found: (p) => `Handle ${p.get('handle') ?? ''} not found!`
15 };
16
17 onMount(() => {
18 initClient();
19
20 const error = page.url.searchParams.get('error');
21 if (error) {
22 const msg = errorMessages[error]?.(page.url.searchParams) ?? error;
23 toast.error(msg);
24 goto(page.url.pathname, { replaceState: true });
25 }
26 });
27</script>
28
29{@render children()}
30
31<ThemeToggle class="fixed top-2 left-2 z-10" />
32<Toaster />
33
34{#if videoPlayer.id}
35 <YoutubeVideoPlayer />
36{/if}