diff --git a/frontend/src/components/VideoCard.jsx b/frontend/src/components/VideoCard.jsx index d01a0a1..792c202 100644 --- a/frontend/src/components/VideoCard.jsx +++ b/frontend/src/components/VideoCard.jsx @@ -4,6 +4,15 @@ import { useNavigate } from "react-router-dom"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { createDownload, toggleQueue, toggleLike, dismissDiscovery, getSettings } from "../api"; +function snippetText(desc) { + if (!desc) return ""; + return desc + .replace(/https?:\/\/\S+/g, "") // strip URLs + .replace(/\n+/g, " ") // flatten newlines + .replace(/\s{2,}/g, " ") // collapse whitespace + .trim(); +} + function formatDuration(secs) { if (!secs) return null; const h = Math.floor(secs / 3600); @@ -302,10 +311,10 @@ export default function VideoCard({ video, size = "md", onDismiss, variant = "gr )} - {/* Description — desktop only, 2 lines max */} - {video.description && ( -
- {video.description.replace(/\n+/g, " ")} + {/* Description snippet — desktop only, URLs stripped */} + {video.description && snippetText(video.description) && ( +
+ {snippetText(video.description)}
)} diff --git a/frontend/src/pages/Watch.jsx b/frontend/src/pages/Watch.jsx index efdb36c..e27c0b9 100644 --- a/frontend/src/pages/Watch.jsx +++ b/frontend/src/pages/Watch.jsx @@ -66,8 +66,8 @@ function linkify(text) { function DescriptionBox({ text }) { const [expanded, setExpanded] = useState(false); const lines = text.split("\n"); - const hasMore = lines.length > 4 || text.length > 300; - const displayed = expanded ? text : lines.slice(0, 4).join("\n") + (hasMore ? "…" : ""); + const hasMore = lines.length > 2 || text.length > 200; + const displayed = expanded ? text : lines.slice(0, 2).join("\n") + (hasMore ? "…" : ""); return (