2020-10-20 21:50:53 +02:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
2020-10-23 13:40:39 +02:00
|
|
|
import React, {useState} from 'react'
|
|
|
|
import {IntlProvider} from 'react-intl'
|
2020-10-09 17:10:26 +02:00
|
|
|
|
|
|
|
import {
|
2020-10-20 21:50:53 +02:00
|
|
|
BrowserRouter as Router,
|
|
|
|
Switch,
|
|
|
|
Route,
|
2020-10-20 21:52:56 +02:00
|
|
|
} from 'react-router-dom'
|
2020-10-09 17:10:26 +02:00
|
|
|
|
2020-10-23 13:40:39 +02:00
|
|
|
import {getCurrentLanguage, getMessages, storeLanguage} from './i18n'
|
|
|
|
|
2020-10-20 21:52:56 +02:00
|
|
|
import LoginPage from './pages/loginPage'
|
|
|
|
import BoardPage from './pages/boardPage'
|
2020-10-09 17:10:26 +02:00
|
|
|
|
2020-10-22 18:34:10 +02:00
|
|
|
export default function App(): JSX.Element {
|
2020-10-23 13:40:39 +02:00
|
|
|
const [language, setLanguage] = useState(getCurrentLanguage())
|
|
|
|
const setAndStoreLanguage = (lang: string) => {
|
|
|
|
storeLanguage(lang)
|
|
|
|
setLanguage(lang)
|
|
|
|
}
|
2020-10-20 21:50:53 +02:00
|
|
|
return (
|
2020-10-23 13:40:39 +02:00
|
|
|
<IntlProvider
|
|
|
|
locale={language}
|
|
|
|
messages={getMessages(language)}
|
|
|
|
>
|
|
|
|
<Router>
|
|
|
|
<div id='frame'>
|
|
|
|
<div id='main'>
|
|
|
|
<Switch>
|
|
|
|
<Route path='/login'>
|
|
|
|
<LoginPage/>
|
|
|
|
</Route>
|
|
|
|
<Route path='/'>
|
|
|
|
<BoardPage setLanguage={setAndStoreLanguage}/>
|
|
|
|
</Route>
|
|
|
|
<Route path='/board'>
|
|
|
|
<BoardPage setLanguage={setAndStoreLanguage}/>
|
|
|
|
</Route>
|
|
|
|
</Switch>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Router>
|
|
|
|
</IntlProvider>
|
2020-10-20 21:50:53 +02:00
|
|
|
)
|
2020-10-09 17:10:26 +02:00
|
|
|
}
|