import { Menu, PanelLeftClose, Pencil } from "lucide-react"; import "./TopBar.css"; import { getNewsTimeframeLabel } from "../constants/timeframes.js"; function fmt(n) { if (n == null) return "—"; if (n >= 1000) return new Intl.NumberFormat("en-US").format(n); return String(n); } function fmtTime(iso) { if (!iso) return "—"; const d = new Date(iso); return d.toLocaleString("en-GB", { year: "numeric", month: "short", day: "2-digit", hour: "2-digit", minute: "2-digit", }); } function divLabel(d) { if (d == null) return { text: "—", tone: "" }; if (d > 0.7) return { text: "high", tone: "danger" }; if (d > 0.45) return { text: "moderate", tone: "warn" }; return { text: "low", tone: "neutral" }; } export default function TopBar({ query, meta, metaLoading, menuOpen, onToggleMenu, onEditTopic, }) { const div = divLabel(meta?.divergenceIndex); return (