element-call/src/App.jsx

57 lines
1.8 KiB
React
Raw Normal View History

2021-07-16 21:38:44 +00:00
/*
Copyright 2021 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
2021-07-27 19:27:59 +00:00
import React from "react";
2021-12-09 20:58:30 +00:00
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
2021-10-06 18:38:26 +00:00
import * as Sentry from "@sentry/react";
2021-12-09 20:58:30 +00:00
import { OverlayProvider } from "@react-aria/overlays";
2021-08-20 00:49:45 +00:00
import { Home } from "./Home";
2021-08-20 23:23:12 +00:00
import { LoginPage } from "./LoginPage";
2021-12-09 20:58:30 +00:00
import { RegisterPage } from "./RegisterPage";
import { Room } from "./Room";
import { ClientProvider } from "./ConferenceCallManagerHooks";
2021-07-16 21:22:03 +00:00
2021-10-06 18:38:26 +00:00
const SentryRoute = Sentry.withSentryRouting(Route);
2021-12-09 20:58:30 +00:00
const { protocol, host } = window.location;
// Assume homeserver is hosted on same domain (proxied in development by vite)
const homeserverUrl = `${protocol}//${host}`;
2021-07-16 21:22:03 +00:00
2021-12-09 20:58:30 +00:00
export default function App() {
2021-07-16 21:22:03 +00:00
return (
2021-12-04 00:42:29 +00:00
<Router>
2021-12-09 20:58:30 +00:00
<ClientProvider homeserverUrl={homeserverUrl}>
<OverlayProvider>
2021-12-04 00:42:29 +00:00
<Switch>
2021-12-09 20:58:30 +00:00
<SentryRoute exact path="/">
<Home />
</SentryRoute>
2021-12-04 00:42:29 +00:00
<SentryRoute exact path="/login">
2021-12-09 20:58:30 +00:00
<LoginPage />
2021-12-04 00:42:29 +00:00
</SentryRoute>
<SentryRoute exact path="/register">
2021-12-09 20:58:30 +00:00
<RegisterPage />
2021-12-04 00:42:29 +00:00
</SentryRoute>
<SentryRoute path="/room/:roomId?">
2021-12-09 20:58:30 +00:00
<Room />
2021-12-04 00:42:29 +00:00
</SentryRoute>
</Switch>
2021-12-09 20:58:30 +00:00
</OverlayProvider>
</ClientProvider>
2021-12-04 00:42:29 +00:00
</Router>
2021-07-16 21:22:03 +00:00
);
}