Skip to content
Snippets Groups Projects
App.tsx 1.45 KiB
Newer Older
  • Learn to ignore specific revisions
  • /* eslint-disable @typescript-eslint/no-explicit-any */
    import React from 'react'
    import { HashRouter } from 'react-router-dom'
    import { createBrowserHistory } from 'history'
    import { Layout, Main, Content } from 'cozy-ui/transpiled/react/Layout'
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    import { useSelector } from 'react-redux'
    import { AppStore } from 'store'
    
    
    import Routes from 'components/Routes/Routes'
    import Navbar from 'components/Navbar/Navbar'
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    import SplashRoot from 'components/Splash/SplashRoot'
    
    import SplashScreen from 'components/Splash/SplashScreen'
    import SplashScreenError from 'components/Splash/SplashScreenError'
    
    import TutorialWelcome from './Tutorial/TutorialWelcome'
    
    
    export const history = createBrowserHistory()
    
    export const App = () => {
    
    Guilhem CARRON's avatar
     
    Guilhem CARRON committed
      const { tutorial } = useSelector((state: AppStore) => state.ecolyo.profile)
      const { isLastTermAccepted } = useSelector(
        (state: AppStore) => state.ecolyo.global
    
      return (
        <HashRouter {...history}>
          <Layout>
            <SplashRoot
              splashComponent={SplashScreen}
              splashErrorComponent={SplashScreenError}
            >
    
              <TutorialWelcome open={!tutorial.isWelcomeSeen} />
              {isLastTermAccepted && <Navbar />}
              <Main>
                <Content className="app-content">
                  <Routes isLastTermAccepted={isLastTermAccepted} />
                </Content>
              </Main>
    
            </SplashRoot>
          </Layout>
        </HashRouter>
      )
    }
    
    export default App