premier commit infrance.org

pull/294/head
Johan Girod 2018-06-21 11:52:00 +02:00 committed by Mael
parent eb443f59a1
commit 58a6c7f3e4
4 changed files with 70 additions and 45 deletions

View File

@ -1,55 +1,42 @@
import { I18nextProvider } from 'react-i18next'
import i18next from 'i18next'
import Contact from 'Components/Contact'
import Mecanisms from 'Components/Mecanisms'
import About from 'Components/pages/About'
import Contribution from 'Components/pages/Contribution'
import { Header } from 'Components/pages/Header'
import Home from 'Components/pages/Home'
import Integration from 'Components/pages/Integration'
import RulesList from 'Components/pages/RulesList'
import Route404 from 'Components/Route404'
import RulePage from 'Components/RulePage'
import React, { Component } from 'react'
import { Redirect, Route, Switch } from 'react-router-dom'
import withTracker from '../components/withTracker'
import './Layout.css'
import './reset.css'
import { Route, Router, Switch, Redirect } from 'react-router-dom'
import Home from 'Components/pages/Home'
import RulePage from 'Components/RulePage'
import Route404 from 'Components/Route404'
import Contact from 'Components/Contact'
import RulesList from 'Components/pages/RulesList'
import Mecanisms from 'Components/Mecanisms'
import Contribution from 'Components/pages/Contribution'
import Integration from 'Components/pages/Integration'
import About from 'Components/pages/About'
import createHistory from 'history/createBrowserHistory'
import { Header } from 'Components/pages/Header'
import withTracker from '../components/withTracker'
class Layout extends Component {
history = createHistory()
componentDidMount() {
this.props.tracker.push(['trackPageView'])
}
render() {
let { tracker } = this.props
// track the initial pageview
return (
<I18nextProvider i18n={i18next}>
<Router history={tracker.connectToHistory(this.history)}>
<>
<Header />
<Switch>
<Route exact path="/" component={Home} />
<Route path="/contact" component={Contact} />
<Route path="/règle/:name" component={RulePage} />
<Redirect from="/simu/*" to="/" />
<Route path="/règles" component={RulesList} />
<Route path="/mecanismes" component={Mecanisms} />
<Route path="/à-propos" component={About} />
<Route path="/intégrer" component={Integration} />
<Route path="/contribuer" component={Contribution} />
<Redirect from="/simulateur" to="/" />
<Redirect from="/couleur.html" to="/" />
<Route component={Route404} />
</Switch>
</>
</Router>
</I18nextProvider>
<>
<Header />
<Switch>
<Route exact path="/" component={Home} />
<Route path="/contact" component={Contact} />
<Route path="/règle/:name" component={RulePage} />
<Redirect from="/simu/*" to="/" />
<Route path="/règles" component={RulesList} />
<Route path="/mecanismes" component={Mecanisms} />
<Route path="/à-propos" component={About} />
<Route path="/intégrer" component={Integration} />
<Route path="/contribuer" component={Contribution} />
<Redirect from="/simulateur" to="/" />
<Redirect from="/couleur.html" to="/" />
<Route component={Route404} />
</Switch>
</>
)
}
}

View File

@ -1,13 +1,18 @@
/* global process: false */
import ReactPiwik from 'Components/Tracker'
import createHistory from 'history/createBrowserHistory'
import i18next from 'i18next'
import React from 'react'
import { render } from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import { I18nextProvider } from 'react-i18next'
import { Provider } from 'react-redux'
import { Router } from 'react-router-dom'
import { applyMiddleware, compose, createStore } from 'redux'
import computeThemeColours from './components/themeColours'
import Layout from './containers/Layout'
import { defaultTracker, TrackerProvider } from './components/withTracker'
import Layout from './inFranceApp'
import trackDomainActions from './middlewares/trackDomainActions'
import reducers from './reducers/reducers'
import {
@ -15,7 +20,6 @@ import {
retrievePersistedSimulation
} from './storage/persist'
import { getIframeOption, getUrl } from './utils'
import { defaultTracker, TrackerProvider } from './components/withTracker'
let tracker = defaultTracker
if (process.env.NODE_ENV === 'production') {
@ -49,10 +53,16 @@ let store = createStore(reducers, initialStore, enhancer)
let anchor = document.querySelector('#js')
persistSimulation(store)
const history = createHistory()
let App = ({ store }) => (
<Provider store={store}>
<TrackerProvider value={tracker}>
<Layout/>
<I18nextProvider i18n={i18next}>
<Router history={tracker.connectToHistory(history)}>
<Layout />
</Router>
</I18nextProvider>
</TrackerProvider>
</Provider>
)

View File

@ -0,0 +1,9 @@
import React from 'react'
const Landing = () => (
<header>
<h1>How to settle a business in France</h1>
</header>
)
export default Landing

View File

@ -0,0 +1,19 @@
import React, { Component } from 'react'
import { Route, Switch } from 'react-router-dom'
import withTracker from '../components/withTracker'
import '../containers/reset.css'
import Landing from './Landing'
class Layout extends Component {
componentDidMount() {
this.props.tracker.push(['trackPageView'])
}
render() {
return (
<Switch>
<Route exact path="/" component={Landing} />
</Switch>
)
}
}
export default withTracker(Layout)