Projekt

Obecné

Profil

Stáhnout (1.68 KB) Statistiky
| Větev: | Tag: | Revize:
1 3b85c076 Vaclav Honzik
import './App.css'
2
import { Routes, Route, Link } from 'react-router-dom'
3
import Home from './features/Home/Home'
4
import Catalog from './features/Catalog/Catalog'
5
import NotFound from './features/NotFound/NotFound'
6 8370b6c1 Vaclav Honzik
import { Container, Paper, Theme } from '@mui/material'
7 846f4f3c Vaclav Honzik
import { ThemeProvider } from '@emotion/react'
8
import { useSelector } from 'react-redux'
9
import { RootState } from './features/redux/store'
10 8370b6c1 Vaclav Honzik
import Login from './features/Auth/Login'
11 f2db3e05 Vaclav Honzik
import CatalogItemDetail from './features/Catalog/CatalogItemDetail'
12 ec88f816 Vaclav Honzik
13 846f4f3c Vaclav Honzik
const App = () => {
14
    const theme: Theme = useSelector((state: RootState) => state.theme.theme)
15
16 8370b6c1 Vaclav Honzik
    // TODO remove this its only for debug
17
    const user = useSelector((state: RootState) => state.user)
18
19 846f4f3c Vaclav Honzik
    return (
20
        <ThemeProvider theme={theme}>
21 8370b6c1 Vaclav Honzik
            <p>{JSON.stringify(user)}</p>
22 846f4f3c Vaclav Honzik
            <Paper style={{ minHeight: '100vh', borderRadius: 0 }}>
23
                <nav>
24 8370b6c1 Vaclav Honzik
                    <Link to="/">Home </Link>
25
                    <Link to="/catalog">Catalog </Link>
26
                    <Link to="/login">Login </Link>
27 846f4f3c Vaclav Honzik
                </nav>
28 8370b6c1 Vaclav Honzik
                <Container>
29
                    <Routes>
30
                        <Route path="/" element={<Home />} />
31
                        <Route path="/catalog" element={<Catalog />} />
32 f2db3e05 Vaclav Honzik
                        <Route
33
                            path="/catalog/:itemId"
34
                            element={<CatalogItemDetail />}
35
                        />
36 8370b6c1 Vaclav Honzik
                        <Route path="/login" element={<Login />} />
37
                        <Route path="*" element={<NotFound />} />
38
                    </Routes>
39
                </Container>
40 846f4f3c Vaclav Honzik
            </Paper>
41
        </ThemeProvider>
42
    )
43
}
44 ec88f816 Vaclav Honzik
45 3b85c076 Vaclav Honzik
export default App