feat(media): add summary and view more toggle button for video and podcast descriptions
Deploy Canina / deploy (push) Successful in 1m30s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 6s

This commit is contained in:
parsa aghaei committed 2026-08-26 17:17:19 +03:30
1 parent 5db23443ed
commit 40176ac60e
13 files changed
+4847 -4695

No files matched your search

@@ -12,7 +12,9 @@ import {
Check,
Headphones,
Loader2,
Sparkles
Sparkles,
ChevronDown,
ChevronUp
} from "lucide-react";
import SafeImage from "./SafeImage";
@@ -44,6 +46,7 @@ export default function PodcastInlinePlayer({ podcast }: PodcastInlinePlayerProp
const [showRateMenu, setShowRateMenu] = useState(false);
const [isBuffering, setIsBuffering] = useState(false);
const [isCopied, setIsCopied] = useState(false);
const [isExpandedDesc, setIsExpandedDesc] = useState(false);
// Close rate menu when clicking outside
useEffect(() => {
@@ -265,9 +268,27 @@ export default function PodcastInlinePlayer({ podcast }: PodcastInlinePlayerProp
<h4 className="text-base sm:text-lg font-black text-white line-clamp-1">
{podcast.title || "پادکست و بررسی صوتی بالینی مکمل"}
</h4>
<p className="text-xs text-white/70 font-medium leading-relaxed line-clamp-2 mt-1">
{podcast.description || "توضیحات صوتی دامپزشک و کادر علمی درباره اثربخشی، مکانیسم اثر و نحوه مصرف دقیق"}
</p>
{(() => {
const pDesc = podcast.description || "توضیحات صوتی دامپزشک و کادر علمی درباره اثربخشی، مکانیسم اثر و نحوه مصرف دقیق";
const isLong = pDesc.length > 120;
return (
<div className="space-y-1 mt-1">
<p className="text-xs text-white/70 font-medium leading-relaxed">
{isLong && !isExpandedDesc ? `${pDesc.slice(0, 120)}...` : pDesc}
</p>
{isLong && (
<button
type="button"
onClick={() => setIsExpandedDesc(prev => !prev)}
className="text-cyan-300 hover:text-cyan-200 text-[11px] font-bold inline-flex items-center gap-1 cursor-pointer transition-colors"
>
<span>{isExpandedDesc ? 'بستن متن' : 'مشاهده متن کامل'}</span>
{isExpandedDesc ? <ChevronUp className="w-3.5 h-3.5" /> : <ChevronDown className="w-3.5 h-3.5" />}
</button>
)}
</div>
);
})()}
</div>
{/* Soundcloud-Style Waveform Visualizer & Track */}
@@ -344,7 +365,7 @@ export default function PodcastInlinePlayer({ podcast }: PodcastInlinePlayerProp
</div>
{/* Central Controls: -15s on Left, Play in Center, +15s on Right in RTL */}
<div className="flex items-center gap-2 sm:gap-3" dir="rtl">
<div className="flex items-center gap-2 sm:gap-3" dir="ltr">
<button
type="button"
onClick={togglePlay}
@@ -94,6 +94,7 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
const [activeImage, setActiveImage] = useState<string | null>(null);
const [isImageZoomOpen, setIsImageZoomOpen] = useState(false);
const [isVideoModalOpen, setIsVideoModalOpen] = useState(false);
const [isFullVideoDescOpen, setIsFullVideoDescOpen] = useState(false);
useEffect(() => {
Promise.resolve().then(() => setIsMounted(true));
@@ -831,9 +832,27 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
<h4 className="text-lg font-black text-white">
{product.videoTitle || "ویدیو راهنمای مصرف و معرفی مکمل"}
</h4>
<p className="text-xs text-white/70 font-medium leading-relaxed">
{product.videoDescription || "مشاهده ویدیوی آموزشی، دوزبندی دقیق و نحوه مصرف مکمل توسط کادر علمی کنینا"}
</p>
{(() => {
const vDesc = product.videoDescription || "مشاهده ویدیوی آموزشی، دوزبندی دقیق و نحوه مصرف مکمل توسط کادر علمی کنینا";
const isLong = vDesc.length > 120;
return (
<div className="space-y-1.5">
<p className="text-xs text-white/70 font-medium leading-relaxed">
{isLong && !isFullVideoDescOpen ? `${vDesc.slice(0, 120)}...` : vDesc}
</p>
{isLong && (
<button
type="button"
onClick={() => setIsFullVideoDescOpen(prev => !prev)}
className="text-cyan-300 hover:text-cyan-200 text-[11px] font-bold inline-flex items-center gap-1 cursor-pointer transition-colors"
>
<span>{isFullVideoDescOpen ? 'بستن متن' : 'مشاهده متن کامل'}</span>
{isFullVideoDescOpen ? <ChevronUp className="w-3.5 h-3.5" /> : <ChevronDown className="w-3.5 h-3.5" />}
</button>
)}
</div>
);
})()}
<div className="pt-2 flex justify-center md:justify-start">
<button
type="button"