template sort of complete for now, using it for goInventorize

This commit is contained in:
2021-11-14 18:44:18 -05:00
parent ce38e21dca
commit deb85fabb9
4 changed files with 60 additions and 23 deletions

View File

@@ -70,3 +70,15 @@
{"level":"info","time":"2021-11-13T22:11:01-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2021-11-13T22:11:01-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:true UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2021-11-13T22:11:01-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2021-11-14T14:26:43-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2021-11-14T14:26:43-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:true UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2021-11-14T14:26:43-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2021-11-14T14:26:46-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2021-11-14T14:26:46-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:true UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2021-11-14T14:26:46-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2021-11-14T18:43:36-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2021-11-14T18:43:36-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:true UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2021-11-14T18:43:36-05:00","message":"Database and Config loaded, starting webserver..."}
{"level":"info","time":"2021-11-14T18:43:38-05:00","message":"Configuration loaded successfully..."}
{"level":"debug","time":"2021-11-14T18:43:38-05:00","message":"{Timezone:America/New_York Server:{Port:3500 LocationPhotoDir:./app/photos/locations/} Logger:{Level:debug LoggingFile:./app/log/goInventorize.log} Authentication:{BasicAuth:true UserName:admin Password:password} Development:false}"}
{"level":"info","time":"2021-11-14T18:43:38-05:00","message":"Database and Config loaded, starting webserver..."}

View File

@@ -1,7 +1,9 @@
import React, {useState, useEffect, useContext, createContext} from 'react';
import base64 from 'base-64';
import Home from './components/pages/Home';
import HomePage from './components/pages/HomePage';
import Locations from './components/pages/Locations'
import { Modal, Button, Text, Group, TextInput, Loader, AppShell } from '@mantine/core';
import {BrowserRouter as Router, Routes, Route, Link} from 'react-router-dom'
import { useDebouncedValue, useLocalStorageValue } from '@mantine/hooks';
@@ -83,14 +85,19 @@ function App() {
return (
<APIContext.Provider value={{...serverConfig}}>
<AppShell
navbarOffsetBreakpoint="sm" // navbarOffsetBreakpoint controls when navbar should no longer be offset with padding-left
fixed // fixed prop on AppShell will be automatically added to Header and Navbar
navbar={<SideBar opened={shellOpened}/>}
header={<AppHeader opened={shellOpened} setOpened={setShellOpened}/>}
>
<Text>Resize app to see responsive navbar in action</Text>
</AppShell>
<Router>
<AppShell
navbarOffsetBreakpoint="sm" // navbarOffsetBreakpoint controls when navbar should no longer be offset with padding-left
fixed // fixed prop on AppShell will be automatically added to Header and Navbar
navbar={<SideBar opened={shellOpened}/>}
header={<AppHeader opened={shellOpened} setOpened={setShellOpened}/>}
>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/locations" element={<Locations />} />
</Routes>
</AppShell>
</Router>
<Modal
opened={portModalOpen}
onClose={() => setPortModalOpen(false)}

View File

@@ -1,12 +1,29 @@
import React, {useState } from 'react';
import { Navbar, Text, Group, ThemeIcon, Button } from '@mantine/core';
import { Navbar, Text, Group, ThemeIcon, Button, UnstyledButton } from '@mantine/core';
import { createStyles } from '@mantine/styles';
import { BsMap } from 'react-icons/bs'
import {BrowserRouter as Router, Routes, Route, Link} from 'react-router-dom'
import { Link, useNavigate} from 'react-router-dom'
import { classNames } from '@plasmicapp/react-web';
const useStyles = createStyles((theme) => ({
button: {
display: 'block',
width: '100%',
padding: theme.spacing.xs,
borderRadius: theme.radius.sm,
color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,
backgroundColor: 'transparent',
'&:hover': {
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0],
},
},
}));
function SideBar(props) {
const { classes } = useStyles();
const navigate = useNavigate();
return (
<Navbar
@@ -17,14 +34,13 @@ function SideBar(props) {
hidden={!props.opened}
width={{ base: 200, breakpoints: { sm: '100%', lg: 300 } }}
>
<Router>
<Routes>
<Route path="/" element={<Home />} />
</Routes>
<Button component={Link} to="/locations" leftIcon={<ThemeIcon><BsMap /></ThemeIcon>}>
<Text>Locations</Text>
</Button>
</Router>
<UnstyledButton className={classes.button} onClick={() => navigate("/locations")} >
<Group>
<BsMap />
<Text>Locations</Text>
</Group>
</UnstyledButton>
</Navbar>
)

View File

@@ -1,10 +1,11 @@
import React, {useState, useEffect, useContext, createContext} from 'react';
import APIContext from '../../App';
import { Text } from '@mantine/core'
import { Home } from '@material-ui/icons';
function App() {
function HomePage() {
const [opened, setOpened] = useState(false);
const serverConfig = useContext(APIContext);
@@ -12,9 +13,10 @@ function App() {
return (
<>
<Text>This is the homepage!</Text>
</>
);
}
export default App;
export default HomePage;