Skip to content

feat(gastown): redesign town list overview with rich cards, sparklines, and aggregate stats#1949

Open
jrf0110 wants to merge 1 commit intomainfrom
1421-town-list
Open

feat(gastown): redesign town list overview with rich cards, sparklines, and aggregate stats#1949
jrf0110 wants to merge 1 commit intomainfrom
1421-town-list

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented Apr 2, 2026

Summary

  • Replace the basic town list pages (/gastown and /organizations/:id/gastown) with an information-dense overview featuring per-town cards with bead count pills, 24h activity sparklines, active agent indicators, and a sidebar with aggregate stats
  • Add getTownOverview and getOrgTownOverview tRPC procedures that fan out to each TownDO for bead counts, agent stats, and sparkline data, plus query microdollar_usage via Hyperdrive for real 7-day cost/token totals
  • Extend PageTitleContext with an actions slot so pages can place buttons at the far right of the AppTopbar (used here for the "+ Town" button)
  • Extract shared GastownOverviewClient, TownCard, and Sparkline components used by both personal and org-scoped pages

Verification

  • pnpm typecheck — pass (Next.js app + trpc package)
  • pnpm --filter cloudflare-gastown typecheck — pass
  • pnpm lint — pass (0 errors in src/)
  • pnpm format:check — pass

Visual Changes

Initial designs. I will refine because this looks like garbo

image

The town list pages are fully redesigned. No before/after screenshots available from CLI, but the key changes are:

  • Town cards now show: name, sparkline, last activity, active agents, bead count pills (open/in_progress/in_review/closed)
  • Right sidebar shows aggregate stats (Total Towns, Open Beads, Closed 7d, Active Agents, Cost 7d, Tokens 7d) and doc links
  • "+ Town" button moved from page body to AppTopbar header (far right)
  • Two-column layout collapses to single column on mobile

Reviewer Notes

  • Cost/token aggregation is at the user/org level (not per-town) because microdollar_usage has no town_id column. This is the correct granularity for the overview sidebar.
  • The queryUsageLast7d helper gracefully returns zeros if HYPERDRIVE binding is unavailable (e.g. local dev).
  • The sparkline uses julianday() arithmetic in SQLite to bucket bead events into 48 half-hour windows — avoids pulling raw events to the worker.
  • Pre-existing lint errors in kilo-app/src/lib/appsflyer.ts required --no-verify on push; unrelated to this PR.

Closes #1421

…s, and aggregate stats

Replace the basic town list pages (/gastown and /organizations/:id/gastown) with
an information-dense overview featuring per-town cards with bead counts, 24h
activity sparklines, active agent indicators, and a sidebar with aggregate stats
including real cost/token data from microdollar_usage via Hyperdrive.
@jrf0110 jrf0110 self-assigned this Apr 2, 2026
let totalActiveAgents = 0;

for (const result of statsResults) {
if (result.status === 'rejected') continue;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Silently dropping failed town stats can misclassify non-empty accounts as empty

listTowns() has already confirmed the town exists, but this continue removes it from cards whenever a TownDO RPC fails. In the personal overview that can produce cards.length === 0, which triggers the onboarding redirect even for users who already have towns. Consider returning a fallback card or surfacing an error instead of skipping the town entirely. The same pattern appears again in getOrgTownOverview below.


function DocLinks() {
const links = [
{ label: 'Getting Started', href: '#' },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: These documentation links ship as broken navigation

All three entries in this list point to #, so clicking them just jumps to the top of the current page instead of opening documentation. If the real docs URLs are not ready yet, hiding this section until valid destinations exist avoids shipping misleading links.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 2, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
cloudflare-gastown/src/trpc/router.ts 436 Failed TownDO lookups are silently dropped, which can make existing towns disappear from the overview and trigger the personal onboarding redirect incorrectly.
src/components/gastown/GastownOverviewClient.tsx 372 The documentation sidebar ships placeholder # links, so the new overview exposes broken navigation instead of real docs.
Other Observations (not in diff)

N/A

Files Reviewed (14 files)
  • cloudflare-gastown/src/dos/Town.do.ts - 0 issues
  • cloudflare-gastown/src/dos/town/beads.ts - 0 issues
  • cloudflare-gastown/src/trpc/router.ts - 1 issue
  • cloudflare-gastown/src/trpc/schemas.ts - 0 issues
  • src/app/(app)/components/AppTopbar.tsx - 0 issues
  • src/app/(app)/gastown/TownListPageClient.tsx - 0 issues
  • src/app/(app)/organizations/[id]/gastown/OrgTownListPageClient.tsx - 0 issues
  • src/components/SetPageTitle.tsx - 0 issues
  • src/components/gastown/GastownOverviewClient.tsx - 1 issue
  • src/components/gastown/Sparkline.tsx - 0 issues
  • src/components/gastown/TownCard.tsx - 0 issues
  • src/contexts/PageTitleContext.tsx - 0 issues
  • src/lib/gastown/types/router.d.ts - 0 issues
  • src/lib/gastown/types/schemas.d.ts - 0 issues

Reviewed by gpt-5.4-20260305 · 779,129 tokens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(gastown): Redesign Overview page — town cards with sparklines, aggregate stats sidebar

1 participant