1
0
mirror of https://github.com/pavlobu/deskreen.git synced 2025-05-18 08:20:10 -07:00
deskreen/app/index.tsx
2020-09-24 19:06:07 +03:00

39 lines
1.3 KiB
TypeScript

/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable no-new */
import React, { Fragment, Suspense } from 'react';
import { render } from 'react-dom';
import { AppContainer as ReactHotAppContainer } from 'react-hot-loader';
import './configs/i18next.config.client';
import { history, configuredStore } from './store';
import './app.global.css';
const store = configuredStore();
const AppContainer = process.env.PLAIN_HMR ? Fragment : ReactHotAppContainer;
document.addEventListener('DOMContentLoaded', () => {
if (process.platform === 'darwin') {
const windowTopBar = document.createElement('div');
windowTopBar.style.width = '100%';
windowTopBar.style.height = '50px';
windowTopBar.style.position = 'absolute';
windowTopBar.style.top = '0';
windowTopBar.style.left = '0';
// @ts-ignore: all good here
windowTopBar.style.webkitAppRegion = 'drag';
windowTopBar.style.pointerEvents = 'none';
document.body.appendChild(windowTopBar);
}
// eslint-disable-next-line global-require
const Root = require('./containers/Root').default;
render(
<AppContainer>
<Suspense fallback="loading">
<Root store={store} history={history} />
</Suspense>
</AppContainer>,
document.getElementById('root')
);
});