From d48c28d5c400caf4b07a1a9aa08670523602e8dc Mon Sep 17 00:00:00 2001 From: Mael Date: Sun, 21 Oct 2018 17:06:04 +0000 Subject: [PATCH] =?UTF-8?q?Pr=C3=A9paration=20d'un=20nouveau=20site,=20pub?= =?UTF-8?q?licodes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Provider.js | 4 ++-- source/components/GenericSimulation.js | 3 +++ source/server.js | 4 +++- source/sites/embauche.gouv.fr/entry.js | 2 +- source/sites/publi.codes/App.js | 31 ++++++++++++++++++++++++++ source/sites/publi.codes/entry.js | 7 ++++++ source/webpack.common.js | 11 ++++++++- 7 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 source/components/GenericSimulation.js create mode 100644 source/sites/publi.codes/App.js create mode 100644 source/sites/publi.codes/entry.js diff --git a/source/Provider.js b/source/Provider.js index b8973c5e7..a5bc9b0b4 100644 --- a/source/Provider.js +++ b/source/Provider.js @@ -42,7 +42,7 @@ export default class Layout extends PureComponent { this.history = createHistory({ basename: process.env.NODE_ENV === 'production' ? '' : this.props.basename }) - this.props.tracker.connectToHistory(this.history) + this.props.tracker?.connectToHistory(this.history) const storeEnhancer = composeEnhancers( applyMiddleware( // Allows us to painlessly do route transition in action creators @@ -55,7 +55,7 @@ export default class Layout extends PureComponent { { ...initialStore, ...this.props.initialStore }, storeEnhancer ) - this.props.onStoreCreated(this.store) + this.props.onStoreCreated && this.props.onStoreCreated(this.store) if (this.props.language) { i18next.changeLanguage(this.props.language) } diff --git a/source/components/GenericSimulation.js b/source/components/GenericSimulation.js new file mode 100644 index 000000000..ceed236cc --- /dev/null +++ b/source/components/GenericSimulation.js @@ -0,0 +1,3 @@ +import React from 'react' + +export default () =>
Salut, toi
diff --git a/source/server.js b/source/server.js index 9a8c61f95..e65aa9cc3 100644 --- a/source/server.js +++ b/source/server.js @@ -14,7 +14,9 @@ const rewrite = basename => ({ app.use( history({ - rewrites: ['embauche', 'infrance', 'mon-entreprise'].map(rewrite) + rewrites: ['embauche', 'infrance', 'mon-entreprise', 'publicodes'].map( + rewrite + ) }) ) diff --git a/source/sites/embauche.gouv.fr/entry.js b/source/sites/embauche.gouv.fr/entry.js index 44c5c2187..f1404b0b3 100644 --- a/source/sites/embauche.gouv.fr/entry.js +++ b/source/sites/embauche.gouv.fr/entry.js @@ -1,7 +1,7 @@ import 'iframe-resizer' import React from 'react' import { render } from 'react-dom' -import App from './App' +import App from '../publi.codes/App' let anchor = document.querySelector('#js') diff --git a/source/sites/publi.codes/App.js b/source/sites/publi.codes/App.js new file mode 100644 index 000000000..6d4c610d7 --- /dev/null +++ b/source/sites/publi.codes/App.js @@ -0,0 +1,31 @@ +import RulePage from 'Components/RulePage' +import React, { Component } from 'react' +import { Route, Switch } from 'react-router-dom' +import 'Ui/index.css' +import Provider from '../../Provider' +import Route404 from '../embauche.gouv.fr/pages/Route404' +import RulesList from '../embauche.gouv.fr/pages/RulesList' +import GenericSimulation from 'Components/GenericSimulation' + +class App extends Component { + render() { + return ( + + + + + + + + + ) + } +} + +let devMode = process.env.NODE_ENV !== 'production' +export default (devMode + ? do { + let { hot } = require('react-hot-loader') + hot(module)(App) + } + : App) diff --git a/source/sites/publi.codes/entry.js b/source/sites/publi.codes/entry.js new file mode 100644 index 000000000..a85ed24df --- /dev/null +++ b/source/sites/publi.codes/entry.js @@ -0,0 +1,7 @@ +import React from 'react' +import { render } from 'react-dom' +import App from './App' + +let anchor = document.querySelector('#js') + +render(, anchor) diff --git a/source/webpack.common.js b/source/webpack.common.js index cc841ebc1..72270fea6 100644 --- a/source/webpack.common.js +++ b/source/webpack.common.js @@ -25,7 +25,8 @@ module.exports = { infrance: ['./source/sites/mycompanyinfrance.fr/entry.en.js'], // To not introduce breaking into the iframe integration, we serve simulateur.js from a 'dist' subdirectory - 'dist/simulateur': ['./source/sites/embauche.gouv.fr/iframe-script.js'] + 'dist/simulateur': ['./source/sites/embauche.gouv.fr/iframe-script.js'], + publicodes: ['./source/sites/publi.codes/entry.js'] }, output: { path: path.resolve('./dist/'), @@ -68,6 +69,14 @@ module.exports = { 'Du status juridique à premier embauche, vous trouverez ici toutes les ressources nécessaires pour démarrer votre activité.', filename: 'mon-entreprise.html' }), + new HTMLPlugin({ + template: 'index.html', + chunks: ['publicodes'], + title: 'publicodes ✍️', + description: + 'Une base de connaissance ? Du code ? Les deux à la fois. Lancement imminent !', + filename: 'publicodes.html' + }), new CopyPlugin([ './manifest.webmanifest', './source/sites/embauche.gouv.fr/images/logo',