import { useState } from 'react' import { Check, Copy } from 'lucide-react' import { PLATFORMS, charLen, platformCopy, type PlatformKey } from '@/film/core/copy' import { quoteById } from '@/film/core/film' async function copyText(s: string) { try { await navigator.clipboard.writeText(s) return true } catch { const ta = document.createElement('textarea') ta.value = s ta.style.position = 'fixed' ta.style.opacity = '0' document.body.appendChild(ta) ta.select() const ok = document.execCommand('copy') ta.remove() return ok } } function CopyBtn({ text, label }: { text: string; label: string }) { const [ok, setOk] = useState(false) return ( ) } export default function CopyPanel({ id }: { id: number }) { const q = quoteById(id) const [tab, setTab] = useState('xhs') const p = PLATFORMS.find((x) => x.key === tab)! const c = platformCopy(id, q.text, tab) const tags = c.tags.map((t) => `#${t}`).join(' ') const tl = charLen(c.title) const all = `${c.title}\n\n${c.desc}\n\n${tags}` return (
{PLATFORMS.map((x) => ( ))}
标题 p.titleMax ? 'text-red-400' : 'text-emerald-400'}>{tl}/{p.titleMax} 字

{c.title}

描述

{c.desc}

话题 {c.tags.length}{p.tagMax ? `/${p.tagMax}` : ' 个(不限)'}
{c.tags.map((t) => #{t})}
) }