MCPcopy
hub / github.com/CapSoftware/Cap / Inner

Function Inner

apps/desktop/src/routes/editor/Editor.tsx:279–762  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

277}
278
279function 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(() => {

Callers

nothing calls this directly

Calls 13

createTauriEventListenerFunction · 0.90
appendRecordedClipFunction · 0.85
isClipsModeFunction · 0.85
scheduleIdleWorkFunction · 0.85
clampTimelineHeightFunction · 0.85
onFunction · 0.85
updateConfigAndRenderFunction · 0.85
previewResolutionBaseFunction · 0.85
emitRenderFrameFunction · 0.85
fullscreenModeFunction · 0.85
isTranscriptModeFunction · 0.85
normalizeFunction · 0.70

Tested by

no test coverage detected