SPB Git

spb/worthdoing Public

Autonomous investigation agent that discovers, challenges, and ranks things genuinely worth doing — Claude + Firecrawl, Next.js 16, PostgreSQL

TypeScript 91.5% SQL 5.8% CSS 2.2%
2.7 KB · 67 lines tsx
Raw Blame History
1/**2 * WorthDoing.ai3 * Author: Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * File: src/app/history/page.tsx6 * Description: History page — all investigations with status, phase, outcome and telemetry.7 */8import Link from "next/link";9import { desc } from "drizzle-orm";10import { db } from "@/lib/db/client";11import { investigations } from "@/lib/db/schema";12import { InvestigationStatusBadge, PhaseBadge } from "@/components/wd/badges";1314export const dynamic = "force-dynamic";1516export default async function HistoryPage() {17  const rows = await db.select().from(investigations).orderBy(desc(investigations.createdAt)).limit(100);1819  return (20    <div className="mx-auto w-full max-w-4xl px-4 py-10 sm:px-6">21      <h1 className="font-heading text-3xl font-semibold tracking-tight text-ink sm:text-4xl">22        Investigation history23      </h1>2425      {rows.length === 0 ? (26        <div className="mt-16 rounded-xl border border-dashed border-line bg-card/50 p-12 text-center">27          <p className="font-heading text-xl text-ink">No investigations yet</p>28          <p className="mt-2 text-sm text-ink-soft">Launch one from the home page.</p>29        </div>30      ) : (31        <ul className="mt-8 space-y-3">32          {rows.map((inv) => (33            <li key={inv.id}>34              <Link35                href={`/investigate/${inv.id}`}36                className="block rounded-xl border border-line bg-card p-4 transition-colors hover:border-verdict/40"37              >38                <div className="flex flex-wrap items-center gap-2">39                  <InvestigationStatusBadge status={inv.status} live />40                  <PhaseBadge phase={inv.phase} />41                  <span className="ml-auto font-mono text-[11px] text-ink-soft">42                    {inv.createdAt.toLocaleString([], {43                      year: "numeric",44                      month: "short",45                      day: "numeric",46                      hour: "2-digit",47                      minute: "2-digit",48                    })}49                  </span>50                </div>51                <p className="mt-2 text-[15px] font-medium leading-snug text-ink">{inv.objective}</p>52                {inv.conclusion && (53                  <p className="mt-1 line-clamp-2 text-sm text-ink-soft">{inv.conclusion}</p>54                )}55                <p className="mt-2 font-mono text-[10px] uppercase tracking-wider text-ink-soft/80">56                  {inv.budgetUsed.searches} searches · {inv.budgetUsed.scrapes} reads ·{" "}57                  {inv.budgetUsed.agentSteps} steps · ${inv.budgetUsed.costUsd.toFixed(2)}58                </p>59              </Link>60            </li>61          ))}62        </ul>63      )}64    </div>65  );66}67