import React from 'react'; import { createRoutesFromChildren, matchRoutes, Navigate, Route, Routes, useLocation, useNavigationType, } from 'react-router-dom'; import * as Sentry from '@sentry/react'; import { useClientPath } from './common/hooks/useClientPath'; import Log from './features/log/Log'; import withPreset from './features/PresetWrapper'; import withData from './features/viewers/ViewWrapper'; import ViewLoader from './views/ViewLoader'; import { ONTIME_VERSION } from './ONTIME_VERSION'; import { sentryDsn, sentryRecommendedIgnore } from './sentry.config'; const Editor = React.lazy(() => import('./features/editors/ProtectedEditor')); const Cuesheet = React.lazy(() => import('./views/cuesheet/ProtectedCuesheet')); const Operator = React.lazy(() => import('./features/operator/OperatorExport')); const TimerView = React.lazy(() => import('./views/timer/Timer')); const MinimalTimerView = React.lazy(() => import('./features/viewers/minimal-timer/MinimalTimer')); const ClockView = React.lazy(() => import('./features/viewers/clock/Clock')); const Countdown = React.lazy(() => import('./views/countdown/Countdown')); const Backstage = React.lazy(() => import('./views/backstage/Backstage')); const Timeline = React.lazy(() => import('./views/timeline/TimelinePage')); const Lower = React.lazy(() => import('./features/viewers/lower-thirds/LowerThird')); const StudioClock = React.lazy(() => import('./features/viewers/studio/StudioClock')); const ProjectInfo = React.lazy(() => import('./views/project-info/ProjectInfo')); const STimer = withPreset(withData(TimerView)); const SMinimalTimer = withPreset(withData(MinimalTimerView)); const SClock = withPreset(withData(ClockView)); const SCountdown = withPreset(withData(Countdown)); const SBackstage = withPreset(withData(Backstage)); const SProjectInfo = withPreset(withData(ProjectInfo)); const SLowerThird = withPreset(withData(Lower)); const SStudio = withPreset(withData(StudioClock)); const STimeline = withPreset(withData(Timeline)); const PCuesheet = withPreset(Cuesheet); const POperator = withPreset(Operator); const EditorFeatureWrapper = React.lazy(() => import('./features/EditorFeatureWrapper')); const RundownPanel = React.lazy(() => import('./features/rundown/RundownExport')); const TimerControl = React.lazy(() => import('./features/control/playback/TimerControlExport')); const MessageControl = React.lazy(() => import('./features/control/message/MessageControlExport')); Sentry.init({ dsn: sentryDsn, integrations: [ Sentry.reactRouterV6BrowserTracingIntegration({ useEffect: React.useEffect, useLocation, useNavigationType, createRoutesFromChildren, matchRoutes, }), ], tracesSampleRate: 0.3, release: ONTIME_VERSION, enabled: import.meta.env.PROD, ignoreErrors: [...sentryRecommendedIgnore, /Unable to preload CSS/i, /dynamically imported module/i], denyUrls: [/extensions\//i, /^chrome:\/\//i, /^chrome-extension:\/\//i], }); const SentryRoutes = Sentry.withSentryReactRouterV6Routing(Routes); export default function AppRouter() { // handle client path changes useClientPath(); return ( } /> } /> } /> } /> } /> } /> } /> {/*/!* Lower third cannot have a loading screen *!/*/} } /> } /> } /> {/*/!* Protected Routes *!/*/} } /> } /> } /> {/*/!* Protected Routes - Elements *!/*/} } /> } /> } /> } /> {/*/!* Send to default if nothing found *!/*/} } /> ); }