From 57c1f12893638d0eceef04aa68c614901e753a39 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Fri, 1 Aug 2025 22:13:01 +0800 Subject: [PATCH] better button --- messages/en.json | 8 +++++- messages/zh.json | 8 +++++- src/app/studio/[id]/page.tsx | 54 ++++++++++++++++++++++++------------ 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/messages/en.json b/messages/en.json index bf197aa..624f74f 100644 --- a/messages/en.json +++ b/messages/en.json @@ -15,6 +15,10 @@ "edit": "Edit", "create": "Create", "duplicate": "Duplicate", + "copyContent": "Copy Content", + "copyToClipboard": "Copy to Clipboard", + "duplicatePrompt": "Duplicate Prompt", + "createCopy": "Create Copy", "search": "Search", "filter": "Filter", "close": "Close", @@ -159,7 +163,9 @@ "debugPrompt": "Debug Prompt", "promptEditor": "Prompt Editor", "testResults": "Test Results", - "versionHistory": "Version History" + "versionHistory": "Version History", + "copyPromptContent": "Copy Content", + "duplicateThisPrompt": "Create Copy" }, "home": { "hero": { diff --git a/messages/zh.json b/messages/zh.json index 937cbb0..6807547 100644 --- a/messages/zh.json +++ b/messages/zh.json @@ -15,6 +15,10 @@ "edit": "编辑", "create": "创建", "duplicate": "复制", + "copyContent": "复制内容", + "copyToClipboard": "复制到剪贴板", + "duplicatePrompt": "复制提示词", + "createCopy": "创建副本", "search": "搜索", "filter": "筛选", "close": "关闭", @@ -159,7 +163,9 @@ "debugPrompt": "调试提示词", "promptEditor": "提示词编辑器", "testResults": "测试结果", - "versionHistory": "版本历史" + "versionHistory": "版本历史", + "copyPromptContent": "复制内容", + "duplicateThisPrompt": "创建副本" }, "home": { "hero": { diff --git a/src/app/studio/[id]/page.tsx b/src/app/studio/[id]/page.tsx index f7a6918..0f61d8e 100644 --- a/src/app/studio/[id]/page.tsx +++ b/src/app/studio/[id]/page.tsx @@ -14,10 +14,11 @@ import { FullScreenLoading } from '@/components/ui/full-screen-loading' import { VersionTimeline, VersionTimelineRef } from '@/components/studio/VersionTimeline' import { Save, - Copy, ArrowLeft, FileText, - Clock + Clock, + Files, + Clipboard } from 'lucide-react' interface PromptPageProps { @@ -182,9 +183,21 @@ export default function PromptPage({ params }: PromptPageProps) { } } - const copyToClipboard = (text: string) => { - navigator.clipboard.writeText(text) - // Show success message + const copyToClipboard = async (text: string) => { + try { + await navigator.clipboard.writeText(text) + // Could add toast notification here in the future + console.log('Content copied to clipboard') + } catch (error) { + console.error('Failed to copy to clipboard:', error) + // Fallback for older browsers + const textArea = document.createElement('textarea') + textArea.value = text + document.body.appendChild(textArea) + textArea.select() + document.execCommand('copy') + document.body.removeChild(textArea) + } } const handleVersionSelect = (version: PromptVersion) => { @@ -318,20 +331,21 @@ export default function PromptPage({ params }: PromptPageProps) { -
+
@@ -382,7 +396,7 @@ export default function PromptPage({ params }: PromptPageProps) { {/* Action Bar (Mobile) */}
-
+
@@ -481,7 +498,7 @@ export default function PromptPage({ params }: PromptPageProps) {
{/* Action Bar */}
-
+