johnandersen777.bsky.social/knotless
git that lives in your Atmosphere account
Forked from chadtmiller.com/knotless
0
0
<script lang="ts">
import type { CheckView, CommitView } from '#lib/lexicons/dev/knotless/defs.ts';
import { archiveHref, repoHref, urlPath } from '#lib/format.ts';
import CheckMark from '#lib/molecules/CheckMark.svelte';
import Committed from '#lib/molecules/Committed.svelte';
import Sha from '#lib/atoms/Sha.svelte';
import Empty from '#lib/molecules/Empty.svelte';
/** A repository's branches or tags, under `heading`: each linked to its code, the default branch `head` marked, with the commit it names, who committed it and when, and how its checks stand, and with `archives` its files to download; `empty` said when there are none. */
let {
authority,
name,
heading,
refs,
head,
empty,
archives = false
}: {
authority: string;
name: string;
heading: string;
refs: { name: string; commit?: CommitView; checks?: CheckView[] }[];
head?: string;
empty: string;
archives?: boolean;
} = $props();
const href = (tail: string) => repoHref(authority, name, tail);
</script>
<section class="box refs" aria-label={heading}>
<div class="boxhead"><h3>{heading}</h3></div>
{#if refs.length}
<ul class="list">
{#each refs as r (r.name)}
<li>
<div class="grow">
<div class="ref-name">
<a class="title clip" href={href(`/tree/${urlPath(r.name)}`)}>{r.name}</a
>{#if r.name === head}<span class="count">Default</span>{/if}
</div>
{#if r.commit}<div class="meta">
<Committed commit={r.commit} /><CheckMark checks={r.checks ?? []} />{#if archives}<a
class="archive"
href={archiveHref(authority, name, r.name, 'zip')}
download>zip</a
><a class="archive" href={archiveHref(authority, name, r.name, 'tar.gz')} download
>tar.gz</a
>{/if}
</div>{/if}
</div>
{#if r.commit}<Sha sha={r.commit.sha} href={href(`/commit/${r.commit.sha}`)} />{/if}
</li>
{/each}
</ul>
{:else}
<Empty title={empty} />
{/if}
</section>