"use client"; import type { CameraCredit } from "@/lib/types"; /** "3 min ago (14:02)" for an epoch-seconds catalog/feed fetch time. */ export function fetchedLabel(epochS: number | null | undefined): string | null { if (!epochS) return null; const ms = epochS * 1000; const m = Math.round((Date.now() - ms) / 60_000); const t = new Date(ms).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }); return m < 1 ? `just now (${t})` : `${m} min ago (${t})`; } /** * Source credit + freshness + pass-through disclaimer for third-party data * (511NY DAA: credit as a source credit only, "display the time at which the * data was published or last updated wherever you present it", and "best * efforts" to pass on NYSDOT's as-is disclaimer). Render it wherever that * provider's data or imagery is shown. */ export function SourceCredit({ credit, updated, fallbackName, className, }: { credit?: CameraCredit | null; /** Human-readable "updated …" text; required by the DAA wherever 511NY data shows. */ updated?: string | null; fallbackName?: string; className?: string; }) { const name = credit?.attribution ?? fallbackName ?? null; return (
{credit.disclaimer}