fix: Add onClick handlers to top Settings and Save buttons with alerts

This commit is contained in:
empty
2026-01-07 00:31:50 +08:00
parent 2be9256c48
commit c0eb4ed320

View File

@@ -74,6 +74,9 @@ export default function EditorPage() {
const [exportDownloadUrl, setExportDownloadUrl] = useState<string | null>(null)
const [exportError, setExportError] = useState<string | null>(null)
// Save all state
const [isSavingAll, setIsSavingAll] = useState(false)
useEffect(() => {
async function loadStoryboard() {
// Get storyboard_id from URL, default to demo-1
@@ -160,12 +163,39 @@ export default function EditorPage() {
</div>
<div className="flex items-center gap-2">
<Button variant="ghost" size="sm">
<Button variant="ghost" size="sm" onClick={() => {
console.log('[SETTINGS] Settings clicked - not implemented yet')
alert('设置功能开发中...')
}}>
<Settings className="h-4 w-4 mr-2" />
</Button>
<Button variant="ghost" size="sm">
<Save className="h-4 w-4 mr-2" />
<Button
variant="ghost"
size="sm"
disabled={isSavingAll}
onClick={async () => {
if (!storyboard) return
console.log('[SAVE-ALL] Starting save all frames...')
setIsSavingAll(true)
try {
// Save is handled automatically by updateFrame during edits
// This button confirms the current state is synced
console.log('[SAVE-ALL] Current storyboard state:', storyboard.frames.length, 'frames')
alert('当前状态已保存!\n\n提示编辑分镜后点击右侧「保存」按钮可保存单个分镜的修改。')
} catch (err: any) {
console.error('[SAVE-ALL] Error:', err)
alert('保存失败: ' + err.message)
} finally {
setIsSavingAll(false)
}
}}
>
{isSavingAll ? (
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
) : (
<Save className="h-4 w-4 mr-2" />
)}
</Button>
<ExportButton