your personal website on atproto - mirror
blento.app
1<script lang="ts">
2 import { login, user } from '$lib/atproto';
3 import BaseCard from '$lib/cards/BaseCard/BaseCard.svelte';
4 import Card from '$lib/cards/Card/Card.svelte';
5 import type { Item, WebsiteData } from '$lib/types';
6 import type { ActorIdentifier } from '@atcute/lexicons';
7 import { Button } from '@foxui/core';
8
9 let { data }: { data: WebsiteData } = $props();
10
11 let cards = $derived.by((): Item[] => {
12 const items: Item[] = [];
13
14 // Name + "No blento yet" card
15 items.push({
16 id: 'empty-main',
17 x: 0,
18 y: 0,
19 w: 6,
20 h: 2,
21 mobileX: 0,
22 mobileY: 0,
23 mobileW: 8,
24 mobileH: 3,
25 cardType: 'text',
26 color: 'red',
27 cardData: {
28 text: `## No blento yet!`,
29 textAlign: 'center',
30 verticalAlign: 'center'
31 }
32 });
33
34 // Bluesky social icon
35 items.push({
36 id: 'empty-bluesky',
37 x: 0,
38 y: 2,
39 w: 2,
40 h: 2,
41 mobileX: 0,
42 mobileY: 3,
43 mobileW: 3,
44 mobileH: 3,
45 cardType: 'bigsocial',
46 cardData: {
47 platform: 'bluesky',
48 href: `https://bsky.app/profile/${data.handle}`,
49 color: '0285FF'
50 }
51 });
52
53 return items;
54 });
55
56 let maxHeight = $derived(cards.reduce((max, item) => Math.max(max, item.y + item.h), 0));
57
58 let maxMobileHeight = $derived(
59 cards.reduce((max, item) => Math.max(max, item.mobileY + item.mobileH), 0)
60 );
61</script>
62
63{#each cards as item (item.id)}
64 <BaseCard {item}>
65 <Card {item} />
66 </BaseCard>
67{/each}
68
69<!-- Spacer for grid height -->
70<div class="hidden @[42rem]/grid:block" style="height: {(maxHeight / 8) * 100}cqw;"></div>
71<div class="@[42rem]/grid:hidden" style="height: {(maxMobileHeight / 4) * 100}cqw;"></div>
72
73{#if !user.isLoggedIn}
74 <div
75 class="dark:bg-base-950 border-base-200 dark:border-base-900 fixed top-4 right-4 z-20 flex flex-col gap-4 rounded-2xl border bg-white p-4 shadow-lg"
76 >
77 <span class="text-sm font-semibold">Login to edit your page</span>
78
79 <Button
80 onclick={async () => {
81 await login(data.handle as ActorIdentifier);
82 }}>Login</Button
83 >
84 </div>
85{/if}