~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/knotless

git that lives in your Atmosphere account

Forked from chadtmiller.com/knotless

0
0
47 lines · 1.2 KB Raw History
<script lang="ts">
	import type * as getUsage from '#lib/lexicons/dev/knotless/getUsage.ts';
	import type { Answer } from '#lib/data.ts';
	import { capitalized } from '#lib/format.ts';
	/** How this appview was used, day by day, newest first, and what the network holds, as `knotless admin stats` prints it. */
	let { usage }: { usage: Answer<typeof getUsage.main> } = $props();
	const days = $derived([...usage.days].reverse());
	const columns = [
		'visitors',
		'views',
		'requests',
		'errors',
		'repos',
		'pushes',
		'pulls',
		'issues',
		'comments',
		'checks',
		'authors'
	] as const;
	const n = $derived(usage.network);
</script>

<div class="box admin-box">
	<div class="boxhead">
		<h2>Use</h2>
		{#if n}<span class="mute"
				>{`${n.accounts} accounts, ${n.repos} repositories, ${n.authorsWeek} active this week, ${n.authorsMonth} this month`}</span
			>{/if}
	</div>
	<div class="usage">
		<table>
			<thead
				><tr
					><th>Day</th>{#each columns as c (c)}<th>{capitalized(c)}</th>{/each}</tr
				></thead
			>
			<tbody>
				{#each days as d (d.day)}
					<tr
						><td>{d.day}</td>{#each columns as c (c)}<td>{d[c]}</td>{/each}</tr
					>
				{/each}
			</tbody>
		</table>
	</div>
</div>