Préparation d'un nouveau site, publicodes

publicodes
Mael 2018-10-21 17:06:04 +00:00
parent a444c97e76
commit f07a57ea62
7 changed files with 58 additions and 4 deletions

View File

@ -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)
}

View File

@ -0,0 +1,3 @@
import React from 'react'
export default () => <div>Salut, toi</div>

View File

@ -17,6 +17,10 @@ app.use(
{
from: /^\/infrance\/.*$|^\/infrance$/,
to: '/infrance.html'
},
{
from: /^\/publicodes\/.*$|^\/publicodes/,
to: '/publicodes.html'
}
]
})

View File

@ -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')

View File

@ -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 (
<Provider basename="embauche" initialStore={{}} reduxMiddlewares={[]}>
<Switch>
<Route exact path="/" component={GenericSimulation} />
<Route path="/règle/:name" component={RulePage} />
<Route path="/règles" component={RulesList} />
<Route component={Route404} />
</Switch>
</Provider>
)
}
}
let devMode = process.env.NODE_ENV !== 'production'
export default (devMode
? do {
let { hot } = require('react-hot-loader')
hot(module)(App)
}
: App)

View File

@ -0,0 +1,7 @@
import React from 'react'
import { render } from 'react-dom'
import App from './App'
let anchor = document.querySelector('#js')
render(<App />, anchor)

View File

@ -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',