fix: update canvas chat panel header to match official design
This commit is contained in:
parent
77b2b765ea
commit
7704a799f8
@ -463,34 +463,9 @@ export default function CanvasEditorPage({ params }: PageProps) {
|
|||||||
isPanelOpen ? "translate-x-0 opacity-100" : "translate-x-[120%] opacity-0"
|
isPanelOpen ? "translate-x-0 opacity-100" : "translate-x-[120%] opacity-0"
|
||||||
)}>
|
)}>
|
||||||
<div className="h-full w-full rounded-2xl border bg-background/95 backdrop-blur-md shadow-2xl overflow-hidden flex flex-col">
|
<div className="h-full w-full rounded-2xl border bg-background/95 backdrop-blur-md shadow-2xl overflow-hidden flex flex-col">
|
||||||
{/* 移除 Tabs 组件,直接显示 AI 对话面板 */}
|
{/* AI 对话内容 */}
|
||||||
<div className="flex flex-col h-full">
|
<div className="flex-1 overflow-hidden">
|
||||||
<div className="px-4 pt-4 pb-2 bg-muted/30 border-b flex items-center justify-between">
|
<CanvasChatPanel chatId={`canvas-${id}`} onClose={() => setIsPanelOpen(false)} />
|
||||||
<div className="flex items-center gap-2 text-sm font-medium">
|
|
||||||
<MessageSquare className="h-4 w-4" />
|
|
||||||
AI 对话
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Integrated Close Button */}
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger asChild>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="icon"
|
|
||||||
onClick={() => setIsPanelOpen(false)}
|
|
||||||
className="h-8 w-8 rounded-lg hover:bg-background/50"
|
|
||||||
>
|
|
||||||
<PanelRightClose className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent>隐藏面板</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* AI 对话内容 */}
|
|
||||||
<div className="flex-1 overflow-hidden">
|
|
||||||
<CanvasChatPanel chatId={`canvas-${id}`} />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import { ImageParamsBar, type ImageGenerationParams } from "@/components/image-p
|
|||||||
interface CanvasChatPanelProps {
|
interface CanvasChatPanelProps {
|
||||||
chatId: string;
|
chatId: string;
|
||||||
initialMessages?: ChatMessage[];
|
initialMessages?: ChatMessage[];
|
||||||
|
onClose?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 建议卡片数据 - 已移除
|
// 建议卡片数据 - 已移除
|
||||||
@ -54,7 +55,7 @@ function extractImageUrls(text: string): string[] {
|
|||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CanvasChatPanel({ chatId, initialMessages = [] }: CanvasChatPanelProps) {
|
export function CanvasChatPanel({ chatId, initialMessages = [], onClose }: CanvasChatPanelProps) {
|
||||||
const [input, setInput] = useState("");
|
const [input, setInput] = useState("");
|
||||||
const [attachments, setAttachments] = useState<Attachment[]>([]);
|
const [attachments, setAttachments] = useState<Attachment[]>([]);
|
||||||
const [selectedModelId, setSelectedModelId] = useState<string>("");
|
const [selectedModelId, setSelectedModelId] = useState<string>("");
|
||||||
@ -312,28 +313,41 @@ export function CanvasChatPanel({ chatId, initialMessages = [] }: CanvasChatPane
|
|||||||
const isLoading = status === 'streaming' || status === 'submitted';
|
const isLoading = status === 'streaming' || status === 'submitted';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full bg-background/50 backdrop-blur-sm">
|
<div className="flex flex-col h-full bg-background/50 backdrop-blur-sm relative">
|
||||||
{/* Header - Minimal with Icons */}
|
{/* Header - Minimal with Icons */}
|
||||||
<div className="flex items-center justify-end gap-1 p-3 border-b bg-background/80 backdrop-blur-md sticky top-0 z-10">
|
<div className="absolute top-0 right-0 z-20 p-4 flex flex-col items-end gap-2">
|
||||||
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full">
|
<div className="flex items-center gap-1">
|
||||||
<Plus className="h-4 w-4" />
|
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full hover:bg-muted">
|
||||||
</Button>
|
<Plus className="h-4 w-4" />
|
||||||
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full">
|
</Button>
|
||||||
<History className="h-4 w-4" />
|
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full hover:bg-muted">
|
||||||
</Button>
|
<History className="h-4 w-4" />
|
||||||
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full">
|
</Button>
|
||||||
<Share2 className="h-4 w-4" />
|
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full hover:bg-muted">
|
||||||
</Button>
|
<Share2 className="h-4 w-4" />
|
||||||
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full">
|
</Button>
|
||||||
<LayoutGrid className="h-4 w-4" />
|
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full hover:bg-muted">
|
||||||
</Button>
|
<LayoutGrid className="h-4 w-4" />
|
||||||
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full">
|
</Button>
|
||||||
<Maximize2 className="h-4 w-4" />
|
<Button variant="ghost" size="icon" className="h-8 w-8 rounded-full hover:bg-muted">
|
||||||
</Button>
|
<Maximize2 className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{onClose && (
|
||||||
|
<Button
|
||||||
|
variant="secondary"
|
||||||
|
size="sm"
|
||||||
|
onClick={onClose}
|
||||||
|
className="h-7 px-3 text-xs rounded-full bg-muted/80 backdrop-blur-sm hover:bg-muted shadow-sm"
|
||||||
|
>
|
||||||
|
收起
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* 消息列表 */}
|
{/* 消息列表 */}
|
||||||
<ScrollArea className="flex-1 p-4">
|
<ScrollArea className="flex-1 p-4 pt-16">
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
{messages.length === 0 && (
|
{messages.length === 0 && (
|
||||||
<div className="flex flex-col h-full pt-4">
|
<div className="flex flex-col h-full pt-4">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user