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-01-27 16:57:27 +03:00
|
|
|
import dataProvider from "./dataProvider";
|
2020-02-07 18:35:21 +03:00
|
|
|
import LoginPage from "./components/LoginPage";
|
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-01-27 16:57:27 +03:00
|
|
|
<Resource name="data" />
|
|
|
|
</Admin>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|