MCPcopy Create free account
hub / github.com/Recordscript/recordscript / App

Function App

src/App.tsx:319–1178  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

317}
318
319function App() {
320 const [popup, set_popup] = createSignal<JSX.Element | null>(null);
321 const [notification, set_notification] = createSignal<JSX.Element[]>([]);
322 const [active_tab, set_active_tab] = createSignal<ActiveTab>(ActiveTab.Recorder);
323
324 const [microphone, set_microphone] = createSignal<string | null>(null);
325 const [speaker, set_speaker] = createSignal<string | null>(null);
326 const [screen, set_screen] = createSignal<string | null>(null);
327
328 const [model, set_model] = createSignal<string>("SmallWhisper");
329 const [model_state, set_model_state] = createSignal(ModelState.Stopped);
330 const [model_download_progress, set_model_download_progress] = createSignal(0);
331
332 const [language, set_language] = createSignal("auto");
333
334 const [recording_state, set_recording_state] = createSignal(
335 RecorderState.Stopped,
336 );
337
338 const [microphones] = createInvokeResource<DeviceResult[]>("list_microphone");
339 const [speakers] = createInvokeResource<DeviceResult[]>("list_speaker");
340 const [screens] = createInvokeResource<DeviceResult[]>("list_screen");
341
342 const [general_config, { refetch: update_general_config }] =
343 createInvokeResource<GeneralConfig>("get_general_config");
344 const [smtp_config, { refetch: update_smtp_config }] = createInvokeResource<
345 SMTPConfig
346 >("get_smtp_config");
347
348 const [transcription_email_to, set_transcription_email_to] = createSignal("");
349
350 const [models, { refetch: update_models }] = createInvokeResource<Model[]>("list_model");
351 const [model_categories] = createInvokeResource<{ type: ModelCategory, name: string }[]>("list_model_categories");
352
353 createEffect(() => invoke("select_microphone", { deviceName: microphone() }));
354 createEffect(() => invoke("select_speaker", { deviceName: speaker() }));
355 createEffect(() => invoke("select_screen", { deviceName: screen() }));
356
357 createEffect(() => invoke("select_model", { model: model() }))
358 createEffect(() => invoke("select_language", { language: language() }));
359
360 (async () => {
361 if (!await isPermissionGranted()) {
362 await requestPermission();
363 }
364 })();
365
366 async function set_general_config(config: GeneralConfig) {
367 await invoke("set_general_config", { generalConfig: config });
368 update_general_config();
369 }
370
371 createEffect(() => {
372 let config = untrack(general_config)!;
373
374 config.transcription_email_to = transcription_email_to();
375
376 set_general_config(config);

Callers

nothing calls this directly

Calls 7

createInvokeResourceFunction · 0.85
push_notificationFunction · 0.85
NotificationErrorFunction · 0.85
NotificationInfoFunction · 0.85
delete_notificationFunction · 0.85
ElementFunction · 0.85
set_general_configFunction · 0.70

Tested by

no test coverage detected