mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-16 10:03:12 -07:00
refactor: squash commits
This commit is contained in:
parent
63ebcb5915
commit
1e6e237aa3
107 changed files with 20077 additions and 0 deletions
16
frontend/src/routes/Home/Home.jsx
Normal file
16
frontend/src/routes/Home/Home.jsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { useLocalStorage } from "react-use";
|
||||
|
||||
import HomeLoggedIn from "components/HomeLoggedIn";
|
||||
import HomeLoggedOut from "components/HomeLoggedOut";
|
||||
|
||||
function Home() {
|
||||
const [loggedIn] = useLocalStorage("loggedIn", false);
|
||||
|
||||
if (loggedIn) {
|
||||
return <HomeLoggedIn />;
|
||||
} else {
|
||||
return <HomeLoggedOut />;
|
||||
}
|
||||
}
|
||||
|
||||
export default Home;
|
1
frontend/src/routes/Home/index.jsx
Normal file
1
frontend/src/routes/Home/index.jsx
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from "./Home";
|
83
frontend/src/routes/Network/Network.jsx
Normal file
83
frontend/src/routes/Network/Network.jsx
Normal file
|
@ -0,0 +1,83 @@
|
|||
import { useState, useEffect } from "react";
|
||||
import { Link as RouterLink, useParams, useHistory } from "react-router-dom";
|
||||
import { useLocalStorage } from "react-use";
|
||||
|
||||
import { Link, Grid, Typography } from "@material-ui/core";
|
||||
import ArrowBackIcon from "@material-ui/icons/ArrowBack";
|
||||
import useStyles from "./Network.styles";
|
||||
|
||||
import NetworkHeader from "components/NetworkHeader";
|
||||
import NetworkSettings from "components/NetworkSettings";
|
||||
import NetworkMembers from "components/NetworkMembers";
|
||||
import NetworkRules from "components/NetworkRules";
|
||||
import NetworkManagment from "components/NetworkManagment";
|
||||
|
||||
import API from "utils/API";
|
||||
|
||||
function Network() {
|
||||
const { nwid } = useParams();
|
||||
const [loggedIn] = useLocalStorage("loggedIn", false);
|
||||
const [network, setNetwork] = useState({});
|
||||
|
||||
const classes = useStyles();
|
||||
const history = useHistory();
|
||||
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
try {
|
||||
const network = await API.get("network/" + nwid);
|
||||
setNetwork(network.data);
|
||||
console.log("Current network:", network.data);
|
||||
} catch (err) {
|
||||
if (err.response.status === 404) {
|
||||
history.push("/404");
|
||||
}
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
fetchData();
|
||||
}, [nwid, history]);
|
||||
|
||||
if (loggedIn) {
|
||||
return (
|
||||
<>
|
||||
<Link color="inherit" component={RouterLink} to="/" underline="none">
|
||||
<ArrowBackIcon className={classes.backIcon}></ArrowBackIcon>
|
||||
Networks
|
||||
</Link>
|
||||
<div className={classes.container}>
|
||||
{network["config"] && (
|
||||
<>
|
||||
<NetworkHeader network={network} />
|
||||
<NetworkSettings network={network} setNetwork={setNetwork} />
|
||||
</>
|
||||
)}
|
||||
<NetworkMembers />
|
||||
{network["config"] && <NetworkRules network={network} />}
|
||||
<NetworkManagment />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<Grid
|
||||
container
|
||||
spacing={0}
|
||||
direction="column"
|
||||
alignItems="center"
|
||||
justify="center"
|
||||
style={{
|
||||
minHeight: "50vh",
|
||||
}}
|
||||
>
|
||||
<Grid item xs={10}>
|
||||
<Typography variant="h5">
|
||||
You are not authorized. Please Log In
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Network;
|
12
frontend/src/routes/Network/Network.styles.jsx
Normal file
12
frontend/src/routes/Network/Network.styles.jsx
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { makeStyles } from "@material-ui/core/styles";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
backIcon: {
|
||||
fontSize: 12,
|
||||
},
|
||||
container: {
|
||||
margin: "1%",
|
||||
},
|
||||
}));
|
||||
|
||||
export default useStyles;
|
1
frontend/src/routes/Network/index.jsx
Normal file
1
frontend/src/routes/Network/index.jsx
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from "./Network";
|
28
frontend/src/routes/NotFound/NotFound.jsx
Normal file
28
frontend/src/routes/NotFound/NotFound.jsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
import { Grid, Typography } from "@material-ui/core";
|
||||
|
||||
function NotFound() {
|
||||
return (
|
||||
<Grid
|
||||
container
|
||||
spacing={0}
|
||||
direction="column"
|
||||
alignItems="center"
|
||||
justify="center"
|
||||
style={{
|
||||
minHeight: "50vh",
|
||||
}}
|
||||
>
|
||||
<Grid item xs={10}>
|
||||
<Typography variant="h1">
|
||||
<span>404</span>
|
||||
</Typography>
|
||||
|
||||
<Typography variant="h4">
|
||||
<span>Not found</span>
|
||||
</Typography>
|
||||
</Grid>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
|
||||
export default NotFound;
|
1
frontend/src/routes/NotFound/index.jsx
Normal file
1
frontend/src/routes/NotFound/index.jsx
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from "./NotFound";
|
Loading…
Add table
Add a link
Reference in a new issue