import React, { useState, useEffect } from 'react'; import { Sparkles, Search, Stamp, BookOpen, ChevronRight, X, RefreshCw, Box, Shapes, Type, PenTool, Maximize2, ZoomIn, RotateCcw } from 'lucide-react'; const JADE_TYPES = [ { id: 'hetian', name: '和田羊脂玉', desc: '温润如脂,精光内蕴', prompt: 'Mutton-fat White Jade, translucent, greasy luster' }, { id: 'feicui', name: '翡翠冰种', desc: '澄澈如水,翠意生辉', prompt: 'Ice-type Green Jadeite, glass-like transparency' }, { id: 'xiuyan', name: '岫岩老玉', desc: '质地朴茂,古韵悠长', prompt: 'Xiu-jade, dark green with natural stone texture' }, { id: 'dushan', name: '独山玉', desc: '色彩斑斓,如梦似幻', prompt: 'Dushan Jade, multi-color patterns' }, { id: 'nanred', name: '南红玛瑙', desc: '色泽鲜红,温润饱满', prompt: 'Southern Red Agate, deep solid red, semi-translucent' } ]; const JADE_SHAPES = ['山子', '牌片', '圆雕件', '手把件', '随形料', '器皿']; const SEAL_MATERIALS = [ { id: 'tianhuang', name: '寿山田黄', color: '#ffb300', texture: 'warm yellow honey-like stone with radish-silk veins' }, { id: 'jixue', name: '昌化鸡血', color: '#d32f2f', texture: 'bright cinnabar red patches on grey stone base' }, { id: 'furong', name: '寿山芙蓉', color: '#f8bbd0', texture: 'pale pink porcelain-like stone texture' }, { id: 'qingtian', name: '青田封门', color: '#c5e1a5', texture: 'olive green semi-translucent stone' }, { id: 'balin', name: '巴林福黄', color: '#ffd54f', texture: 'bright glassy yellow stone' }, { id: 'kunlun', name: '昆仑冻石', color: '#e0f2f1', texture: 'crystal-like translucent white stone' }, { id: 'yaan', name: '雅安绿', color: '#4caf50', texture: 'vibrant emerald green stone texture' }, { id: 'chongqing', name: '重庆漆石', color: '#212121', texture: 'pitch black polished lacquer-like stone' } ]; const SEAL_FONTS = [ { id: 'zhuanshu', name: '秦汉篆书', style: 'seal script style, rounded and balanced lines' }, { id: 'lishu', name: '汉隶碑刻', style: 'clerical script style, flared strokes, ancient and thick' }, { id: 'kaishu', name: '唐风楷书', style: 'regular script style, sharp and formal strokes' }, { id: 'xingshu', name: '文人行书', style: 'running script style, fluid and elegant cursive strokes' } ]; async function generateNanoBananaImage(prompt, aspectRatio = "1:1") { const apiKey = ""; // Runtime auto-fill const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent?key=${apiKey}`; const payload = { contents: [{ role: 'user', parts: [{ text: prompt }] }], generationConfig: { responseModalities: ['IMAGE'], imageConfig: { aspectRatio: aspectRatio } } }; try { const response = await fetch(apiUrl, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); if (!response.ok) throw new Error('Generation failed'); const result = await response.json(); const part = result?.candidates?.[0]?.content?.parts?.find(p => p.inlineData); if (part) { return `data:${part.inlineData.mimeType};base64,${part.inlineData.data}`; } return null; } catch (error) { console.error("Image generation error:", error); return null; } } export default function JadeDesignApp() { const [activeTab, setActiveTab] = useState('相玉定形'); const [previewImage, setPreviewImage] = useState(null); return (
{/* 侧边导航 - 典雅金石风格 */} {/* 主操作区 - 类似展厅的灯光感 */}
{activeTab === '相玉定形' && } {activeTab === '方寸金石' && }
{/* 全屏大图预览 */} {previewImage && (
setPreviewImage(null)} > Preview Full e.stopPropagation()} />
)}
); } function ModuleDesign({ onShowFull }) { const initialForm = { type: JADE_TYPES[0].name, shape: JADE_SHAPES[0], appearance: '', design: '' }; const [formData, setFormData] = useState(initialForm); const [generating, setGenerating] = useState(false); const [imgUrl, setImgUrl] = useState(null); const handleReset = () => { setFormData(initialForm); setImgUrl(null); }; const handleGenerate = async () => { if (!formData.appearance || !formData.design) return; setGenerating(true); const typeObj = JADE_TYPES.find(t => t.name === formData.type); const prompt = `Extreme realistic professional museum macro photography. Subject: A master-level Chinese jade carving. Material: ${typeObj.prompt}, high subsurface scattering, realistic oily or icy texture. Form: ${formData.shape}. Raw stone features incorporated: ${formData.appearance}. Artistic Concept: ${formData.design}. Lighting: Soft side lighting to reveal texture and depth, dark neutral background, 8k resolution, cinematic quality.`; const url = await generateNanoBananaImage(prompt, "1:1"); if (url) setImgUrl(url); setGenerating(false); }; return (

相玉定形

AI-DRIVEN JADE ARTISTRY

{/* Input fields with elegant labels */}
{JADE_SHAPES.map(s => ( ))}