2020-01-27 13:57:27 +00:00
|
|
|
import React from "react";
|
2020-02-07 15:29:11 +00:00
|
|
|
import { Admin, Resource, resolveBrowserLocale } from "react-admin";
|
|
|
|
import polyglotI18nProvider from "ra-i18n-polyglot";
|
2020-02-07 15:35:21 +00:00
|
|
|
import authProvider from "./synapse/authProvider";
|
2020-02-07 15:10:43 +00:00
|
|
|
import dataProvider from "./synapse/dataProvider";
|
2020-02-07 16:44:48 +00:00
|
|
|
import { UserList, UserCreate, UserEdit } from "./components/users";
|
2020-07-07 19:28:20 +00:00
|
|
|
import { RoomList, RoomShow } from "./components/rooms";
|
2020-02-07 15:35:21 +00:00
|
|
|
import LoginPage from "./components/LoginPage";
|
2020-02-07 16:44:48 +00:00
|
|
|
import UserIcon from "@material-ui/icons/Group";
|
2020-02-07 15:19:01 +00:00
|
|
|
import { ViewListIcon as RoomIcon } from "@material-ui/icons/ViewList";
|
2020-02-07 15:29:11 +00: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 13:57:27 +00:00
|
|
|
|
|
|
|
const App = () => (
|
2020-02-07 15:35:21 +00:00
|
|
|
<Admin
|
|
|
|
loginPage={LoginPage}
|
|
|
|
authProvider={authProvider}
|
|
|
|
dataProvider={dataProvider}
|
|
|
|
i18nProvider={i18nProvider}
|
|
|
|
>
|
2020-02-07 16:44:48 +00:00
|
|
|
<Resource
|
|
|
|
name="users"
|
|
|
|
list={UserList}
|
|
|
|
create={UserCreate}
|
|
|
|
edit={UserEdit}
|
|
|
|
icon={UserIcon}
|
|
|
|
/>
|
2020-07-07 19:28:20 +00:00
|
|
|
<Resource name="rooms" list={RoomList} show={RoomShow} icon={RoomIcon} />
|
2020-03-28 20:25:34 +00:00
|
|
|
<Resource name="connections" />
|
2020-07-08 08:58:57 +00:00
|
|
|
<Resource name="devices" />
|
2020-04-23 08:00:46 +00:00
|
|
|
<Resource name="servernotices" />
|
2020-01-27 13:57:27 +00:00
|
|
|
</Admin>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|