"use client" import type React from "react" import { useState } from "react" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog" import { AlertCircle, Loader2, Send } from "lucide-react" type PublishConfirmationDialogProps = { title: string description: string itemName: string onPublish: () => Promise trigger?: React.ReactNode } export function PublishConfirmationDialog({ title, description, itemName, onPublish, trigger, }: PublishConfirmationDialogProps) { const [open, setOpen] = useState(false) const [isPublishing, setIsPublishing] = useState(false) const handlePublish = async () => { setIsPublishing(true) try { await onPublish() setOpen(false) } catch (error) { console.error("发布失败:", error) // 失败处理已经在onPublish中处理,这里不需要额外处理 } finally { setIsPublishing(false) } } return ( {trigger || ( )} {title} {description}

您确定要发布 {itemName} 吗?

重要提示

一旦发布后,将不能再修改任何卡片属性,包括名称、描述、音频等信息。请确认所有信息正确无误。

) }