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

View File

@@ -1,12 +1,29 @@
import React, {useState } from 'react'; 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 { 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) { function SideBar(props) {
const { classes } = useStyles();
const navigate = useNavigate();
return ( return (
<Navbar <Navbar
@@ -17,14 +34,13 @@ function SideBar(props) {
hidden={!props.opened} hidden={!props.opened}
width={{ base: 200, breakpoints: { sm: '100%', lg: 300 } }} width={{ base: 200, breakpoints: { sm: '100%', lg: 300 } }}
> >
<Router> <UnstyledButton className={classes.button} onClick={() => navigate("/locations")} >
<Routes> <Group>
<Route path="/" element={<Home />} /> <BsMap />
</Routes>
<Button component={Link} to="/locations" leftIcon={<ThemeIcon><BsMap /></ThemeIcon>}>
<Text>Locations</Text> <Text>Locations</Text>
</Button> </Group>
</Router>
</UnstyledButton>
</Navbar> </Navbar>
) )

View File

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