// Dialogs screen — 3-column layout const { useState: useStateD, useEffect: useEffectD, useRef: useRefD, useMemo: useMemoD } = React; function fmtClock(iso) { const d = new Date(iso); if (isNaN(d)) return ""; return d.toLocaleTimeString("ru-RU", { hour: "2-digit", minute: "2-digit" }); } function fmtDayLabel(iso) { const d = new Date(iso); if (isNaN(d)) return ""; const now = new Date(); const day = new Date(d.getFullYear(), d.getMonth(), d.getDate()); const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); const diffDays = Math.round((today - day) / 86400000); if (diffDays === 0) return "Сегодня"; if (diffDays === 1) return "Вчера"; const opts = { day: "numeric", month: "long" }; if (d.getFullYear() !== now.getFullYear()) opts.year = "numeric"; return d.toLocaleDateString("ru-RU", opts); } function msgTime(msg) { return msg.createdAt ? fmtClock(msg.createdAt) : msg.time; } function DaySeparator({ label }) { return (
{label}
); } function DeliveryStatus({ status, error }) { if (!status || status === "failed") return null; // Резервный канал: сообщение дошло, но не тем путём, каким должно было — // жёлтые галочки, а причина обхода в подсказке. if (status === "delivered_fallback") { return ( ✓✓ ); } const delivered = status === "delivered"; return ( {delivered ? "✓✓" : "✓"} ); } function StarRating({ rating, size = "sm" }) { if (!rating) return null; const sz = size === "lg" ? "text-base" : "text-[11px]"; return ( {[1,2,3,4,5].map(i => ( ★ ))} ); } // flat — вид для телефона: строка во всю ширину с разделителем вместо карточки // с закруглениями, чтобы список читался как обычный мобильный лист. function ConvCard({ conv, active, onClick, showServiceTag = false, flat = false, lockedForMe = false }) { // escalated but not yet served — grabs attention in «ИИ»/«Очередь» const calledUnserved = conv.operatorCalled && ["ai", "queue"].includes(conv.status); return ( ); } function FileContent({ msg, side, onImageClick }) { const ft = msg.fileType; const url = msg.fileUrl; const tl = side === "left" ? "rounded-tl-md" : "rounded-tr-md"; if (ft === "photo") { if (url) { return ( ); } return (
Фото
); } if (ft === "sticker") { if (url) { const isTgs = url.toLowerCase().endsWith(".tgs"); if (isTgs) { return (
); } return ( ); } return (
Стикер
); } if (ft === "video") { return url ?