"use client"; import Image from "next/image"; import { ArrowLeft, Play, Heart, Bookmark, MessageCircle, Share2, ExternalLink } from "lucide-react"; import { useRouter } from "next/navigation"; import { getPlatformConfig } from "@muse/shared"; import { formatCount, formatTime } from "@/lib/format"; import { FavoriteButton } from "@/components/common/FavoriteButton"; import type { ContentItem } from "@muse/shared"; import { useState } from "react"; interface DetailPanelProps { item: ContentItem; } const STAT_ITEMS = [ { key: "play_count" as const, label: "播放", icon: Play }, { key: "like_count" as const, label: "点赞", icon: Heart }, { key: "collect_count" as const, label: "收藏", icon: Bookmark }, { key: "comment_count" as const, label: "评论", icon: MessageCircle }, { key: "share_count" as const, label: "分享", icon: Share2 }, ]; export function DetailPanel({ item }: DetailPanelProps) { const router = useRouter(); const platform = getPlatformConfig(item.platform); const [imgError, setImgError] = useState(false); return (
{/* Back button */} {/* Cover image */}
{item.cover_url && !imgError ? ( {item.title} setImgError(true)} /> ) : (
{platform?.icon || "📄"}
)}
{/* Content */}
{/* Platform tag */} {platform && ( {platform.icon} {platform.name} )} {/* Title */}

{item.title}

{/* Author */}
{item.author_avatar ? ( {item.author_name} { (e.target as HTMLImageElement).style.display = "none"; }} /> ) : (
👤
)}

{item.author_name}

{item.publish_time && (

{formatTime(item.publish_time)}

)}
{/* Stats panel */}
{STAT_ITEMS.map(({ key, label, icon: Icon }) => { const value = item[key]; return (
{formatCount(value) || "0"} {label}
); })}
{/* Tags */} {item.tags && item.tags.length > 0 && (
{item.tags.map((tag) => ( #{tag} ))}
)} {/* Actions */}
); }