~james/core

core/web/src/lib/components/welcome/FinishStep.svelte -rw-r--r-- 6.2 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<script module lang="ts">
	import { tv, type VariantProps } from "tailwind-variants";

	export const tile = tv({
		slots: {
			root: "flex flex-col gap-xs rounded-md border border-border-default p-md",
			heading:
				"flex items-center gap-xs typography-paragraph-regular text-foreground-default",
			body: "flex-1 typography-paragraph-small text-foreground-muted",
			action: "ml-auto flex w-fit items-center gap-2xs typography-paragraph-small text-foreground-default no-underline hover:underline"
		},
		variants: {
			span: {
				full: { root: "sm:col-span-2" },
				tall: { root: "sm:row-span-2" },
				single: { root: "" }
			},
			link: {
				true: {
					root: "flex-1 gap-2xs no-underline transition-colors hover:bg-background-subtle hover:no-underline"
				},
				false: { root: "" }
			}
		},
		defaultVariants: {
			span: "single",
			link: false
		}
	});

	export type TileVariants = VariantProps<typeof tile>;

	const TILE_STAGGER_MS = 60;
	const TILE_MAX_DELAY_MS = 140;

	function tileDelay(index: number) {
		return Math.min(index * TILE_STAGGER_MS, TILE_MAX_DELAY_MS);
	}
</script>

<script lang="ts">
	import type { Component } from "svelte";
	import type { SvelteHTMLElements } from "svelte/elements";
	import { quintOut } from "svelte/easing";
	import { fly } from "svelte/transition";
	import { prefersReducedMotion } from "svelte/motion";
	import { resolve } from "$app/paths";
	import ArrowRight from "$icon/arrow-right";
	import Check from "$icon/check";
	import BookMarked from "$icon/book-marked";
	import Download from "$icon/download";
	import GitPullRequest from "$icon/git-pull-request";
	import Layers2 from "$icon/layers-2";
	import MessageCircle from "$icon/message-circle";
	import Server from "$icon/server";
	import Twitter from "$icon/twitter";
	import Bluesky from "#lib/components/icons/Bluesky.svelte";
	import StepHeader from "#lib/components/welcome/StepHeader.svelte";
	import { pluralize } from "#lib/format.ts";

	let { migrated = 0 }: { migrated?: number } = $props();

	const slot = tile();

	function tileTransition(index: number) {
		return {
			y: prefersReducedMotion.current ? 0 : 8,
			duration: prefersReducedMotion.current ? 0 : 220,
			delay: prefersReducedMotion.current ? 0 : tileDelay(index),
			easing: quintOut
		};
	}

	const coreHref = resolve("/tangled.org/core" as "/");
	const newRepoHref = resolve("/repo/new");
	const migrateHref = resolve("/repo/migrate");

	const docs: {
		icon: Component<SvelteHTMLElements["svg"]>;
		title: string;
		body: string;
		href: string;
	}[] = [
		{
			icon: Server,
			title: "Host your own knot",
			body: "Host repositories on your own infrastructure with knots.",
			href: "https://docs.tangled.org/knots/self-hosting/"
		},
		{
			icon: Layers2,
			title: "Host your own spindle",
			body: "Run CI jobs on your own infrastructure using spindles.",
			href: "https://docs.tangled.org/spindles/self-hosting/"
		}
	];

	const community: {
		icon: Component<SvelteHTMLElements["svg"]>;
		title: string;
		body: string;
		href: string;
	}[] = [
		{
			icon: Bluesky,
			title: "Bluesky",
			body: "Follow @tangled.org for updates.",
			href: "https://bsky.app/profile/tangled.org"
		},
		{
			icon: MessageCircle,
			title: "Discord",
			body: "Chat with the community.",
			href: "https://chat.tangled.org"
		},
		{
			icon: Twitter,
			title: "X (Twitter)",
			body: "Follow @tangled_org for updates.",
			href: "https://x.com/tangled_org"
		}
	];
</script>

<div class="flex flex-col gap-xl">
	<StepHeader title="You're all set!" subtitle="Here are a few things to explore next." />

	<div class="flex flex-col gap-sm">
		<div class="grid grid-cols-1 gap-sm sm:grid-cols-2">
			<div class={slot.root()} in:fly={tileTransition(0)}>
				{@render heading(Download, "Migrate your repositories")}
				<p class={slot.body()}>
					Point us at your GitHub account and move your repositories to a knot of your
					choice.
				</p>
				{#if migrated > 0}
					<span
						class="flex items-center gap-2xs typography-paragraph-small text-foreground-success"
					>
						<Check class="size-3.5 shrink-0" aria-hidden="true" />
						{pluralize(migrated, "repository", "repositories")} migrated
					</span>
				{/if}
				<a href={migrateHref} class={slot.action()}>
					{migrated > 0 ? "Migrate more" : "Migrate"}
					<ArrowRight class="size-4 shrink-0" aria-hidden="true" />
				</a>
			</div>

			<div class={slot.root()} in:fly={tileTransition(1)}>
				{@render heading(BookMarked, "Create a repository")}
				<p class={slot.body()}>Kick things off by creating your first repository.</p>
				<a href={newRepoHref} class={slot.action()}>
					Create
					<ArrowRight class="size-3.5 shrink-0" aria-hidden="true" />
				</a>
			</div>

			<div class={tile({ span: "tall" }).root()} in:fly={tileTransition(1)}>
				{@render heading(GitPullRequest, "Contribute to the Tangled project")}
				<p class={slot.body()}>
					Tangled is fully open-source: open a feature request, or submit a bug-fix!
					<br /><br />
					All contributions are welcome.
				</p>
				<a href={coreHref} class={slot.action()}>
					Contribute
					<ArrowRight class="size-3.5 shrink-0" aria-hidden="true" />
				</a>
			</div>

			{#each docs as doc, i (doc.title)}
				<div class={slot.root()} in:fly={tileTransition(2 + i)}>
					{@render heading(doc.icon, doc.title)}
					<p class={slot.body()}>{doc.body}</p>
					<a
						href={doc.href}
						target="_blank"
						rel="external noopener noreferrer"
						class={slot.action()}
					>
						Read the docs
						<ArrowRight class="size-3.5 shrink-0" aria-hidden="true" />
					</a>
				</div>
			{/each}
		</div>

		<ul class="grid grid-cols-1 gap-sm sm:grid-cols-3">
			{#each community as link, i (link.title)}
				<li class="flex" in:fly={tileTransition(4 + i)}>
					<a
						href={link.href}
						target="_blank"
						rel="external noopener noreferrer"
						class={tile({ link: true }).root()}
					>
						{@render heading(link.icon, link.title)}
						<span class={slot.body()}>{link.body}</span>
					</a>
				</li>
			{/each}
		</ul>
	</div>
</div>

{#snippet heading(icon: Component<SvelteHTMLElements["svg"]>, title: string)}
	{@const Icon = icon}
	<span class={slot.heading()}>
		<Icon class="size-3.5 shrink-0" aria-hidden="true" />
		{title}
	</span>
{/snippet}