@@ -52,6 +52,8 @@ export function Header() {
5252 exportState,
5353 setExportState,
5454 customDomain,
55+ editorState,
56+ setEditorState,
5557 } = useEditorContext ( ) ;
5658
5759 let unlistenTitlebar : UnlistenFn | undefined ;
@@ -72,20 +74,38 @@ export function Header() {
7274 { ostype ( ) === "macos" && < div class = "h-full w-[4rem]" /> }
7375 < EditorButton
7476 onClick = { async ( ) => {
77+ if ( editorState . timeline . selection ) {
78+ setEditorState ( "timeline" , "selection" , null ) ;
79+ return ;
80+ }
81+
7582 if ( ! ( await ask ( "Are you sure you want to delete this recording?" ) ) )
7683 return ;
7784
7885 await commands . editorDeleteProject ( ) ;
7986 } }
80- tooltipText = "Delete recording"
87+ tooltipText = {
88+ editorState . timeline . selection
89+ ? "Close selection"
90+ : "Delete recording"
91+ }
8192 leftIcon = { < IconCapTrash class = "w-5" /> }
8293 />
8394 < EditorButton
8495 onClick = { ( ) => {
96+ if ( editorState . timeline . selection ) {
97+ setEditorState ( "timeline" , "selection" , null ) ;
98+ return ;
99+ }
100+
85101 console . log ( { path : `${ editorInstance . path } /` } ) ;
86102 revealItemInDir ( `${ editorInstance . path } /` ) ;
87103 } }
88- tooltipText = "Open recording bundle"
104+ tooltipText = {
105+ editorState . timeline . selection
106+ ? "Close selection"
107+ : "Open recording bundle"
108+ }
89109 leftIcon = { < IconLucideFolder class = "w-5" /> }
90110 />
91111
@@ -95,14 +115,30 @@ export function Header() {
95115 </ div >
96116 < div data-tauri-drag-region class = "flex-1 h-full" />
97117 < EditorButton
98- tooltipText = "Captions"
118+ onClick = { ( ) => {
119+ if ( editorState . timeline . selection ) {
120+ setEditorState ( "timeline" , "selection" , null ) ;
121+ return ;
122+ }
123+ } }
124+ tooltipText = {
125+ editorState . timeline . selection ? "Close selection" : "Captions"
126+ }
99127 leftIcon = { < IconCapCaptions class = "w-5" /> }
100- comingSoon
128+ comingSoon = { ! editorState . timeline . selection }
101129 />
102130 < EditorButton
103- tooltipText = "Performance"
131+ onClick = { ( ) => {
132+ if ( editorState . timeline . selection ) {
133+ setEditorState ( "timeline" , "selection" , null ) ;
134+ return ;
135+ }
136+ } }
137+ tooltipText = {
138+ editorState . timeline . selection ? "Close selection" : "Performance"
139+ }
104140 leftIcon = { < IconCapGauge class = "w-[18px]" /> }
105- comingSoon
141+ comingSoon = { ! editorState . timeline . selection }
106142 />
107143 </ div >
108144
@@ -121,15 +157,35 @@ export function Header() {
121157 ) }
122158 >
123159 < EditorButton
124- onClick = { ( ) => projectHistory . undo ( ) }
125- disabled = { ! projectHistory . canUndo ( ) }
126- tooltipText = "Undo"
160+ onClick = { ( ) => {
161+ if ( editorState . timeline . selection ) {
162+ setEditorState ( "timeline" , "selection" , null ) ;
163+ return ;
164+ }
165+ projectHistory . undo ( ) ;
166+ } }
167+ disabled = {
168+ ! projectHistory . canUndo ( ) && ! editorState . timeline . selection
169+ }
170+ tooltipText = {
171+ editorState . timeline . selection ? "Close selection" : "Undo"
172+ }
127173 leftIcon = { < IconCapUndo class = "w-5" /> }
128174 />
129175 < EditorButton
130- onClick = { ( ) => projectHistory . redo ( ) }
131- disabled = { ! projectHistory . canRedo ( ) }
132- tooltipText = "Redo"
176+ onClick = { ( ) => {
177+ if ( editorState . timeline . selection ) {
178+ setEditorState ( "timeline" , "selection" , null ) ;
179+ return ;
180+ }
181+ projectHistory . redo ( ) ;
182+ } }
183+ disabled = {
184+ ! projectHistory . canRedo ( ) && ! editorState . timeline . selection
185+ }
186+ tooltipText = {
187+ editorState . timeline . selection ? "Close selection" : "Redo"
188+ }
133189 leftIcon = { < IconCapRedo class = "w-5" /> }
134190 />
135191 < div data-tauri-drag-region class = "flex-1 h-full" />
@@ -140,6 +196,11 @@ export function Header() {
140196 variant = "dark"
141197 class = "flex gap-1.5 justify-center h-[40px] w-full max-w-[100px]"
142198 onClick = { ( ) => {
199+ if ( editorState . timeline . selection ) {
200+ setEditorState ( "timeline" , "selection" , null ) ;
201+ return ;
202+ }
203+
143204 trackEvent ( "export_button_clicked" ) ;
144205 if ( exportState . type === "done" ) setExportState ( { type : "idle" } ) ;
145206
0 commit comments