2020-01-27 16:57:27 +03:00
|
|
|
import React from "react";
|
2020-02-07 18:29:11 +03:00
|
|
|
import { Admin, Resource, resolveBrowserLocale } from "react-admin";
|
|
|
|
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";
|
2020-02-07 19:44:48 +03:00
|
|
|
import { UserList, UserCreate, UserEdit } from "./components/users";
|
2020-07-07 22:28:20 +03:00
|
|
|
import { RoomList, RoomShow } from "./components/rooms";
|
2021-01-04 11:14:33 +03:00
|
|
|
import { ReportList, ReportShow } from "./components/EventReports";
|
2020-02-07 18:35:21 +03:00
|
|
|
import LoginPage from "./components/LoginPage";
|
2023-01-24 23:27:02 +03:00
|
|
|
import ConfirmationNumberIcon from "@mui/icons-material/ConfirmationNumber";
|
|
|
|
import CloudQueueIcon from "@mui/icons-material/CloudQueue";
|
|
|
|
import EqualizerIcon from "@mui/icons-material/Equalizer";
|
|
|
|
import UserIcon from "@mui/icons-material/Group";
|
2021-02-11 23:14:02 +03:00
|
|
|
import { UserMediaStatsList } from "./components/statistics";
|
2023-01-24 23:27:02 +03:00
|
|
|
import RoomIcon from "@mui/icons-material/ViewList";
|
|
|
|
import ReportIcon from "@mui/icons-material/Warning";
|
|
|
|
import FolderSharedIcon from "@mui/icons-material/FolderShared";
|
2023-01-24 18:35:42 +03:00
|
|
|
import { DestinationList, DestinationShow } from "./components/destinations";
|
2020-09-22 12:30:27 +03:00
|
|
|
import { ImportFeature } from "./components/ImportFeature";
|
2022-02-17 22:45:21 +03:00
|
|
|
import {
|
|
|
|
RegistrationTokenCreate,
|
|
|
|
RegistrationTokenEdit,
|
|
|
|
RegistrationTokenList,
|
|
|
|
} from "./components/RegistrationTokens";
|
2021-05-04 14:52:43 +03:00
|
|
|
import { RoomDirectoryList } from "./components/RoomDirectory";
|
2020-09-22 12:30:27 +03:00
|
|
|
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
|
|
|
|
|
|
|
// 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
|
2020-02-07 18:35:21 +03:00
|
|
|
loginPage={LoginPage}
|
|
|
|
authProvider={authProvider}
|
|
|
|
dataProvider={dataProvider}
|
|
|
|
i18nProvider={i18nProvider}
|
2020-09-22 12:30:27 +03:00
|
|
|
customRoutes={[
|
|
|
|
<Route key="userImport" path="/import_users" component={ImportFeature} />,
|
|
|
|
]}
|
2020-02-07 18:35:21 +03:00
|
|
|
>
|
2020-02-07 19:44:48 +03:00
|
|
|
<Resource
|
|
|
|
name="users"
|
|
|
|
list={UserList}
|
|
|
|
create={UserCreate}
|
|
|
|
edit={UserEdit}
|
|
|
|
icon={UserIcon}
|
|
|
|
/>
|
2020-07-07 22:28:20 +03:00
|
|
|
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
|
2021-02-11 23:14:02 +03:00
|
|
|
<Resource
|
|
|
|
name="user_media_statistics"
|
|
|
|
list={UserMediaStatsList}
|
|
|
|
icon={EqualizerIcon}
|
|
|
|
/>
|
2021-01-04 11:14:33 +03:00
|
|
|
<Resource
|
|
|
|
name="reports"
|
|
|
|
list={ReportList}
|
|
|
|
show={ReportShow}
|
|
|
|
icon={ReportIcon}
|
|
|
|
/>
|
2021-05-04 14:52:43 +03:00
|
|
|
<Resource
|
|
|
|
name="room_directory"
|
|
|
|
list={RoomDirectoryList}
|
|
|
|
icon={FolderSharedIcon}
|
|
|
|
/>
|
2023-01-24 18:35:42 +03:00
|
|
|
<Resource
|
|
|
|
name="destinations"
|
|
|
|
list={DestinationList}
|
|
|
|
show={DestinationShow}
|
|
|
|
icon={CloudQueueIcon}
|
|
|
|
/>
|
2022-02-17 22:45:21 +03:00
|
|
|
<Resource
|
|
|
|
name="registration_tokens"
|
|
|
|
list={RegistrationTokenList}
|
|
|
|
create={RegistrationTokenCreate}
|
|
|
|
edit={RegistrationTokenEdit}
|
|
|
|
icon={ConfirmationNumberIcon}
|
|
|
|
/>
|
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;
|