"use client";
|
|
import { Dialog, Transition } from '@headlessui/react';
|
import { Fragment } from 'react';
|
|
interface SceneIntroDialogProps {
|
isOpen: boolean;
|
onClose: () => void;
|
onStartChat: () => void;
|
scene: {
|
title: string;
|
description: string;
|
imageUrl: string;
|
background?: string;
|
instructions?: string;
|
};
|
}
|
|
export default function SceneIntroDialog({
|
isOpen,
|
onClose,
|
onStartChat,
|
scene
|
}: SceneIntroDialogProps) {
|
return (
|
<Transition appear show={isOpen} as={Fragment}>
|
<Dialog as="div" className="relative z-50" onClose={onClose}>
|
<Transition.Child
|
as={Fragment}
|
enter="ease-out duration-300"
|
enterFrom="opacity-0"
|
enterTo="opacity-100"
|
leave="ease-out duration-200"
|
leaveFrom="opacity-100"
|
leaveTo="opacity-0"
|
>
|
<div className="fixed inset-0 bg-black/70" />
|
</Transition.Child>
|
|
<div className="fixed inset-0 overflow-y-auto">
|
<div className="flex min-h-full items-center justify-center p-4">
|
<Transition.Child
|
as={Fragment}
|
enter="ease-out duration-300"
|
enterFrom="opacity-0 scale-95"
|
enterTo="opacity-100 scale-100"
|
leave="ease-out duration-200"
|
leaveFrom="opacity-100 scale-100"
|
leaveTo="opacity-0 scale-95"
|
>
|
<Dialog.Panel className="w-full max-w-2xl transform overflow-hidden rounded-2xl bg-gradient-to-br from-[#1E2B63] to-[#0A1033] p-6 shadow-xl transition-all">
|
{/* 科技感背景效果 */}
|
<div className="absolute inset-0 overflow-hidden pointer-events-none">
|
<div className="absolute inset-0 opacity-10"
|
style={{
|
backgroundImage: 'radial-gradient(circle, rgba(106, 219, 255, 0.3) 1px, transparent 1px)',
|
backgroundSize: '20px 20px'
|
}}>
|
</div>
|
<div className="absolute top-0 left-0 right-0 h-[1px] bg-gradient-to-r from-transparent via-[#6ADBFF]/40 to-transparent"></div>
|
<div className="absolute bottom-0 left-0 right-0 h-[1px] bg-gradient-to-r from-transparent via-[#6ADBFF]/40 to-transparent"></div>
|
</div>
|
|
<div className="relative">
|
{/* 标题 */}
|
<Dialog.Title className="text-2xl font-bold text-white mb-4">
|
<span className="text-transparent bg-clip-text bg-gradient-to-r from-[#6ADBFF] to-[#5E72EB]">
|
{scene.title}
|
</span>
|
</Dialog.Title>
|
|
{/* 场景图片 */}
|
<div className="relative h-48 mb-6 rounded-lg overflow-hidden">
|
<img
|
src={scene.imageUrl}
|
alt={scene.title}
|
className="w-full h-full object-cover"
|
/>
|
<div className="absolute inset-0 bg-gradient-to-t from-[#0A1033]/80 to-transparent"></div>
|
</div>
|
|
{/* 场景背景 */}
|
<div className="mb-6">
|
<h3 className="text-lg font-semibold text-[#6ADBFF] mb-2">场景背景</h3>
|
<p className="text-gray-300 leading-relaxed">
|
{scene.background || scene.description}
|
</p>
|
</div>
|
|
{/* 使用说明 */}
|
<div className="mb-8">
|
<h3 className="text-lg font-semibold text-[#6ADBFF] mb-2">使用说明</h3>
|
<p className="text-gray-300 leading-relaxed">
|
{scene.instructions || '通过自然语言对话的方式,描述您的具体需求,AI助手将为您提供专业的解决方案。'}
|
</p>
|
</div>
|
|
{/* 按钮组 */}
|
<div className="flex justify-end gap-4">
|
<button
|
onClick={onClose}
|
className="px-4 py-2 text-sm font-medium text-gray-300 hover:text-white transition-colors"
|
>
|
关闭
|
</button>
|
<button
|
onClick={onStartChat}
|
className="relative px-6 py-2 rounded-lg overflow-hidden group backdrop-blur-sm bg-white/5 border border-[#6ADBFF]/30 hover:border-[#6ADBFF]/50 transition-all duration-300"
|
>
|
<div className="absolute inset-0 bg-gradient-to-r from-[#6ADBFF]/5 to-[#5E72EB]/5 group-hover:from-[#6ADBFF]/10 group-hover:to-[#5E72EB]/10 transition-all duration-300"></div>
|
<span className="relative text-white group-hover:text-[#6ADBFF] transition-colors duration-300">
|
开始使用
|
</span>
|
</button>
|
</div>
|
</div>
|
</Dialog.Panel>
|
</Transition.Child>
|
</div>
|
</div>
|
</Dialog>
|
</Transition>
|
);
|
}
|