fix: Add onClick handlers to top Settings and Save buttons with alerts
This commit is contained in:
@@ -74,6 +74,9 @@ export default function EditorPage() {
|
|||||||
const [exportDownloadUrl, setExportDownloadUrl] = useState<string | null>(null)
|
const [exportDownloadUrl, setExportDownloadUrl] = useState<string | null>(null)
|
||||||
const [exportError, setExportError] = useState<string | null>(null)
|
const [exportError, setExportError] = useState<string | null>(null)
|
||||||
|
|
||||||
|
// Save all state
|
||||||
|
const [isSavingAll, setIsSavingAll] = useState(false)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function loadStoryboard() {
|
async function loadStoryboard() {
|
||||||
// Get storyboard_id from URL, default to demo-1
|
// Get storyboard_id from URL, default to demo-1
|
||||||
@@ -160,12 +163,39 @@ export default function EditorPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-2">
|
<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" />
|
<Settings className="h-4 w-4 mr-2" />
|
||||||
设置
|
设置
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="sm">
|
<Button
|
||||||
<Save className="h-4 w-4 mr-2" />
|
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>
|
</Button>
|
||||||
<ExportButton
|
<ExportButton
|
||||||
|
|||||||
Reference in New Issue
Block a user