The Activity component is a page-local component used by the /events page to render individual event log entries.
The component operates on the exported AppEvent type, representing a single generic event:
export type AppEvent = {
id: string;
ts: number | string | null;
type: string;
payload: unknown;
};| Prop | Type | Required | Notes |
|---|---|---|---|
event |
AppEvent |
yes | The event object to render. |
- Header row: Displays the
event.typein a monospace, uppercase format. - Timestamps:
- Parses the
tsfield. If it is a valid finite number, it renders aTimeAgocomponent for a relative timestamp. - Always formats and displays an absolute timestamp string alongside it, utilizing
safeFormatTimestampfromsrc/lib/format.ts.
- Parses the
- Payload body: Safely stringifies
event.payload(usingsafeStringifyfromsrc/lib/format.tswhich handles circular references and length limits) and renders it inside a<pre>block that is scrollable if it exceedsmax-h-96.
import { Activity, AppEvent } from "@/app/events/Activity";
const event: AppEvent = {
id: "evt_12345",
type: "payment.succeeded",
ts: 1672531200000,
payload: {
amount: 1500,
currency: "XLM",
status: "settled"
}
};
<ul className="flex flex-col gap-4">
<Activity event={event} />
</ul>