johnandersen777.bsky.social/knotless
git that lives in your Atmosphere account
Forked from chadtmiller.com/knotless
0
0
<script lang="ts">
import { scrollRow } from '#lib/rows.ts';
import { capitalized } from '#lib/format.ts';
import Meta from '#lib/atoms/Meta.svelte';
let { data } = $props();
const network = $derived(data.stats.network);
// Newest first, as a reader looks for today.
const days = $derived([...data.stats.days].reverse());
const cols = [
'visitors',
'views',
'repos',
'pushes',
'pulls',
'issues',
'comments',
'checks',
'authors'
] as const;
// Visitors and authors are each day's own: one who came back counts on
// each day, so their sums would count people twice.
const once = new Set(['visitors', 'authors']);
const totals = $derived(
cols.map((c) => (once.has(c) ? '—' : data.stats.days.reduce((n, d) => n + d[c], 0)))
);
</script>
<Meta title="stats · knotless" />
<section class="stats">
<h1>Stats</h1>
<p class="lede">What the network wrote, and how many people looked, over the last 30 days.</p>
{#if network}
<dl class="network">
<div>
<dt>Accounts</dt>
<dd>{network.accounts}</dd>
</div>
<div>
<dt>Repositories</dt>
<dd>{network.repos}</dd>
</div>
<div>
<dt>Active this week</dt>
<dd>{network.authorsWeek}</dd>
</div>
<div>
<dt>Active this month</dt>
<dd>{network.authorsMonth}</dd>
</div>
</dl>
{/if}
<div class="scroll" {@attach scrollRow(null)}>
<table>
<thead
><tr
><th>Day</th>{#each cols as c (c)}<th>{capitalized(c)}</th>{/each}</tr
></thead
>
<tbody>
<tr class="total"
><td>30 days</td>{#each totals as n, i (cols[i])}<td>{n}</td>{/each}</tr
>
{#each days as d (d.day)}
<tr
><td>{d.day}</td>{#each cols as c (c)}<td>{d[c]}</td>{/each}</tr
>
{/each}
</tbody>
</table>
</div>
<p class="counted">
Days are UTC. Visitors are browsers that drew a page, each counted once a day by a hash of its
address forgotten that day; no cookies. Authors are accounts that made a repository, pushed, or
wrote in a thread. Everything else comes from what accounts wrote to their own repositories, as
the index read it.
</p>
</section>