login fix and theme implementation
parent
d1981e72bf
commit
a7a23144a9
|
@ -1,3 +1,6 @@
|
||||||
REACT v4:
|
REACT v4:
|
||||||
https://v4.mui.com/getting-started/installation/
|
https://v4.mui.com/getting-started/installation/
|
||||||
https://v4.mui.com/components/material-icons/
|
https://v4.mui.com/components/material-icons/
|
||||||
|
|
||||||
|
Theming:
|
||||||
|
https://v4.mui.com/customization/palette/ (Dark theme)
|
|
@ -14,13 +14,13 @@ import ChevronRightIcon from "@material-ui/icons/ChevronRight";
|
||||||
import ListItem from "@material-ui/core/ListItem";
|
import ListItem from "@material-ui/core/ListItem";
|
||||||
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
import ListItemIcon from "@material-ui/core/ListItemIcon";
|
||||||
import ListItemText from "@material-ui/core/ListItemText";
|
import ListItemText from "@material-ui/core/ListItemText";
|
||||||
import InboxIcon from "@material-ui/icons/MoveToInbox";
|
import DeleteIcon from "@material-ui/icons/Delete";
|
||||||
import MailIcon from "@material-ui/icons/Mail";
|
|
||||||
import DnsIcon from "@material-ui/icons/Dns";
|
import DnsIcon from "@material-ui/icons/Dns";
|
||||||
import MenuItem from "@material-ui/core/MenuItem";
|
import MenuItem from "@material-ui/core/MenuItem";
|
||||||
import Menu from "@material-ui/core/Menu";
|
import Menu from "@material-ui/core/Menu";
|
||||||
import AccountCircle from "@material-ui/icons/AccountCircle";
|
import AccountCircle from "@material-ui/icons/AccountCircle";
|
||||||
import SettingsIcon from "@material-ui/icons/Settings";
|
import SettingsIcon from "@material-ui/icons/Settings";
|
||||||
|
import DashboardIcon from "@material-ui/icons/Dashboard";
|
||||||
import Main from "./layout/Main";
|
import Main from "./layout/Main";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import { useTuitioClient } from "@flare/tuitio-client-react";
|
import { useTuitioClient } from "@flare/tuitio-client-react";
|
||||||
|
@ -203,17 +203,16 @@ export default function MiniDrawer() {
|
||||||
</div>
|
</div>
|
||||||
<Divider />
|
<Divider />
|
||||||
<List>
|
<List>
|
||||||
{["Inbox", "Starred", "Send email", "Drafts"].map((text, index) => (
|
<ListItem
|
||||||
<ListItem button key={text}>
|
button
|
||||||
<ListItemIcon>
|
key="dashboard"
|
||||||
{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
onClick={() => history.push("/dashboard")}
|
||||||
</ListItemIcon>
|
>
|
||||||
<ListItemText primary={text} />
|
<ListItemIcon>
|
||||||
</ListItem>
|
<DashboardIcon />
|
||||||
))}
|
</ListItemIcon>
|
||||||
</List>
|
<ListItemText primary={"Dashboard"} />
|
||||||
<Divider />
|
</ListItem>
|
||||||
<List>
|
|
||||||
<ListItem
|
<ListItem
|
||||||
button
|
button
|
||||||
key="machines"
|
key="machines"
|
||||||
|
@ -224,6 +223,15 @@ export default function MiniDrawer() {
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={"Machines"} />
|
<ListItemText primary={"Machines"} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
<Divider />
|
||||||
|
<List>
|
||||||
|
<ListItem button key="trash" onClick={() => history.push("/trash")}>
|
||||||
|
<ListItemIcon>
|
||||||
|
<DeleteIcon />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText primary={"Trash"} />
|
||||||
|
</ListItem>
|
||||||
<ListItem
|
<ListItem
|
||||||
button
|
button
|
||||||
key="settings"
|
key="settings"
|
||||||
|
@ -234,14 +242,6 @@ export default function MiniDrawer() {
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
<ListItemText primary={"Settings"} />
|
<ListItemText primary={"Settings"} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
{["All mail", "Trash", "Spam"].map((text, index) => (
|
|
||||||
<ListItem button key={text}>
|
|
||||||
<ListItemIcon>
|
|
||||||
{index % 2 === 0 ? <InboxIcon /> : <MailIcon />}
|
|
||||||
</ListItemIcon>
|
|
||||||
<ListItemText primary={text} />
|
|
||||||
</ListItem>
|
|
||||||
))}
|
|
||||||
</List>
|
</List>
|
||||||
</Drawer>
|
</Drawer>
|
||||||
<main className={classes.content}>
|
<main className={classes.content}>
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
import React from "react";
|
||||||
|
import { makeStyles } from "@material-ui/core/styles";
|
||||||
|
import { Typography } from "@material-ui/core";
|
||||||
|
|
||||||
|
const useStyles = makeStyles(theme => ({
|
||||||
|
box: {
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
marginBottom: theme.spacing(2),
|
||||||
|
marginTop: theme.spacing(0)
|
||||||
|
},
|
||||||
|
title: { textTransform: "uppercase" }
|
||||||
|
}));
|
||||||
|
|
||||||
|
const PageTitle = ({ text }) => {
|
||||||
|
var classes = useStyles();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={classes.box}>
|
||||||
|
<Typography className={classes.title} variant="h3" size="sm">
|
||||||
|
{text}
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PageTitle;
|
|
@ -4,10 +4,12 @@ import PageNotFound from "./PageNotFound";
|
||||||
import LoginContainer from "../../features/login/components/LoginContainer";
|
import LoginContainer from "../../features/login/components/LoginContainer";
|
||||||
import NetworkContainer from "../../features/network/components/NetworkContainer";
|
import NetworkContainer from "../../features/network/components/NetworkContainer";
|
||||||
import SettingsContainer from "../../features/settings/components/SettingsContainer";
|
import SettingsContainer from "../../features/settings/components/SettingsContainer";
|
||||||
|
import DashboardContainer from "../../features/dashboard/components/DashboardContainer";
|
||||||
|
|
||||||
const Switcher = () => {
|
const Switcher = () => {
|
||||||
return (
|
return (
|
||||||
<Switch>
|
<Switch>
|
||||||
|
<Route exact path="/dashboard" component={DashboardContainer} />
|
||||||
<Route exact path="/user-profile" component={LoginContainer} />
|
<Route exact path="/user-profile" component={LoginContainer} />
|
||||||
<Route exact path="/machines" component={NetworkContainer} />
|
<Route exact path="/machines" component={NetworkContainer} />
|
||||||
<Route exact path="/settings" component={SettingsContainer} />
|
<Route exact path="/settings" component={SettingsContainer} />
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
const DashboardContainer = () => <h2>In development...</h2>;
|
||||||
|
|
||||||
|
export default DashboardContainer;
|
|
@ -5,6 +5,7 @@ import {
|
||||||
} from "../../../state/ApplicationContexts";
|
} from "../../../state/ApplicationContexts";
|
||||||
import useApi from "../../../api";
|
import useApi from "../../../api";
|
||||||
import MachinesList from "./MachinesList";
|
import MachinesList from "./MachinesList";
|
||||||
|
import PageTitle from "../../../components/common/PageTitle";
|
||||||
|
|
||||||
const MachinesContainer = () => {
|
const MachinesContainer = () => {
|
||||||
const state = useContext(ApplicationStateContext);
|
const state = useContext(ApplicationStateContext);
|
||||||
|
@ -27,7 +28,12 @@ const MachinesContainer = () => {
|
||||||
}
|
}
|
||||||
}, [handleReadMachines, state.network.machines.loaded]);
|
}, [handleReadMachines, state.network.machines.loaded]);
|
||||||
|
|
||||||
return <MachinesList dense={true} machines={state.network.machines} />;
|
return (
|
||||||
|
<>
|
||||||
|
<PageTitle text="Machines" />
|
||||||
|
<MachinesList dense={true} machines={state.network.machines} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default MachinesContainer;
|
export default MachinesContainer;
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
background-color: #282c34;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
|
|
||||||
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
|
|
||||||
sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
|
|
||||||
monospace;
|
|
||||||
}
|
|
19
src/index.js
19
src/index.js
|
@ -1,22 +1,25 @@
|
||||||
import React, { Suspense } from "react";
|
import React, { Suspense } from "react";
|
||||||
import ReactDOM from "react-dom";
|
import ReactDOM from "react-dom";
|
||||||
import "./index.css";
|
import { ThemeProvider } from "@material-ui/styles";
|
||||||
import "./utils/i18n";
|
import Themes from "./themes";
|
||||||
import CssBaseline from "@material-ui/core/CssBaseline";
|
import CssBaseline from "@material-ui/core/CssBaseline";
|
||||||
import App from "./components/App";
|
import App from "./components/App";
|
||||||
import { TuitioProvider } from "@flare/tuitio-client-react";
|
import { TuitioProvider } from "@flare/tuitio-client-react";
|
||||||
import ApplicationStateProvider from "./providers/ApplicationStateProvider";
|
import ApplicationStateProvider from "./providers/ApplicationStateProvider";
|
||||||
import ToastProvider from "./providers/ToastProvider";
|
import ToastProvider from "./providers/ToastProvider";
|
||||||
|
import "./utils/i18n";
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<TuitioProvider tuitioUrl={process.env.REACT_APP_TUITIO_URL}>
|
<TuitioProvider tuitioUrl={process.env.REACT_APP_TUITIO_URL}>
|
||||||
<ApplicationStateProvider>
|
<ApplicationStateProvider>
|
||||||
<CssBaseline />
|
<ThemeProvider theme={Themes.default}>
|
||||||
<Suspense fallback={<div>Loading...</div>}>
|
<CssBaseline />
|
||||||
<ToastProvider>
|
<Suspense fallback={<div>Loading...</div>}>
|
||||||
<App />
|
<ToastProvider>
|
||||||
</ToastProvider>
|
<App />
|
||||||
</Suspense>
|
</ToastProvider>
|
||||||
|
</Suspense>
|
||||||
|
</ThemeProvider>
|
||||||
</ApplicationStateProvider>
|
</ApplicationStateProvider>
|
||||||
</TuitioProvider>,
|
</TuitioProvider>,
|
||||||
document.getElementById("root")
|
document.getElementById("root")
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
const primary = "#00695C";
|
||||||
|
const secondary = "#FF5C93";
|
||||||
|
const warning = "#ff9800";
|
||||||
|
const success = "#4caf50";
|
||||||
|
const info = "#2196f3";
|
||||||
|
|
||||||
|
const defaultTheme = {
|
||||||
|
palette: {
|
||||||
|
primary: {
|
||||||
|
main: primary
|
||||||
|
},
|
||||||
|
secondary: {
|
||||||
|
main: secondary,
|
||||||
|
contrastText: "#ffcc00"
|
||||||
|
},
|
||||||
|
warning: {
|
||||||
|
main: warning
|
||||||
|
},
|
||||||
|
success: {
|
||||||
|
main: success
|
||||||
|
},
|
||||||
|
info: {
|
||||||
|
main: info
|
||||||
|
}
|
||||||
|
},
|
||||||
|
overrides: {
|
||||||
|
MuiBackdrop: {
|
||||||
|
root: {
|
||||||
|
backgroundColor: "#4A4A4A1A"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default defaultTheme;
|
|
@ -0,0 +1,40 @@
|
||||||
|
import defaultTheme from "./default";
|
||||||
|
import { createTheme } from "@material-ui/core/styles";
|
||||||
|
|
||||||
|
const prefersDarkMode = false;
|
||||||
|
|
||||||
|
const overrides = {
|
||||||
|
palette: {
|
||||||
|
type: prefersDarkMode ? "dark" : "light"
|
||||||
|
},
|
||||||
|
typography: {
|
||||||
|
h1: {
|
||||||
|
fontSize: "3rem"
|
||||||
|
},
|
||||||
|
h2: {
|
||||||
|
fontSize: "2rem"
|
||||||
|
},
|
||||||
|
h3: {
|
||||||
|
fontSize: "1.64rem"
|
||||||
|
},
|
||||||
|
h4: {
|
||||||
|
fontSize: "1.5rem"
|
||||||
|
},
|
||||||
|
h5: {
|
||||||
|
fontSize: "1.285rem"
|
||||||
|
},
|
||||||
|
h6: {
|
||||||
|
fontSize: "1.142rem"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const themes = {
|
||||||
|
default: createTheme({
|
||||||
|
...defaultTheme,
|
||||||
|
...overrides,
|
||||||
|
palette: { ...defaultTheme.palette, ...overrides.palette }
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
export default themes;
|
Loading…
Reference in New Issue