chore: updated /git 9d6edd53
Steve Simkins · 2026-06-14 20:06 1 file(s) · +69 −4
src/pages/git.astro +69 −4
1 1
---
2 +
export const prerender = false;
3 +
2 4
import PageLayout from "@/layouts/Base.astro";
3 5
import {
4 6
	createDarkmatterHighlighter,
16 18
	lang: "bash",
17 19
	theme: THEME_NAME,
18 20
});
21 +
22 +
// Fetch repos from my self hosted git site
23 +
let repos: any[] = [];
24 +
let error: string | null = null;
25 +
try {
26 +
	const res = await fetch("https://git.stevedylan.dev/api/repos");
27 +
	if (res.ok) {
28 +
		const data = await res.json();
29 +
		repos = (data.repos ?? []).sort(
30 +
			(a: any, b: any) =>
31 +
				new Date(b.last_commit).getTime() - new Date(a.last_commit).getTime(),
32 +
		);
33 +
	} else {
34 +
		error = `API returned ${res.status}`;
35 +
	}
36 +
} catch (e) {
37 +
	error = e instanceof Error ? e.message : "Failed to reach git API";
38 +
}
39 +
40 +
const dateFormatter = new Intl.DateTimeFormat("en-US", {
41 +
	year: "numeric",
42 +
	month: "short",
43 +
	day: "numeric",
44 +
});
19 45
---
20 46
21 47
<PageLayout meta={meta}>
22 -
	<div class="space-y-6">
23 -
    <h1 class="title">/git</h1>
24 -
		<p>Access my open source repos either through <a href="https://github.com/stevedylandev" target="_blank" rel="noreferrer" class="style-link">GitHub</a> or over SSH:</p>
25 -
		<div set:html={codeHtml} />
48 +
	<div class="flex min-h-screen flex-col items-start justify-start gap-6">
49 +
		<h1 class="title">/git</h1>
50 +
		<p>
51 +
			You can browse my open source repos on <a
52 +
				href="https://git.stevedylan.dev"
53 +
				target="_blank"
54 +
				rel="noreferrer"
55 +
				class="style-link">git.stevedylan.dev</a
56 +
			>. Browse them on the web, or visit over SSH:
57 +
		</p>
58 +
		<div class="w-full" set:html={codeHtml} />
59 +
		<p>
60 +
			You can also checkout my <a
61 +
				href="https://github.com/stevedylandev"
62 +
				target="_blank"
63 +
				rel="noreferrer"
64 +
				class="style-link">GitHub</a
65 +
			> for other work and contributions.
66 +
		</p>
67 +
		{error ? (
68 +
			<p class="text-red-400 text-sm">Could not load repos: {error}</p>
69 +
		) : repos.length === 0 ? (
70 +
			<p class="text-zinc-400 text-sm">no repos yet</p>
71 +
		) : (
72 +
			<div class="flex w-full flex-col">
73 +
				{repos.map((repo: any) => (
74 +
					<a
75 +
						href={repo.url}
76 +
						target="_blank"
77 +
						rel="noopener noreferrer"
78 +
						class="flex items-center justify-between gap-4 border-b border-[#333] py-3 no-underline transition-opacity hover:opacity-70"
79 +
					>
80 +
						<div class="flex flex-col gap-0.5">
81 +
							<span class="text-base">{repo.name}</span>
82 +
							<span class="text-xs opacity-50">{repo.clone_ssh}</span>
83 +
						</div>
84 +
						<span class="flex-shrink-0 text-xs opacity-50">
85 +
							{dateFormatter.format(new Date(repo.last_commit))}
86 +
						</span>
87 +
					</a>
88 +
				))}
89 +
			</div>
90 +
		)}
26 91
	</div>
27 92
</PageLayout>