2020-01-27 16:57:27 +03:00
|
|
|
import React from "react";
|
2023-02-04 18:57:37 +03:00
|
|
|
import {
|
|
|
|
Admin,
|
|
|
|
CustomRoutes,
|
|
|
|
Resource,
|
|
|
|
resolveBrowserLocale,
|
|
|
|
} from "react-admin";
|
2020-02-07 18:29:11 +03:00
|
|
|
import polyglotI18nProvider from "ra-i18n-polyglot";
|
2020-02-07 18:35:21 +03:00
|
|
|
import authProvider from "./synapse/authProvider";
|
2020-02-07 18:10:43 +03:00
|
|
|
import dataProvider from "./synapse/dataProvider";
|
2024-02-05 15:44:00 +03:00
|
|
|
import users from "./components/users";
|
|
|
|
import rooms from "./components/rooms";
|
|
|
|
import userMediaStats from "./components/statistics";
|
|
|
|
import reports from "./components/EventReports";
|
|
|
|
import roomDirectory from "./components/RoomDirectory";
|
|
|
|
import destinations from "./components/destinations";
|
|
|
|
import registrationToken from "./components/RegistrationTokens";
|
2020-02-07 18:35:21 +03:00
|
|
|
import LoginPage from "./components/LoginPage";
|
2020-09-22 12:30:27 +03:00
|
|
|
import { ImportFeature } from "./components/ImportFeature";
|
|
|
|
import { Route } from "react-router-dom";
|
2020-02-07 18:29:11 +03:00
|
|
|
import germanMessages from "./i18n/de";
|
|
|
|
import englishMessages from "./i18n/en";
|
2023-01-24 23:41:56 +03:00
|
|
|
import frenchMessages from "./i18n/fr";
|
2021-05-04 14:58:13 +03:00
|
|
|
import chineseMessages from "./i18n/zh";
|
2023-08-31 15:50:44 +03:00
|
|
|
import italianMessages from "./i18n/it";
|
2020-02-07 18:29:11 +03:00
|
|
|
|
2024-02-05 19:32:32 +03:00
|
|
|
const fixed_base_url = undefined; // FIXME: process.env.REACT_APP_SERVER;
|
|
|
|
|
2020-02-07 18:29:11 +03:00
|
|
|
// TODO: Can we use lazy loading together with browser locale?
|
|
|
|
const messages = {
|
|
|
|
de: germanMessages,
|
|
|
|
en: englishMessages,
|
2023-01-24 23:41:56 +03:00
|
|
|
fr: frenchMessages,
|
2023-08-31 15:50:44 +03:00
|
|
|
it: italianMessages,
|
2021-05-04 14:58:13 +03:00
|
|
|
zh: chineseMessages,
|
2020-02-07 18:29:11 +03:00
|
|
|
};
|
|
|
|
const i18nProvider = polyglotI18nProvider(
|
|
|
|
locale => (messages[locale] ? messages[locale] : messages.en),
|
|
|
|
resolveBrowserLocale()
|
|
|
|
);
|
2020-01-27 16:57:27 +03:00
|
|
|
|
|
|
|
const App = () => (
|
2020-02-07 18:35:21 +03:00
|
|
|
<Admin
|
2021-03-01 11:26:58 +03:00
|
|
|
disableTelemetry
|
2024-02-06 14:42:19 +03:00
|
|
|
requireAuth
|
2020-02-07 18:35:21 +03:00
|
|
|
loginPage={LoginPage}
|
2024-02-05 19:32:32 +03:00
|
|
|
authProvider={authProvider(fixed_base_url)}
|
2020-02-07 18:35:21 +03:00
|
|
|
dataProvider={dataProvider}
|
|
|
|
i18nProvider={i18nProvider}
|
|
|
|
>
|
2023-02-04 18:57:37 +03:00
|
|
|
<CustomRoutes>
|
|
|
|
<Route path="/import_users" element={<ImportFeature />} />
|
|
|
|
</CustomRoutes>
|
2024-02-05 15:44:00 +03:00
|
|
|
<Resource {...users} />
|
|
|
|
<Resource {...rooms} />
|
|
|
|
<Resource {...userMediaStats} />
|
|
|
|
<Resource {...reports} />
|
|
|
|
<Resource {...roomDirectory} />
|
|
|
|
<Resource {...destinations} />
|
|
|
|
<Resource {...registrationToken} />
|
2020-03-28 23:25:34 +03:00
|
|
|
<Resource name="connections" />
|
2020-07-08 11:58:57 +03:00
|
|
|
<Resource name="devices" />
|
2020-08-06 22:43:19 +03:00
|
|
|
<Resource name="room_members" />
|
2021-02-11 23:11:34 +03:00
|
|
|
<Resource name="users_media" />
|
2021-02-11 22:45:02 +03:00
|
|
|
<Resource name="joined_rooms" />
|
2021-02-11 22:37:20 +03:00
|
|
|
<Resource name="pushers" />
|
2020-04-23 11:00:46 +03:00
|
|
|
<Resource name="servernotices" />
|
2021-05-08 20:10:51 +03:00
|
|
|
<Resource name="forward_extremities" />
|
2021-05-04 14:57:41 +03:00
|
|
|
<Resource name="room_state" />
|
2023-01-24 18:35:42 +03:00
|
|
|
<Resource name="destination_rooms" />
|
2020-01-27 16:57:27 +03:00
|
|
|
</Admin>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|