Projekt

Obecné

Profil

Stáhnout (1.68 KB) Statistiky
| Větev: | Tag: | Revize:
1
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
import { Container, Paper, Theme } from '@mui/material'
7
import { ThemeProvider } from '@emotion/react'
8
import { useSelector } from 'react-redux'
9
import { RootState } from './features/redux/store'
10
import Login from './features/Auth/Login'
11
import CatalogItemDetail from './features/Catalog/CatalogItemDetail'
12

    
13
const App = () => {
14
    const theme: Theme = useSelector((state: RootState) => state.theme.theme)
15

    
16
    // TODO remove this its only for debug
17
    const user = useSelector((state: RootState) => state.user)
18

    
19
    return (
20
        <ThemeProvider theme={theme}>
21
            <p>{JSON.stringify(user)}</p>
22
            <Paper style={{ minHeight: '100vh', borderRadius: 0 }}>
23
                <nav>
24
                    <Link to="/">Home </Link>
25
                    <Link to="/catalog">Catalog </Link>
26
                    <Link to="/login">Login </Link>
27
                </nav>
28
                <Container>
29
                    <Routes>
30
                        <Route path="/" element={<Home />} />
31
                        <Route path="/catalog" element={<Catalog />} />
32
                        <Route
33
                            path="/catalog/:itemId"
34
                            element={<CatalogItemDetail />}
35
                        />
36
                        <Route path="/login" element={<Login />} />
37
                        <Route path="*" element={<NotFound />} />
38
                    </Routes>
39
                </Container>
40
            </Paper>
41
        </ThemeProvider>
42
    )
43
}
44

    
45
export default App
(3-3/6)