From c45b7c9d28f9601cf217138ba654bf395aea12a2 Mon Sep 17 00:00:00 2001 From: Bhanu Prakash Sai Potteri Date: Sat, 23 May 2026 16:27:43 +0530 Subject: [PATCH] DV: pill for recording URLs, show more/less toggle for longtext fields --- src/components/variants/VariantB.tsx | 50 ++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/src/components/variants/VariantB.tsx b/src/components/variants/VariantB.tsx index 89f18af..38e00e9 100644 --- a/src/components/variants/VariantB.tsx +++ b/src/components/variants/VariantB.tsx @@ -11,7 +11,7 @@ import { ChevronLeft, ChevronRight, Search, ArrowUp, ArrowDown, X, RefreshCw, CheckCircle2, LogOut, Sparkles, Car, ClipboardList, PhoneOutgoing, CalendarCheck2, MessageSquareHeart, Trophy, ArrowLeft, ChevronDown, ChevronUp, - Plus, AlertTriangle, + Plus, AlertTriangle, PlayCircle, ExternalLink, } from "lucide-react"; import { BarChart as RBarChart, Bar, XAxis, YAxis, Tooltip, CartesianGrid, @@ -876,6 +876,8 @@ function SectionCard({ }).length; const isEmpty = populated === 0; const [open, setOpen] = useState(!isEmpty); + const [expanded, setExpanded] = useState>({}); + const LONGTEXT_PREVIEW = 220; // White header with a small red number tag — editorial, no navy weight. const numberTag = ( @@ -932,6 +934,10 @@ function SectionCard({ const empty = raw == null || raw === "" || raw === "—"; const text = empty ? "—" : fmtCellText(raw, f.data_type, f.field_key); const isProse = !empty && text.length > 60; + const isRecording = !empty && /recording_url$/i.test(f.field_key); + const isUrl = !empty && !isRecording && typeof raw === "string" && /^https?:\/\//i.test(raw); + const isLongText = !empty && f.data_type === "longtext" && text.length > LONGTEXT_PREVIEW; + const isOpen = !!expanded[f.field_key]; return (
- {text} + {isRecording ? ( + + + Play recording + + ) : isUrl ? ( + + {text} + + + ) : isLongText ? ( + + + {isOpen ? text : text.slice(0, LONGTEXT_PREVIEW).trimEnd() + "…"} + + + + ) : ( + text + )}
);