import { invoke } from "@tauri-apps/api/core"; import React from "react"; import ReactDOM from "react-dom/client"; import { App } from "./app"; import { initDesktopSentry } from "./lib/sentry"; import { Bubble } from "./overlays/bubble"; import { Countdown } from "./overlays/countdown"; import { Finalizing } from "./overlays/finalizing"; import { FlowBar } from "./overlays/flow-bar"; import { MeetingNotification } from "./overlays/meeting-notification"; import { MeetingNub } from "./overlays/meeting-nub"; import { Onboarding } from "./overlays/onboarding"; import { Preparing } from "./overlays/preparing"; import { RecordingPill } from "./overlays/recording-pill"; import { RegionGuideEditor, RegionGuides } from "./overlays/region-guides"; import { RegionRecordBorder } from "./overlays/region-record-border"; import { Toolbar } from "./overlays/toolbar"; import "./styles.css"; /** * One bundle, one HTML, many views. We pick which component to mount based * on the URL hash so each Tauri window (spawned from Rust with * `index.html#`) renders only what it needs. */ function currentRoute(): string { const hash = window.location.hash.replace(/^#/, "").toLowerCase(); return hash || "popover"; } function installRouteAttributes(route: string): void { document.documentElement.dataset.clipsRoute = route; document.body.dataset.clipsRoute = route; } function pickRoute(route: string): React.ReactElement { switch (route) { case "countdown": return ; case "toolbar": return ; case "bubble": return ; case "finalizing": return ; case "preparing": return ; case "onboarding": return ; case "meeting-notif": return ; case "meeting-nub": return ; case "flow-bar": return ; case "recording-pill": return ; case "region-guides": return ; case "region-guides-editor": return ; case "region-capture-selector": return ; case "region-record-border": return ; default: return ; } } /** * Last-ditch cleanup on window teardown. * * React cleanup doesn't always run when a Tauri webview is destroyed — in * production the window close path tears down the webview process directly * without giving React a chance to flush effect cleanups. That's usually * fine for our overlay windows (the whole webview heap goes with them), * but the popover webview stays alive across entire recording sessions, * and hot-reload in dev can tear down the JS page without React cleanup * firing either. `beforeunload` catches those paths. * * We iterate every `