mirror of
https://github.com/UA-Fediland/synapse-admin.git
synced 2024-11-09 16:24:51 +00:00
1e6d43e291
Change-Id: I20056d997e7a94fd10d03e7d1a8051030ecf7ca4
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import React from "react";
|
|
import { Admin, Resource, resolveBrowserLocale } from "react-admin";
|
|
import polyglotI18nProvider from "ra-i18n-polyglot";
|
|
import authProvider from "./synapse/authProvider";
|
|
import dataProvider from "./synapse/dataProvider";
|
|
import { UserList, UserCreate, UserEdit } from "./components/users";
|
|
import { RoomList } from "./components/rooms";
|
|
import LoginPage from "./components/LoginPage";
|
|
import UserIcon from "@material-ui/icons/Group";
|
|
import { ViewListIcon as RoomIcon } from "@material-ui/icons/ViewList";
|
|
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()
|
|
);
|
|
|
|
const App = () => (
|
|
<Admin
|
|
loginPage={LoginPage}
|
|
authProvider={authProvider}
|
|
dataProvider={dataProvider}
|
|
i18nProvider={i18nProvider}
|
|
>
|
|
<Resource
|
|
name="users"
|
|
list={UserList}
|
|
create={UserCreate}
|
|
edit={UserEdit}
|
|
icon={UserIcon}
|
|
/>
|
|
<Resource name="rooms" list={RoomList} icon={RoomIcon} />
|
|
</Admin>
|
|
);
|
|
|
|
export default App;
|