import React from 'react'
import ReactDOM from 'react-dom/client'
import { createTheme } from '@mui/material/styles'
import { PageLogin } from './pages/login'
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { PageNotFound } from './pages/notfound'

const API_BASE_ADDRESS = "http://127.0.0.1:30"

export const api = (path: string) => API_BASE_ADDRESS + path

export const theme = createTheme({
    palette: {
        mode: 'dark',
        primary: {
            main: '#0288d1',
        },
        secondary: {
            main: '#d81b60',
        },
        error: {
            main: '#b71c1c',
        },
    },
    components: {
        MuiTypography: {
            styleOverrides: {
                root: {
                    wordWrap: "break-word"
                }
            }
        }
    }
})

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)

const LSPYggdrasilWebApp = () => {
    return <BrowserRouter>
        <Routes>
            <Route path="/" element={ <PageLogin /> } />
            <Route path="*" element={ <PageNotFound /> } />
        </Routes>
    </BrowserRouter>
}

root.render(
    <React.StrictMode>
        <LSPYggdrasilWebApp /> 
    </React.StrictMode>
)