From e13e630cd6e4fc0b1ff92098a28a770794c7bb9a Mon Sep 17 00:00:00 2001 From: gabrhr <73925454+gabrhr@users.noreply.github.com> Date: Wed, 20 Apr 2022 10:19:29 -0500 Subject: =?UTF-8?q?A=C3=B1adir=20plantilla?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Base para front --- front/odiparpack/app/app.js | 87 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 front/odiparpack/app/app.js (limited to 'front/odiparpack/app/app.js') diff --git a/front/odiparpack/app/app.js b/front/odiparpack/app/app.js new file mode 100644 index 0000000..6845268 --- /dev/null +++ b/front/odiparpack/app/app.js @@ -0,0 +1,87 @@ +/** + * app.js + * + * This is the entry file for the application, only setup and boilerplate + * code. + */ + +// Needed for redux-saga es6 generator support +import '@babel/polyfill'; + +// Import all the third party stuff +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Provider } from 'react-redux'; +import { ConnectedRouter } from 'connected-react-router/immutable'; +import history from 'utils/history'; +import 'sanitize.css/sanitize.css'; +// Import root app +import App from 'containers/App'; + +// Import Language Provider +import LanguageProvider from 'containers/LanguageProvider'; + +// Load the favicon and the .htaccess file +/* eslint-disable import/no-unresolved, import/extensions */ +/* eslint-enable import/no-unresolved, import/extensions */ + +import configureStore from './redux/configureStore'; + +import './styles/layout/base.scss'; + +// Import i18n messages +import { translationMessages } from './i18n'; + +// Create redux store with history +const initialState = {}; +const store = configureStore(initialState, history); +const MOUNT_NODE = document.getElementById('app'); + +const render = messages => { + ReactDOM.render( + + + + + + + , + MOUNT_NODE, + ); +}; + +if (module.hot) { + // Hot reloadable React components and translation json files + // modules.hot.accept does not accept dynamic dependencies, + // have to be constants at compile-time + module.hot.accept(['./i18n', 'containers/App'], () => { + ReactDOM.unmountComponentAtNode(MOUNT_NODE); + render(translationMessages); + }); +} + +// Chunked polyfill for browsers without Intl support + +if (!window.Intl) { + new Promise(resolve => { + resolve(import('intl')); + }) + .then(() => Promise.all([ + import('intl/locale-data/jsonp/en.js'), + import('intl/locale-data/jsonp/de.js'), + ])) // eslint-disable-line prettier/prettier + .then(() => render(translationMessages)) + .catch(err => { + throw err; + }); +} else { + render(translationMessages); +} + + +// Install ServiceWorker and AppCache in the end since +// it's not most important operation and if main code fails, +// we do not want it installed +if (process.env.NODE_ENV === 'production') { + require('offline-plugin/runtime').install(); // eslint-disable-line global-require +} -- cgit v1.2.3