import Link from "next/link"; import type { Metadata } from "next"; import { ENTITY_TYPES } from "@websensor/core/client"; import { Chip, Empty, PageHeader, Panel, Score, Table, Tabs, Td } from "@/components/ui"; import { api } from "@/lib/api"; import { fmtInt, fmtScore, relTime, typeLabel } from "@/lib/format"; export const dynamic = "force-dynamic"; export const metadata: Metadata = { title: "Entities", description: "Organizations, products, models, APIs and other entities that events resolve to — ranked by importance, activity, velocity, quality and confirmation.", alternates: { canonical: "/entities" } }; type Search = { tab?: string; type?: string; q?: string }; export default async function EntitiesPage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; const tab = sp.tab === "all" || sp.type || sp.q ? "all" : "ranked"; return ( <> {tab === "ranked" ? : } ); } async function Ranked() { const { items } = await api.rank(200); return ( WebSensor rank {fmtInt(items.length)}} dense action={importance × activity × velocity × quality × confirmation — not raw counts} >

Ranking uses importance × activity × velocity × quality × confirmation, not raw counts.

{items.length === 0 ? ( The ranking is computed from the last 7 days of activity — nothing to rank yet. ) : ( {items.map((e) => ( ))}
{e.rank} {e.name} {e.domain &&
{e.domain}
}
{typeLabel(e.type)} {fmtInt(e.events_24h)} {fmtInt(e.events_7d)} {fmtInt(e.sources)} {fmtScore(e.avg_signal)} 0 ? "text-ok" : "text-fg-subtle"}>{Math.round(e.confirmed_ratio * 100)}% {fmtInt(e.silent_24h)} {fmtInt(e.breaking_24h)} {relTime(e.last_at)}
)}
); } async function All({ sp }: { sp: Search }) { const { items } = await api.entities({ type: sp.type, q: sp.q, limit: 400 }); const types = new Set(items.map((e) => e.type)); return ( <>
{sp.type && } {fmtInt(items.length)} entit{items.length === 1 ? "y" : "ies"}
all {ENTITY_TYPES.filter((t) => types.has(t) || t === sp.type).map((t) => ( {typeLabel(t)} ))}
{items.length === 0 ? ( No entities match. ) : ( {items.map((e) => ( ))}
{e.name} {typeLabel(e.type)} {e.domain ?? "—"} {fmtScore(e.importance)} {fmtInt(e.event_count)} {e.events_24h ?? 0} {e.last_event_at ? relTime(e.last_event_at) : "—"}
)}
); }