~james/core

core/web/src/lib/components/welcome/SocialStep.svelte -rw-r--r-- 1.6 KiB
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 16 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
<script lang="ts">
	import { resolve } from "$app/paths";
	import Newspaper from "$icon/newspaper";
	import Compass from "$icon/compass";
	import EmptyState from "#lib/components/ui/EmptyState.svelte";
	import FollowCard from "#lib/components/profile/FollowCard.svelte";
	import RepoCard from "#lib/components/repo/RepoCard.svelte";
	import { repoKey, type PersonData, type RepoCardData } from "#lib/components/profile/types.ts";
	import StepHeader from "#lib/components/welcome/StepHeader.svelte";
	import Button from "#lib/components/ui/Button.svelte";

	let {
		people,
		repos,
		onInteract
	}: {
		people: PersonData[];
		repos: RepoCardData[];
		onInteract?: () => void;
	} = $props();

	const timelineHref = resolve("/timeline");

	const interacted = (active: boolean) => {
		if (active) onInteract?.();
	};
</script>

<div class="flex flex-col gap-xl">
	<StepHeader title="Discover" subtitle="Find users to follow and repositories to star." />

	{#if people.length > 0 || repos.length > 0}
		{#if people.length > 0}
			<div class="flex flex-col gap-sm">
				{#each people as person (person.did)}
					<FollowCard
						{person}
						border
						onFollow={(change) => interacted(change.following)}
					/>
				{/each}
			</div>
		{/if}

		{#if repos.length > 0}
			<div class="flex flex-col gap-sm">
				{#each repos as repo (repoKey(repo))}
					<RepoCard {repo} border onStar={(change) => interacted(change.starred)} />
				{/each}
			</div>
		{/if}
	{:else}
		<EmptyState icon={Compass} message="No suggestions yet." messageDirection="vertical">
			<Button href={timelineHref} icon={Newspaper} variant="ghost">Browse the timeline</Button
			>
		</EmptyState>
	{/if}
</div>