~james/core

core/web/src/lib/components/profile/ProfileShell.svelte -rw-r--r-- 1.7 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
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
<script lang="ts">
	import type { Did, Handle } from "@atcute/lexicons/syntax";
	import type { Snippet } from "svelte";
	import type { Moderation } from "#lib/api/moderationLabels.ts";
	import type { ProfileRecord } from "#lib/api/records.ts";
	import ProfileChrome from "#lib/components/profile/ProfileChrome.svelte";
	import type { ProfileCounts } from "#lib/components/profile/types.ts";

	interface Identity {
		did: Did;
		handle: Handle;
	}

	interface Props {
		identity: Identity | Promise<Identity>;
		profile: ProfileRecord | null | Promise<ProfileRecord | null>;
		counts: ProfileCounts | Promise<ProfileCounts>;
		viewerFollowRkey?: string | null | Promise<string | null | undefined>;
		notJoined: boolean | Promise<boolean>;
		bobbinUrl: string;
		delegationDid?: string;
		activeTab: string;
		moderation?: Moderation | Promise<Moderation | undefined>;
		content: Snippet;
	}

	let {
		identity: identityProp,
		profile: profileProp,
		counts: countsProp,
		viewerFollowRkey: viewerFollowRkeyProp,
		notJoined: notJoinedProp,
		bobbinUrl,
		delegationDid,
		activeTab,
		moderation: moderationProp,
		content
	}: Props = $props();

	// an await here suspends the whole navigation, so awaits live below the boundary
	const identity = $derived(await identityProp);
	const profile = $derived(await profileProp);
	const loadedCounts = $derived(await countsProp);
	const viewerFollowRkey = $derived(await viewerFollowRkeyProp);
	const notJoined = $derived(await notJoinedProp);
	const moderation = $derived(await moderationProp);
</script>

<ProfileChrome
	{identity}
	{profile}
	{loadedCounts}
	{viewerFollowRkey}
	{notJoined}
	{bobbinUrl}
	{delegationDid}
	{activeTab}
	{moderation}
	{content}
/>