@@ -43,23 +51,31 @@ function Sidebar({ events, title }) {
className={classes.drawer}
variant="permanent"
classes={{
- paper: classes.drawerPaper,
+ paper: mounted ? classes.drawerPaper : classes.drawerPaperNoOverflow,
}}
>
+
-
+
{title || 'Untitled'}
- {events.map((event) => (
-
- ))}
+ {!mounted
+ ? (
+
+ ) : (
+ events && events.map((event) => (
+
+ ))
+ )}
@@ -72,4 +88,5 @@ export default Sidebar;
Sidebar.propTypes = {
events: PropTypes.array.isRequired,
title: PropTypes.string.isRequired,
+ bridgeId: PropTypes.number.isRequired,
};
diff --git a/components/shared/dashboard/Navbar/index.js b/components/shared/dashboard/Navbar/index.js
index 60c55ae..3cbb48e 100644
--- a/components/shared/dashboard/Navbar/index.js
+++ b/components/shared/dashboard/Navbar/index.js
@@ -1,10 +1,10 @@
import React, {
- useState, useEffect, useRef,
+ useRef,
} from 'react';
import {
AppBar, Toolbar, Typography, IconButton, makeStyles, Link,
} from '@material-ui/core';
-import { FaPlus, FaArrowDown } from 'react-icons/fa';
+import { FaPlus } from 'react-icons/fa';
import { AccountCircle } from '@material-ui/icons';
import Menu from './Menu';
@@ -47,51 +47,51 @@ const useStyles = makeStyles((theme) => ({
export default function Navbar() {
const classes = useStyles();
- const [bridges, setBridges] = useState([]);
- const [width, setWidth] = useState(null);
+ // const [bridges, setBridges] = useState([]);
+ // const [width, setWidth] = useState(null);
const { logout } = useAuth();
- const bridgeMenuTransforms = {
- anchor: {
- vertical: 'bottom',
- horizontal: 'center',
- },
- transform: {
- vertical: 'top',
- horizontal: 'center',
- },
- };
+ // const bridgeMenuTransforms = {
+ // anchor: {
+ // vertical: 'bottom',
+ // horizontal: 'center',
+ // },
+ // transform: {
+ // vertical: 'top',
+ // horizontal: 'center',
+ // },
+ // };
- const menuUseEffect = () => {
- let cancelled = false;
- const getBridges = async () => {
- // await axios.get('http://localhost:3001/bridges')
- // if (!cancelled)
- // .then((res) => {
- // setBridges(res.data);
- // });
- setBridges([
- 'Bridge 1',
- 'Bridge 2',
- 'Bridge 3',
- ]);
- };
+ // const menuUseEffect = () => {
+ // let cancelled = false;
+ // const getBridges = async () => {
+ // // await axios.get('http://localhost:3001/bridges')
+ // // if (!cancelled)
+ // // .then((res) => {
+ // // setBridges(res.data);
+ // // });
+ // setBridges([
+ // 'Bridge 1',
+ // 'Bridge 2',
+ // 'Bridge 3',
+ // ]);
+ // };
- getBridges();
- // eslint-disable-next-line no-unused-vars
- return () => { cancelled = true; };
- };
+ // getBridges();
+ // // eslint-disable-next-line no-unused-vars
+ // return () => { cancelled = true; };
+ // };
// Determine the width of the 'Dashboard' link &
// move the brigdes dropdown to center of the screen
const ref = useRef(null);
- useEffect(() => {
- if (ref.current) {
- setWidth(ref.current.offsetWidth);
- } else {
- throw new Error('Ref not found');
- }
- }, [ref.current]);
+ // useEffect(() => {
+ // if (ref.current) {
+ // setWidth(ref.current.offsetWidth);
+ // } else {
+ // throw new Error('Ref not found');
+ // }
+ // }, [ref.current]);
return (
@@ -114,7 +114,7 @@ export default function Navbar() {
-
}
text="Bridges"
width={width}
@@ -132,7 +132,8 @@ export default function Navbar() {
))}
-
+ */}
+
}>
diff --git a/pages/dashboard.js b/pages/dashboard.js
index 9e94249..fdf2dec 100644
--- a/pages/dashboard.js
+++ b/pages/dashboard.js
@@ -72,8 +72,9 @@ Dashboard.propTypes = {
PropTypes.shape({
title: PropTypes.string.isRequired,
updatedAt: PropTypes.string.isRequired,
- lastRequest: PropTypes.string,
- requests: PropTypes.string,
+ lastRequest: PropTypes.string.isRequired,
+ requests: PropTypes.string.isRequired,
+ eventId: PropTypes.string.isRequired,
}),
).isRequired,
};
diff --git a/pages/events/[slug].js b/pages/events/[slug].js
index 26e0645..62b918d 100644
--- a/pages/events/[slug].js
+++ b/pages/events/[slug].js
@@ -28,7 +28,7 @@ const useStyles = makeStyles(() => ({
},
}));
-function Events({ event }) {
+function Events({ event, events, bridgeTitle }) {
const classes = useStyles();
const { inbound, outbound } = event.data;
@@ -37,7 +37,7 @@ function Events({ event }) {
return (
-
+
@@ -99,7 +99,9 @@ export async function getServerSideProps(context) {
return {
props: {
+ bridgeTitle: res.data.bridge_title,
event: toCamel(event),
+ events: toCamel(JSON.parse(res.data.events)),
},
};
}
@@ -146,6 +148,50 @@ Events.propTypes = {
statusCode: PropTypes.number,
test: PropTypes.bool,
}).isRequired,
+ events: PropTypes.arrayOf(
+ PropTypes.shape({
+ completed: PropTypes.bool.isRequired,
+ aborted: PropTypes.bool.isRequired,
+ id: PropTypes.number.isRequired,
+ bridgeId: PropTypes.number.isRequired,
+ completedAt: PropTypes.string.isRequired,
+ data: PropTypes.shape({
+ inbound: PropTypes.shape({
+ dateTime: PropTypes.string.isRequired,
+ contentLength: PropTypes.number.isRequired,
+ payload: PropTypes.shape({}).isRequired,
+ }).isRequired,
+
+ outbound: PropTypes.arrayOf(
+ PropTypes.shape({
+ request: PropTypes.shape({
+ dateTime: PropTypes.string.isRequired,
+ contentLength: PropTypes.string.isRequired,
+ uri: PropTypes.string.isRequired,
+ payload: PropTypes.shape({}).isRequired,
+ headers: PropTypes.arrayOf(
+ PropTypes.shape({
+ key: PropTypes.string.isRequired,
+ value: PropTypes.string.isRequired,
+ }),
+ ),
+ }).isRequired,
+
+ response: PropTypes.shape({
+ dateTime: PropTypes.string.isRequired,
+ statusCode: PropTypes.string.isRequired,
+ message: PropTypes.string.isRequired,
+ size: PropTypes.number.isRequired,
+ payload: PropTypes.shape({}).isRequired,
+ }).isRequired,
+ }).isRequired,
+ ).isRequired,
+ }),
+ statusCode: PropTypes.number,
+ test: PropTypes.bool,
+ }).isRequired,
+ ).isRequired,
+ bridgeTitle: PropTypes.string.isRequired,
};
export default Events;
diff --git a/specs/fixtures/event.json b/specs/fixtures/event.json
index 1107235..7eaec91 100644
--- a/specs/fixtures/event.json
+++ b/specs/fixtures/event.json
@@ -12,5 +12,7 @@
"updated_at": "2020-11-28T13: 07: 00.408Z",
"test": false,
"aborted": false
- }
+ },
+ "events": "[]",
+ "bridge_title": "Hello World"
}
\ No newline at end of file