diff --git a/frontend/src/components/ui/dev-dialog.tsx b/frontend/src/components/ui/dev-dialog.tsx deleted file mode 100644 index 36b600bf..00000000 --- a/frontend/src/components/ui/dev-dialog.tsx +++ /dev/null @@ -1,148 +0,0 @@ -"use client"; - -import * as React from "react"; -import * as DialogPrimitive from "@radix-ui/react-dialog"; -import { XIcon } from "lucide-react"; - -import { cn } from "@/lib/utils"; - -function DevDialog({ - ...props -}: React.ComponentProps) { - return ; -} - -function DevDialogTrigger({ - ...props -}: React.ComponentProps) { - return ; -} - -function DevDialogPortal({ - ...props -}: React.ComponentProps) { - return ; -} - -function DevDialogClose({ - ...props -}: React.ComponentProps) { - return ; -} - -function DevDialogOverlay({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -function DevDialogContent({ - className, - children, - showCloseButton = true, - ...props -}: React.ComponentProps & { - showCloseButton?: boolean; -}) { - return ( - - - - {children} - {showCloseButton && ( - - - Close - - )} - - - ); -} - -function DevDialogHeader({ className, ...props }: React.ComponentProps<"div">) { - return ( -
- ); -} - -function DevDialogFooter({ - className, - singleColumn = false, - ...props -}: React.ComponentProps<"div"> & { singleColumn?: boolean }) { - return ( -
- ); -} - -function DevDialogTitle({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -function DevDialogDescription({ - className, - ...props -}: React.ComponentProps) { - return ( - - ); -} - -export { - DevDialog, - DevDialogClose, - DevDialogContent, - DevDialogDescription, - DevDialogFooter, - DevDialogHeader, - DevDialogOverlay, - DevDialogPortal, - DevDialogTitle, - DevDialogTrigger, -}; diff --git a/frontend/src/components/workspace/dev-todo-list.tsx b/frontend/src/components/workspace/dev-todo-list.tsx deleted file mode 100644 index 466d395a..00000000 --- a/frontend/src/components/workspace/dev-todo-list.tsx +++ /dev/null @@ -1,69 +0,0 @@ -"use client"; - -import type { Todo } from "@/core/todos"; -import { cn } from "@/lib/utils"; - -import { - QueueItem, - QueueItemContent, - QueueItemIndicator, - QueueList, -} from "../ai-elements/queue"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuTrigger, -} from "../ui/dropdown-menu"; - -export function DevTodoList({ - className, - todos, - trigger, - hidden, -}: { - className?: string; - todos: Todo[]; - trigger: React.ReactNode; - hidden: boolean; -}) { - if (hidden) { - return null; - } - console.log(todos); - return ( - - {trigger} - - - {todos.map((todo, i) => ( - -
- - - {todo.content} - -
-
- ))} -
-
-
- ); -} diff --git a/frontend/src/components/workspace/iframe-test-panel.tsx b/frontend/src/components/workspace/iframe-test-panel.tsx deleted file mode 100644 index 1b5a92d4..00000000 --- a/frontend/src/components/workspace/iframe-test-panel.tsx +++ /dev/null @@ -1,270 +0,0 @@ -"use client"; - -import { useSearchParams, useRouter } from "next/navigation"; -import { useState } from "react"; - -import { Button } from "@/components/ui/button"; -import { useIframeSkill } from "@/hooks/use-iframe-skill"; -import { copyToClipboard } from "@/lib/utils"; -import { cn } from "@/lib/utils"; - -/** - * IframeTestPanel —— 仅用于开发阶段测试 iframe 通信功能 - * - * 测试场景: - * 1. mode=skill 侧边栏隐藏 - * 2. useSpecificChatMode 注入提示词 - * 3. sendSelectSkill / openSkillDialog / clearSkill - */ -export function IframeTestPanel() { - const router = useRouter(); - const searchParams = useSearchParams(); - const iframeSkill = useIframeSkill(); - const [log, setLog] = useState([]); - const [open, setOpen] = useState(true); - - const isSkillMode = searchParams.get("mode") === "skill"; - - function addLog(msg: string) { - setLog((prev) => [ - `[${new Date().toLocaleTimeString()}] ${msg}`, - ...prev.slice(0, 9), - ]); - } - - function handleEnterSkillMode() { - router.push(`?mode=skill&skill_id=123&title=测试技能`); - addLog("进入 mode=skill,URL 已更新"); - } - - function handleExitSkillMode() { - router.push(`?`); - addLog("退出 skill 模式"); - } - - function handleSendSelectSkill() { - iframeSkill.sendSelectSkill("skill_001"); - addLog("postMessage → selectSkill (skill_id=skill_001)"); - } - - function handleOpenSkillDialog() { - iframeSkill.openSkillDialog(); - addLog("postMessage → openSkillDialog"); - } - - function handleClearSkill() { - iframeSkill.clearSkill(); - addLog("clearSkill 已调用,postMessage → skill_id=0"); - } - - function handleTestClipboardCopy() { - const testText = "测试复制内容 - " + new Date().toISOString(); - void copyToClipboard(testText); - addLog(`copyToClipboard → "${testText.slice(0, 30)}..."`); - } - - // 检测是否在 iframe 中 - const isInIframe = typeof window !== "undefined" && window.self !== window.top; - if (!open) { - return ( - - ); - } - return ( -
- {/* 标题栏 */} -
- 🧪 iframe 通信测试 - -
- -
- {/* 当前状态 */} -
-
当前状态
-
- - mode: - - {isSkillMode ? "skill ✅" : "普通"} - - - - selectedSkill: - - {iframeSkill.selectedSkill - ? `${iframeSkill.selectedSkill.skill_id} / ${iframeSkill.selectedSkill.title}` - : "无"} - - -
-
- - {/* 场景 1:侧边栏隐藏 */} -
-
- ① 侧边栏隐藏(layout) -
-
- - -
-
- - {/* 场景 2:skill 选择通信 */} -
-
- ② postMessage 通信(发送到宿主) -
-
- - - -
-
- - {/* 场景 3:接收宿主页 selectedSkill */} -
-
- ③ 接收宿主页 selectedSkill -
-
- - -
-
- - {/* 场景 4:剪贴板复制(iframe 通信) */} -
-
- - ④ 剪贴板复制(iframe 通信) - - - {isInIframe ? "iframe 模式" : "独立页面"} - -
-
- -
- {isInIframe - ? "将通过 postMessage 请求父页面复制" - : "将直接调用 navigator.clipboard"} -
-
-
- - {/* 日志 */} - {log.length > 0 && ( -
-
- 操作日志 -
- {log.map((l, i) => ( -
- {l} -
- ))} -
- )} -
-
- ); -}