11import type { Span } from "dnd-timeline" ;
2- import { FolderOpen , Languages , Save } from "lucide-react" ;
2+ import { FolderOpen , Languages , Save , Video } from "lucide-react" ;
33import { useCallback , useEffect , useMemo , useRef , useState } from "react" ;
44import { Panel , PanelGroup , PanelResizeHandle } from "react-resizable-panels" ;
55import { toast } from "sonner" ;
6+ import {
7+ Dialog ,
8+ DialogContent ,
9+ DialogDescription ,
10+ DialogFooter ,
11+ DialogHeader ,
12+ DialogTitle ,
13+ } from "@/components/ui/dialog" ;
614import { useI18n , useScopedT } from "@/contexts/I18nContext" ;
715import { useShortcuts } from "@/contexts/ShortcutsContext" ;
816import { INITIAL_EDITOR_STATE , useEditorHistory } from "@/hooks/useEditorHistory" ;
@@ -117,6 +125,7 @@ export default function VideoEditor() {
117125 const [ exportProgress , setExportProgress ] = useState < ExportProgress | null > ( null ) ;
118126 const [ exportError , setExportError ] = useState < string | null > ( null ) ;
119127 const [ showExportDialog , setShowExportDialog ] = useState ( false ) ;
128+ const [ showNewRecordingDialog , setShowNewRecordingDialog ] = useState ( false ) ;
120129 const [ exportQuality , setExportQuality ] = useState < ExportQuality > ( "good" ) ;
121130 const [ exportFormat , setExportFormat ] = useState < ExportFormat > ( "mp4" ) ;
122131 const [ gifFrameRate , setGifFrameRate ] = useState < GifFrameRate > ( 15 ) ;
@@ -501,6 +510,16 @@ export default function VideoEditor() {
501510 await saveProject ( true ) ;
502511 } , [ saveProject ] ) ;
503512
513+ const handleNewRecordingConfirm = useCallback ( async ( ) => {
514+ const result = await window . electronAPI . startNewRecording ( ) ;
515+ if ( result . success ) {
516+ setShowNewRecordingDialog ( false ) ;
517+ } else {
518+ console . error ( "Failed to start new recording:" , result . error ) ;
519+ setError ( "Failed to start new recording: " + ( result . error || "Unknown error" ) ) ;
520+ }
521+ } , [ ] ) ;
522+
504523 const handleLoadProject = useCallback ( async ( ) => {
505524 const result = await window . electronAPI . loadProjectFile ( ) ;
506525
@@ -1482,6 +1501,34 @@ export default function VideoEditor() {
14821501
14831502 return (
14841503 < div className = "flex flex-col h-screen bg-[#09090b] text-slate-200 overflow-hidden selection:bg-[#34B27B]/30" >
1504+ < Dialog open = { showNewRecordingDialog } onOpenChange = { setShowNewRecordingDialog } >
1505+ < DialogContent
1506+ className = "sm:max-w-[425px]"
1507+ style = { { WebkitAppRegion : "no-drag" } as React . CSSProperties }
1508+ >
1509+ < DialogHeader >
1510+ < DialogTitle > { t ( "newRecording.title" ) } </ DialogTitle >
1511+ < DialogDescription > { t ( "newRecording.description" ) } </ DialogDescription >
1512+ </ DialogHeader >
1513+ < DialogFooter >
1514+ < button
1515+ type = "button"
1516+ onClick = { ( ) => setShowNewRecordingDialog ( false ) }
1517+ className = "px-4 py-2 rounded-md bg-white/10 text-white hover:bg-white/20 text-sm font-medium transition-colors"
1518+ >
1519+ { t ( "newRecording.cancel" ) }
1520+ </ button >
1521+ < button
1522+ type = "button"
1523+ onClick = { handleNewRecordingConfirm }
1524+ className = "px-4 py-2 rounded-md bg-[#34B27B] text-white hover:bg-[#34B27B]/90 text-sm font-medium transition-colors"
1525+ >
1526+ { t ( "newRecording.confirm" ) }
1527+ </ button >
1528+ </ DialogFooter >
1529+ </ DialogContent >
1530+ </ Dialog >
1531+
14851532 < div
14861533 className = "h-10 flex-shrink-0 bg-[#09090b]/80 backdrop-blur-md border-b border-white/5 flex items-center justify-between px-6 z-50"
14871534 style = { { WebkitAppRegion : "drag" } as React . CSSProperties }
@@ -1507,6 +1554,14 @@ export default function VideoEditor() {
15071554 ) ) }
15081555 </ select >
15091556 </ div >
1557+ < button
1558+ type = "button"
1559+ onClick = { ( ) => setShowNewRecordingDialog ( true ) }
1560+ className = "flex items-center gap-1 px-2 py-1 rounded-md text-white/50 hover:text-white/90 hover:bg-white/10 transition-all duration-150 text-[11px] font-medium"
1561+ >
1562+ < Video size = { 14 } />
1563+ { t ( "newRecording.title" ) }
1564+ </ button >
15101565 < button
15111566 type = "button"
15121567 onClick = { handleLoadProject }
0 commit comments