~james/core

core/web/src/lib/components/timeline/TimelineRepoEvent.svelte -rw-r--r-- 2.0 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
61
62
63
64
65
66
67
68
<script lang="ts">
	import RepoCard from "#lib/components/repo/RepoCard.svelte";
	import TimelineGroup from "#lib/components/timeline/TimelineGroup.svelte";
	import TimelineActorHeader from "#lib/components/timeline/TimelineActorHeader.svelte";
	import { toRepoCard, repoHref, repoOwner } from "#lib/components/timeline/mappers.ts";
	import type { TimelineEvent } from "#lib/components/timeline/group.ts";
	import type * as OrgTangledActorDefs from "#lib/api/lexicons/types/org/tangled/actor/defs.ts";
	import type { RepoEvent } from "#lib/api/lexicons/types/org/tangled/feed/getTimeline.ts";

	let {
		actor,
		items,
		signedIn = false
	}: {
		actor: OrgTangledActorDefs.ProfileViewBasic;
		items: TimelineEvent<RepoEvent>[];
		signedIn?: boolean;
	} = $props();

	const first = $derived(items[0].event);
</script>

{#snippet forkTarget()}
	<span>to</span>
	<a
		href={repoHref(first.repo)}
		title={first.repo.slug}
		class="max-w-1/2 min-w-0 truncate text-foreground-default hover:underline"
		>{first.repo.slug}</a
	>
{/snippet}

<TimelineGroup {items} trailing={first.source && items.length === 1 ? forkTarget : undefined}>
	{#snippet title()}
		<TimelineActorHeader
			{actor}
			verb={first.source ? "forked" : "created"}
			count={items.length}
			plural="repositories"
		>
			{#if first.source}
				<a
					href={repoHref(first.source)}
					title="{repoOwner(first.source)}/{first.source.slug}"
					class="max-w-1/2 min-w-0 truncate text-foreground-default hover:underline"
					>{repoOwner(first.source)}/{first.source.slug}</a
				>
			{:else}
				<a
					href={repoHref(first.repo)}
					title={first.repo.slug}
					class="max-w-1/2 min-w-0 truncate text-foreground-default hover:underline"
					>{first.repo.slug}</a
				>
			{/if}
		</TimelineActorHeader>
	{/snippet}
	{#snippet row(event)}
		<RepoCard
			repo={toRepoCard(event.repo)}
			starButton={signedIn}
			border={false}
			background={false}
			padding="none"
			class="flex min-h-24 flex-col"
		/>
	{/snippet}
</TimelineGroup>