"use client"
import { useState } from "react"
import { Card, CardContent } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Badge } from "@/components/ui/badge"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
import { FileText, ImageIcon, Video, LinkIcon, FileAudio, Tag, Clock, Check, X } from "lucide-react"
import Image from "next/image"
import type { ContentLibraryFormData } from "../page"
interface PreviewAndConfirmProps {
formData: ContentLibraryFormData
onSubmit: () => void
onPrevious: () => void
}
export function PreviewAndConfirm({ formData, onSubmit, onPrevious }: PreviewAndConfirmProps) {
const [isSubmitting, setIsSubmitting] = useState(false)
const getContentTypeIcon = (type: string) => {
switch (type) {
case "text":
return
case "image":
return
case "video":
return
case "link":
return
case "audio":
return
default:
return null
}
}
const getContentTypeName = (type: string) => {
switch (type) {
case "text":
return "文本"
case "image":
return "图片"
case "video":
return "视频"
case "link":
return "链接"
case "audio":
return "音频"
default:
return type
}
}
const getLibraryTypeName = (type: string) => {
switch (type) {
case "friends":
return "微信好友"
case "groups":
return "微信群"
case "moments":
return "朋友圈"
case "mixed":
return "混合来源"
default:
return type
}
}
const getSyncIntervalText = (hours: number) => {
if (hours === 1) return "每1小时"
if (hours === 6) return "每6小时"
if (hours === 12) return "每12小时"
if (hours === 24) return "每天"
if (hours === 168) return "每周"
return `每${hours}小时`
}
const handleSubmit = async () => {
setIsSubmitting(true)
try {
await onSubmit()
} finally {
setIsSubmitting(false)
}
}
return (
预览确认
请确认内容库的设置信息,确认无误后点击"创建内容库"
基础信息
来源信息
内容设置
标签信息
{formData.description && (
内容库描述
{formData.description}
)}
内容库类型
{getLibraryTypeName(formData.type)}
启用状态
{formData.enabled ? (
<>
已启用
>
) : (
<>
已禁用
>
)}
已选择的来源
{formData.sources.length > 0 ? (
formData.sources.map((source) => (
{source.name}
{source.type === "friend" ? "微信好友" : source.type === "group" ? "微信群" : "公众号"}
))
) : (
未选择任何来源
)}
来源总数
{formData.sources.length} 个来源
内容类型
{formData.contentTypes.map((type) => (
{getContentTypeIcon(type)}
{getContentTypeName(type)}
))}
同步设置
{formData.autoSync ? (
<>
自动同步
{getSyncIntervalText(formData.syncInterval)}
>
) : (
<>
手动同步
>
)}
标签
{formData.tags.length > 0 ? (
{formData.tags.map((tag) => (
{tag}
))}
) : (
未添加任何标签
)}
)
}