From 493746b14c1251a45b061d2e3edd9160c929d2b9 Mon Sep 17 00:00:00 2001 From: benj Date: Fri, 10 Apr 2026 11:13:34 +0800 Subject: a basic ui and landing web interface for tidyindex.com --- web/ui/src/routes/dashboard/usage/+page.server.ts | 13 ++ web/ui/src/routes/dashboard/usage/+page.svelte | 152 ++++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 web/ui/src/routes/dashboard/usage/+page.server.ts create mode 100644 web/ui/src/routes/dashboard/usage/+page.svelte (limited to 'web/ui/src/routes/dashboard/usage') diff --git a/web/ui/src/routes/dashboard/usage/+page.server.ts b/web/ui/src/routes/dashboard/usage/+page.server.ts new file mode 100644 index 0000000..34ff002 --- /dev/null +++ b/web/ui/src/routes/dashboard/usage/+page.server.ts @@ -0,0 +1,13 @@ +import { PLANS } from '$lib/plans'; +import { usageByDataset, usageByKey, usageCountThisMonth } from '$lib/server/usage'; +import type { PageServerLoad } from './$types'; + +export const load: PageServerLoad = async ({ locals }) => { + const account = locals.account!; + return { + plan: PLANS[account.plan], + total: usageCountThisMonth(account.id), + byDataset: usageByDataset(account.id), + byKey: usageByKey(account.id) + }; +}; diff --git a/web/ui/src/routes/dashboard/usage/+page.svelte b/web/ui/src/routes/dashboard/usage/+page.svelte new file mode 100644 index 0000000..883460c --- /dev/null +++ b/web/ui/src/routes/dashboard/usage/+page.svelte @@ -0,0 +1,152 @@ + + +

ยง 02  ·  usage

+

This month.

+

+ Requests counted against your plan limit for {monthName}. +

+ +
+
+
+

+ requests / {limitLabel} +

+

+ {fmt(data.total)} + {#if Number.isFinite(data.plan.requestsPerMonth)} +  of {limitLabel} + {/if} +

+
+
+ {data.plan.name.toLowerCase()} plan +
+
+ {#if Number.isFinite(data.plan.requestsPerMonth)} +
+
+
+ {/if} +
+ +
+
+

By dataset

+

Which datasets drew the most traffic.

+
+ {#if data.byDataset.length === 0} +
+

No requests yet this month.

+

Usage data will show up here once your keys start making calls.

+
+ {:else} + + + + + + + + + + {#each data.byDataset as row} + + + + + + {/each} + +
datasetrequestsshare
{row.dataset}{fmt(row.count)} + {data.total > 0 + ? ((row.count / data.total) * 100).toFixed(1) + : '0.0'}% +
+ {/if} +
+ +
+
+

By key

+

Traffic attributed to each of your keys.

+
+ {#if data.byKey.length === 0} +
+

No keys yet.

+

Create one on the Keys tab.

+
+ {:else} + + + + + + + + + {#each data.byKey as row} + + + + + {/each} + +
keyrequests
{row.name}{fmt(row.count)}
+ {/if} +
+ +
+
+

API base URL

+
+

All endpoints live under this host.

+
https://api.tidyindex.com/v1
+
+ +
+
+

Quick start

+ +
+

Fetch one record from the IRS 990 dataset.

+
{curlExample}
+
-- cgit v1.2.3