From 4b2cf58922587ecb17b990a9575e46320bdb3118 Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Mon, 21 Sep 2026 23:28:03 +0200 Subject: [PATCH] dashboard: show the full clip 'why' in a popover when it is clamped The line is clamped to two lines so cards in a row stay level; a long sentence then reads as '...how easily audiences...' with the rest only in the native title tooltip. When the text actually overflows, hovering (desktop) or tapping (touch) now floats the whole sentence over the card, so nothing grows and the grid stays aligned. --- dashboard/src/components/ResultCard.jsx | 41 ++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/dashboard/src/components/ResultCard.jsx b/dashboard/src/components/ResultCard.jsx index b6c84d3..2927dfb 100644 --- a/dashboard/src/components/ResultCard.jsx +++ b/dashboard/src/components/ResultCard.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import { Download, Share2, Instagram, Youtube, Video, AlertCircle, Loader2, Copy, Check, Wand2, Type, Calendar, Languages, FileText, Link2, Scissors, Crosshair, TrendingUp } from 'lucide-react'; import { getApiUrl } from '../config'; import { apiFetch } from '../lib/api'; @@ -38,6 +38,20 @@ function formatDuration(clip) { export default function ResultCard({ clip, index, jobId, durable, uploadPostKey, uploadUserId, geminiApiKey, elevenLabsKey, isManaged, onPlay, onPause, onBulkSubtitle, clipCount = 1, bulkProgress, initialState = null, onStateChange, connectedPlatforms = null, onConnectSocials, onEditClip = null, onReframeClip = null }) { const [showModal, setShowModal] = useState(false); + // The "why" line is clamped to two lines so cards in a row stay level; + // when it overflows, a hover (desktop) or tap (touch) shows the whole + // sentence in a popover that floats over the card instead of growing it. + const whyRef = useRef(null); + const [whyOpen, setWhyOpen] = useState(false); + const [whyClamped, setWhyClamped] = useState(false); + useEffect(() => { + const el = whyRef.current; + if (!el) return; + const check = () => setWhyClamped(el.scrollHeight > el.clientHeight + 1); + check(); + window.addEventListener('resize', check); + return () => window.removeEventListener('resize', check); + }, [clip.why]); const [showDescModal, setShowDescModal] = useState(false); const [showSubtitleModal, setShowSubtitleModal] = useState(false); const [showWatermarkModal, setShowWatermarkModal] = useState(false); @@ -819,9 +833,28 @@ export default function ResultCard({ clip, index, jobId, durable, uploadPostKey, {/* The score alone says how much, not why. One line from the selection pass on what this moment has going for it. */} {clip.why && ( -

- {clip.why} -

+
setWhyOpen(true)} + onMouseLeave={() => setWhyOpen(false)} + > +

whyClamped && setWhyOpen(v => !v)} + aria-label="why openshorts picked this moment" + > + {clip.why} +

+ {whyClamped && whyOpen && ( +
+ {clip.why} +
+ )} +
)}
{durationReadout && {durationReadout}}