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-02-07 18:19:01 +03:00
|
|
|
import { RoomList } from "./components/rooms";
|
2020-02-07 18:35:21 +03:00
|
|
|
import LoginPage from "./components/LoginPage";
|
2020-02-07 19:44:48 +03:00
|
|
|
import UserIcon from "@material-ui/icons/Group";
|
2020-02-07 18:19:01 +03:00
|
|
|
import { ViewListIcon as RoomIcon } from "@material-ui/icons/ViewList";
|
2020-02-07 18:29:11 +03:00
|
|
|
import germanMessages from "./i18n/de";
|
|
|
|
import englishMessages from "./i18n/en";
|
|
|
|
|
|
|
|
// TODO: Can we use lazy loading together with browser locale?
|
|
|
|
const messages = {
|
|
|
|
de: germanMessages,
|
|
|
|
en: englishMessages,
|
|
|
|
};
|
|
|
|
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
|
|
|
|
loginPage={LoginPage}
|
|
|
|
authProvider={authProvider}
|
|
|
|
dataProvider={dataProvider}
|
|
|
|
i18nProvider={i18nProvider}
|
|
|
|
>
|
2020-02-07 19:44:48 +03:00
|
|
|
<Resource
|
|
|
|
name="users"
|
|
|
|
list={UserList}
|
|
|
|
create={UserCreate}
|
|
|
|
edit={UserEdit}
|
|
|
|
icon={UserIcon}
|
|
|
|
/>
|
2020-02-07 18:19:01 +03:00
|
|
|
<Resource name="rooms" list={RoomList} icon={RoomIcon} />
|
2020-03-28 23:25:34 +03:00
|
|
|
<Resource name="connections" />
|
2020-04-23 11:00:46 +03:00
|
|
|
<Resource name="servernotices" />
|
2020-01-27 16:57:27 +03:00
|
|
|
</Admin>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|