diff --git a/client/Routes.jsx b/client/Routes.jsx index 183d8d273..523aedf5c 100644 --- a/client/Routes.jsx +++ b/client/Routes.jsx @@ -1,15 +1,13 @@ import React from 'react'; -import { - Switch, - Route, - Redirect, -} from 'react-router-dom'; +import { Switch, Route, Redirect } from 'react-router-dom'; import Desktop from '@components/main/Desktop'; +import Reports from '@components/main/Reports'; export default function Routes() { return ( + diff --git a/client/components/Header.jsx b/client/components/Header.jsx index 0a80bd9e0..124737b80 100644 --- a/client/components/Header.jsx +++ b/client/components/Header.jsx @@ -1,14 +1,19 @@ import React from 'react'; -// import { NavLink } from 'react-router-dom'; +import { Link } from 'react-router-dom'; import { makeStyles } from '@material-ui/core/styles'; import { AppBar, Button, Toolbar, Typography, + Menu, + MenuItem, } from '@material-ui/core'; const useStyles = makeStyles(theme => ({ + MuiMenuItemButton: { + color: 'white', + }, appBar: { height: theme.header.height, backgroundColor: theme.palette.primary.main, @@ -16,7 +21,10 @@ const useStyles = makeStyles(theme => ({ button: { textTransform: 'none', fontFamily: 'Roboto', - marginLeft: theme.spacing(2), + marginLeft: theme.spacing(1), + marginRight: theme.spacing(1), + color: 'white', + textDecoration: 'none', }, title: { ...theme.typography.h1, @@ -30,6 +38,15 @@ const useStyles = makeStyles(theme => ({ // TODO: links/routing, mobile const Header = () => { const classes = useStyles(); + const [anchorEl, setAnchorEl] = React.useState(null); + + const handleClick = event => { + setAnchorEl(event.currentTarget); + }; + + const handleClose = () => { + setAnchorEl(null); + }; return ( @@ -37,7 +54,49 @@ const Header = () => { 311DATA - + + + + + Overview + + + + + Recent + + + + + Neighborhood + + + + + Neighborhood Recent + + + + + + diff --git a/client/components/main/Reports.jsx b/client/components/main/Reports.jsx new file mode 100644 index 000000000..43f33a1f1 --- /dev/null +++ b/client/components/main/Reports.jsx @@ -0,0 +1,66 @@ +import React from 'react'; +import { useLocation } from 'react-router-dom'; +import { makeStyles } from '@material-ui/core/styles'; +import { Backdrop, CircularProgress } from '@material-ui/core'; + +const useStyles = makeStyles(theme => ({ + root: { + height: `calc(100vh - ${theme.header.height} - ${theme.footer.height})`, + width: '100vw', + backgroundColor: 'black', + }, + backdrop: { + position: 'absolute', + top: theme.header.height, + bottom: theme.footer.height, + height: `calc(100vh - ${theme.header.height} - ${theme.footer.height})`, + }, +})); + +const Reports = () => { + const [isLoading, setIsLoading] = React.useState(true); + const classes = useStyles(); + + const url = process.env.REPORT_URL; + let reportPath = '/dashboards/overview'; + const location = useLocation(); + reportPath = location.pathname.slice(8); + const reportRef = React.useRef(reportPath); + + /* eslint-disable consistent-return */ + React.useEffect(() => { + if (reportPath !== reportRef.current) { + setIsLoading(true); + } + + if (isLoading) { + const timer = setTimeout(() => setIsLoading(false), 2000); + return () => clearTimeout(timer); + } + reportRef.current = reportPath; + }, [reportPath, isLoading]); + + return ( +
+ + + +