Préparation d'un nouveau site, publicodes

transport
Mael 2018-10-21 17:06:04 +00:00
parent f71a44ac01
commit d48c28d5c4
7 changed files with 57 additions and 5 deletions

View File

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

View File

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

View File

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

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

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