import type { WebhookActivityEntry } from '../../features/webhooks/types'; import { useT } from '../../lib/i18n/I18nContext'; interface WebhookActivityProps { activity: WebhookActivityEntry[]; } const METHOD_COLORS: Record = { GET: 'text-primary-600 bg-primary-50', POST: 'text-sage-700 bg-sage-50', PUT: 'text-amber-700 bg-amber-50', PATCH: 'text-amber-700 bg-amber-50', DELETE: 'text-coral-700 bg-coral-50', }; function statusColor(code: number | null): string { if (code === null) return 'text-stone-400'; if (code >= 200 && code < 300) return 'text-sage-600'; if (code >= 400 && code < 500) return 'text-amber-600'; if (code >= 500) return 'text-coral-600'; return 'text-stone-600'; } function formatTime(ts: number): string { return new Date(ts).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', second: '2-digit', }); } export default function WebhookActivity({ activity }: WebhookActivityProps) { const { t } = useT(); if (activity.length === 0) { return (

{t('webhooks.activity.title')}

{t('webhooks.activity.empty')}

); } return (

{t('webhooks.activity.title')}{' '} ({activity.length})

{activity.map(entry => (
{formatTime(entry.timestamp)} {entry.method} {entry.path || '/'} {entry.status_code ?? '---'} {entry.skill_id && ( {entry.skill_id} )} {entry.tunnel_name}
))}
); }