diff --git a/source/Provider.js b/source/Provider.js
index 4f3631306..f7a0408f8 100644
--- a/source/Provider.js
+++ b/source/Provider.js
@@ -41,7 +41,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
@@ -54,7 +54,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 1a76551fb..fc0a1cb24 100644
--- a/source/server.js
+++ b/source/server.js
@@ -17,6 +17,10 @@ app.use(
{
from: /^\/infrance\/.*$|^\/infrance$/,
to: '/infrance.html'
+ },
+ {
+ from: /^\/publicodes\/.*$|^\/publicodes/,
+ to: '/publicodes.html'
}
]
})
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 d14e5e249..19802ac44 100644
--- a/source/webpack.common.js
+++ b/source/webpack.common.js
@@ -23,7 +23,8 @@ module.exports = {
infrance: ['./source/sites/mycompanyinfrance.fr/entry.js'],
embauche: ['./source/sites/embauche.gouv.fr/entry.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/'),
@@ -53,6 +54,14 @@ module.exports = {
"Simulation du prix d'une embauche en France et calcul du salaire net à partir du brut : CDD, statut cadre, cotisations sociales, retraite...",
filename: 'embauche.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',