()
| 277 | } |
| 278 | |
| 279 | function Inner() { |
| 280 | const { |
| 281 | project, |
| 282 | editorInstance, |
| 283 | editorState, |
| 284 | setEditorState, |
| 285 | previewResolutionBase, |
| 286 | dialog, |
| 287 | exportState, |
| 288 | } = useEditorContext(); |
| 289 | |
| 290 | createTauriEventListener(events.editorRecordingAdded, (payload) => { |
| 291 | const normalize = (p: string) => p.replace(/[\\/]+$/, ""); |
| 292 | if (normalize(payload.editor_path) !== normalize(editorInstance.path)) |
| 293 | return; |
| 294 | void appendRecordedClip(payload.recording_path); |
| 295 | }); |
| 296 | |
| 297 | const appendRecordedClip = async (recordingPath: string) => { |
| 298 | const toastId = toast.loading("Adding clip…"); |
| 299 | try { |
| 300 | if (editorState.playing) { |
| 301 | await commands.stopPlayback(); |
| 302 | setEditorState("playing", false); |
| 303 | } |
| 304 | await commands.setProjectConfig(serializeProjectConfiguration(project)); |
| 305 | await commands.addExistingRecordingToEditor(recordingPath); |
| 306 | await commands.deleteRecordingDirectory(recordingPath).catch(() => {}); |
| 307 | toast.success("Clip added", { id: toastId }); |
| 308 | window.location.reload(); |
| 309 | } catch (error) { |
| 310 | const message = error instanceof Error ? error.message : String(error); |
| 311 | toast.error(`Failed to add clip: ${message}`, { id: toastId }); |
| 312 | } |
| 313 | }; |
| 314 | |
| 315 | const isExportMode = () => { |
| 316 | const d = dialog(); |
| 317 | return "type" in d && d.type === "export" && d.open; |
| 318 | }; |
| 319 | |
| 320 | const isTranscriptMode = () => { |
| 321 | const d = dialog(); |
| 322 | return "type" in d && d.type === "transcript" && d.open; |
| 323 | }; |
| 324 | |
| 325 | const isClipsMode = () => { |
| 326 | const d = dialog(); |
| 327 | return "type" in d && d.type === "clips" && d.open; |
| 328 | }; |
| 329 | |
| 330 | const [clipsSidebarMounted, setClipsSidebarMounted] = createSignal(false); |
| 331 | |
| 332 | createEffect(() => { |
| 333 | if (isClipsMode()) setClipsSidebarMounted(true); |
| 334 | }); |
| 335 | |
| 336 | onMount(() => { |
nothing calls this directly
no test coverage detected