]> Untitled Git - lemmy-ui.git/blob - src/client/index.tsx
44d39d0b5eb3acc732c6080c68d90a0d8d31786d
[lemmy-ui.git] / src / client / index.tsx
1 import { initializeSite } from "@utils/app";
2 import setDefaultOptions from "date-fns/setDefaultOptions";
3 import { hydrate } from "inferno-hydrate";
4 import { Router } from "inferno-router";
5 import { App } from "../shared/components/app/app";
6 import { HistoryService, I18NextService } from "../shared/services";
7
8 import "bootstrap/js/dist/collapse";
9 import "bootstrap/js/dist/dropdown";
10
11 async function startClient() {
12   initializeSite(window.isoData.site_res);
13
14   const lang = I18NextService.i18n.language;
15   const locale = (
16     await import(
17       /* webpackExclude: /\.js\.flow$/ */
18       `date-fns/locale/${lang}`
19     )
20   ).default;
21
22   setDefaultOptions({
23     locale,
24   });
25
26   const wrapper = (
27     <Router history={HistoryService.history}>
28       <App />
29     </Router>
30   );
31
32   const root = document.getElementById("root");
33
34   if (root) {
35     hydrate(wrapper, root);
36   }
37 }
38
39 startClient();