"use client"; import Link from "next/link"; import { ChevronLeft, Heart, Share2 } from "lucide-react"; import toast from "react-hot-toast"; import type { Artist } from "@/types/artist"; import { TAG_LABEL } from "@/types/artist"; import ArtistPortrait from "@/components/cards/ArtistPortrait"; import VoteModal from "@/components/VoteModal"; import Button from "@/components/ui/Button"; import RankCard from "./RankCard"; import PerformanceVideo from "./PerformanceVideo"; import PerformanceGallery from "./PerformanceGallery"; import FloatingVoteButton from "@/components/FloatingVoteButton"; import { useVoteStore, selectArtist } from "@/lib/store"; import { useVoteAction } from "@/hooks/useVoteAction"; interface ArtistDetailContentProps { artist: Artist; allArtists: Artist[]; } export default function ArtistDetailContent({ artist: initialArtist, allArtists: initialAll, }: ArtistDetailContentProps) { // 用 store 数据覆盖(这样投票后票数能马上变) const storeArtist = useVoteStore(selectArtist(initialArtist.id)); const storeAll = useVoteStore((s) => s.artists); const artist = storeArtist ?? initialArtist; const allArtists = storeAll.length ? storeAll : initialAll; const { target, remaining, dailyQuota, openVote, closeVote, confirmVote } = useVoteAction(); const handleShare = async () => { const url = typeof window !== "undefined" ? `${window.location.origin}/artist/${artist.id}` : `/artist/${artist.id}`; const shareData = { title: `${artist.name} · CYBER STAR`, text: `为 ${artist.name}(${artist.enName})打 Call!${artist.slogan}`, url, }; // 优先用 Web Share API(移动端 / Safari 支持) if (typeof navigator !== "undefined" && navigator.share) { try { await navigator.share(shareData); return; } catch { // 用户取消分享:不报错 return; } } // 兜底:复制到剪贴板 try { await navigator.clipboard.writeText(url); toast.success("链接已复制,去粘贴给朋友吧~"); } catch { toast.error("复制失败,请手动复制地址栏"); } }; return ( <>
全部艺人 / 艺人详情
应援色 {artist.themeColor}
No.{artist.no}

{artist.name}

{artist.enName}

{artist.tags.map((t) => ( {TAG_LABEL[t]} ))}

视频不会自动播放,避免流量浪费

{artist.bio}

openVote(artist)} /> ); } function MetaCell({ label, value }: { label: string; value: string }) { return (
{label}
{value}
); } function BioMeta({ label, value }: { label: string; value: string }) { return (
{label} {value}
); } function SectionHeading({ title, subtitle, }: { title: string; subtitle: string; }) { return (

{title}

{subtitle}
); }