From 3f042410f7613547a6a215a6b9f8d6850650c85f Mon Sep 17 00:00:00 2001
From: csrapr <26280794+csrapr@users.noreply.github.com>
Date: Thu, 11 Feb 2021 19:33:24 +0000
Subject: [PATCH] Feat: cards same height in Dashboard
Fix: merge alerts.new.styles into alerts.styles
---
.../src/components/CollapsibleCard.js | 11 +-
.../src/pages/Dashboard/Alerts/Alerts.js | 37 +++---
.../pages/Dashboard/Alerts/Alerts.styles.js | 62 ++++------
.../src/pages/Dashboard/Dashboard.js | 9 +-
.../src/pages/Dashboard/Dashboard.styles.js | 37 +++---
.../pages/Dashboard/Footer/Footer.styles.js | 5 +-
.../src/pages/Dashboard/LeftSide.js | 10 +-
.../src/pages/Dashboard/RightSide.js | 112 ++++++++++--------
.../SystemPerformance.styles.js | 2 +
.../SystemStatus/MachinesTable.styles.js | 12 +-
.../Dashboard/SystemStatus/SystemStatus.js | 30 ++---
11 files changed, 168 insertions(+), 159 deletions(-)
diff --git a/new-lamassu-admin/src/components/CollapsibleCard.js b/new-lamassu-admin/src/components/CollapsibleCard.js
index 0814ffce..574340a1 100644
--- a/new-lamassu-admin/src/components/CollapsibleCard.js
+++ b/new-lamassu-admin/src/components/CollapsibleCard.js
@@ -1,5 +1,6 @@
import Grid from '@material-ui/core/Grid'
import { makeStyles } from '@material-ui/core/styles'
+import classnames from 'classnames'
import PropTypes from 'prop-types'
import React from 'react'
@@ -26,13 +27,9 @@ const useStyles = makeStyles(styles)
const CollapsibleCard = ({ className, state, shrunkComponent, children }) => {
const classes = useStyles()
return (
-
-
-
- {state === cardState.SHRUNK ? shrunkComponent : children}
-
-
-
+
+ {state === cardState.SHRUNK ? shrunkComponent : children}
+
)
}
diff --git a/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.js b/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.js
index baa9fc11..7d6502e1 100644
--- a/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.js
+++ b/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.js
@@ -7,11 +7,10 @@ import gql from 'graphql-tag'
import * as R from 'ramda'
import React from 'react'
-import { cardState as cardState_ } from 'src/components/CollapsibleCard'
+import { cardState } from 'src/components/CollapsibleCard'
import { Label1, H4 } from 'src/components/typography'
-import styles from '../Dashboard.styles'
-
+import styles from './Alerts.styles'
import AlertsTable from './AlertsTable'
const NUM_TO_RENDER = 3
@@ -38,7 +37,7 @@ const useStyles = makeStyles(styles)
const Alerts = ({ onReset, onExpand, size }) => {
const classes = useStyles()
- const showAllItems = size === cardState_.EXPANDED
+ const showAllItems = size === cardState.EXPANDED
const { data } = useQuery(GET_ALERTS)
const alerts = R.path(['alerts'])(data) ?? []
const machines = R.compose(
@@ -73,9 +72,9 @@ const Alerts = ({ onReset, onExpand, size }) => {
className={classnames(alertsTableContainerClasses)}
container
spacing={1}>
-
+
{!alerts.length && (
-
+
No new alerts. Your system is running smoothly.
)}
@@ -84,20 +83,22 @@ const Alerts = ({ onReset, onExpand, size }) => {
alerts={alerts}
machines={machines}
/>
- {!showAllItems && alertsLength > NUM_TO_RENDER && (
-
-
-
- )}
+ {!showAllItems && alertsLength > NUM_TO_RENDER && (
+
+
+
+
+
+ )}
>
)
}
diff --git a/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.styles.js b/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.styles.js
index 382102eb..7aa2ebe7 100644
--- a/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.styles.js
+++ b/new-lamassu-admin/src/pages/Dashboard/Alerts/Alerts.styles.js
@@ -1,39 +1,26 @@
-import {
- backgroundColor,
- offColor,
- errorColor,
- primaryColor,
- spacer
-} from 'src/styling/variables'
+import { primaryColor, comet } from 'src/styling/variables'
const styles = {
container: {
display: 'flex',
justifyContent: 'space-between'
},
- centerLabel: {
- textAlign: 'center',
- marginBottom: 0,
- marginTop: 0
- },
- label: {
+ h4: {
margin: 0,
- color: offColor
+ marginBottom: 10
},
- row: {
- backgroundColor: backgroundColor,
- borderBottom: 'none'
+ centerLabel: {
+ marginBottom: 0,
+ padding: 0,
+ textAlign: 'center'
},
- header: {
- display: 'flex',
- alignItems: 'center',
- whiteSpace: 'pre'
- },
- error: {
- color: errorColor
+ upperButtonLabel: {
+ marginTop: -3,
+ marginBottom: 24
},
button: {
color: primaryColor,
+ marginTop: 0,
minHeight: 0,
minWidth: 0,
padding: 0,
@@ -42,24 +29,21 @@ const styles = {
backgroundColor: 'transparent'
}
},
- statusHeader: {
- marginLeft: 2
+ alertsTableContainer: {
+ margin: 0
+ },
+ expandedAlertsTableContainer: {
+ margin: 0,
+ maxHeight: 460
+ },
+ noAlertsLabel: {
+ color: comet,
+ marginLeft: -5
},
table: {
- marginTop: spacer * 4,
maxHeight: 465,
- overflow: 'auto'
- },
- tableBody: {
- overflow: 'auto'
- },
- h4: {
- marginTop: 0
- },
- buttonLabel: {
- textAlign: 'center',
- marginBottom: 0,
- marginTop: 0
+ overflowX: 'hidden',
+ overflowY: 'auto'
},
listItemText: {
margin: '8px 0 8px 0'
diff --git a/new-lamassu-admin/src/pages/Dashboard/Dashboard.js b/new-lamassu-admin/src/pages/Dashboard/Dashboard.js
index dd875662..5d4997de 100644
--- a/new-lamassu-admin/src/pages/Dashboard/Dashboard.js
+++ b/new-lamassu-admin/src/pages/Dashboard/Dashboard.js
@@ -34,10 +34,15 @@ const Dashboard = () => {
+
-
-
+
+
+
+
+
+
diff --git a/new-lamassu-admin/src/pages/Dashboard/Dashboard.styles.js b/new-lamassu-admin/src/pages/Dashboard/Dashboard.styles.js
index ac6cebd6..477756cf 100644
--- a/new-lamassu-admin/src/pages/Dashboard/Dashboard.styles.js
+++ b/new-lamassu-admin/src/pages/Dashboard/Dashboard.styles.js
@@ -20,7 +20,7 @@ const styles = {
},
root: {
flexGrow: 1,
- marginBottom: 108
+ display: 'flex'
},
footer: {
margin: [['auto', 0, spacer * 3, 'auto']]
@@ -30,9 +30,8 @@ const styles = {
boxShadow: '0 0 4px 0 rgba(0, 0, 0, 0.08)',
borderRadius: 12,
padding: 24,
- backgroundColor: white
- },
- leftSideMargin: {
+ backgroundColor: white,
+ flex: 1,
marginRight: 24
},
container: {
@@ -56,24 +55,11 @@ const styles = {
marginLeft: spacer
},
alertsCard: {
- marginBottom: 16
+ marginBottom: spacer
},
h4: {
marginTop: 0
},
- alertsTableMargin: {
- marginTop: -30
- },
- alertsTableContainer: {
- height: 220,
- overflowX: 'hidden',
- overflowY: 'auto'
- },
- expandedAlertsTableContainer: {
- minHeight: 476,
- overflowX: 'hidden',
- overflowY: 'auto'
- },
centerLabel: {
marginTop: 40,
marginBottom: 0
@@ -81,6 +67,21 @@ const styles = {
notAlertsLabel: {
marginTop: 40,
color: comet
+ },
+ systemStatusCard: {
+ flex: 1,
+ marginTop: spacer
+ },
+ expandedCard: {
+ flex: 0.9
+ },
+ shrunkCard: {
+ flex: 0.1
+ },
+ displayFlex: {
+ display: 'flex',
+ flex: 0.85,
+ flexDirection: 'column'
}
}
diff --git a/new-lamassu-admin/src/pages/Dashboard/Footer/Footer.styles.js b/new-lamassu-admin/src/pages/Dashboard/Footer/Footer.styles.js
index b2766a68..4af67566 100644
--- a/new-lamassu-admin/src/pages/Dashboard/Footer/Footer.styles.js
+++ b/new-lamassu-admin/src/pages/Dashboard/Footer/Footer.styles.js
@@ -39,7 +39,10 @@ const styles = {
content: {
width: 1200,
backgroundColor: white,
- zIndex: 1
+ zIndex: 1,
+ position: 'fixed',
+ bottom: -spacer,
+ transform: 'translateY(-100%)'
},
footerContainer: ({ expanded, bigFooter }) => ({
marginLeft: spacer * 5,
diff --git a/new-lamassu-admin/src/pages/Dashboard/LeftSide.js b/new-lamassu-admin/src/pages/Dashboard/LeftSide.js
index 59188cdb..6a393082 100644
--- a/new-lamassu-admin/src/pages/Dashboard/LeftSide.js
+++ b/new-lamassu-admin/src/pages/Dashboard/LeftSide.js
@@ -11,12 +11,10 @@ const LeftSide = () => {
const classes = useStyles()
return (
-
-
-
-
-
-
+
+
+
+
)
}
diff --git a/new-lamassu-admin/src/pages/Dashboard/RightSide.js b/new-lamassu-admin/src/pages/Dashboard/RightSide.js
index ce437834..4e9c8fe0 100644
--- a/new-lamassu-admin/src/pages/Dashboard/RightSide.js
+++ b/new-lamassu-admin/src/pages/Dashboard/RightSide.js
@@ -1,6 +1,7 @@
import Button from '@material-ui/core/Button'
import Grid from '@material-ui/core/Grid'
import { makeStyles } from '@material-ui/core/styles'
+import classnames from 'classnames'
import React, { useState } from 'react'
import CollapsibleCard, { cardState } from 'src/components/CollapsibleCard'
@@ -17,18 +18,16 @@ const ShrunkCard = ({ title, buttonName, onUnshrink }) => {
return (
{title}
- <>
-
-
-
- >
+
+
+
)
}
@@ -43,44 +42,57 @@ const RightSide = () => {
setSystemStatusSize(cardState.DEFAULT)
}
return (
-
-
- }>
- {
- setAlertsSize(cardState.EXPANDED)
- setSystemStatusSize(cardState.SHRUNK)
- }}
- onReset={onReset}
- size={alertsSize}
- />
-
-
- }>
- {
- setSystemStatusSize(cardState.EXPANDED)
- setAlertsSize(cardState.SHRUNK)
- }}
- onReset={onReset}
- size={systemStatusSize}
- />
-
+
+
+ <>
+
+ }>
+
{
+ setAlertsSize(cardState.EXPANDED)
+ setSystemStatusSize(cardState.SHRUNK)
+ }}
+ onReset={onReset}
+ size={alertsSize}
+ />
+
+
+ }>
+ {
+ setSystemStatusSize(cardState.EXPANDED)
+ setAlertsSize(cardState.SHRUNK)
+ }}
+ onReset={onReset}
+ size={systemStatusSize}
+ />
+
+ >
+
)
}
diff --git a/new-lamassu-admin/src/pages/Dashboard/SystemPerformance/SystemPerformance.styles.js b/new-lamassu-admin/src/pages/Dashboard/SystemPerformance/SystemPerformance.styles.js
index 831a2cfa..eeaa561f 100644
--- a/new-lamassu-admin/src/pages/Dashboard/SystemPerformance/SystemPerformance.styles.js
+++ b/new-lamassu-admin/src/pages/Dashboard/SystemPerformance/SystemPerformance.styles.js
@@ -48,6 +48,8 @@ const styles = {
},
newHighlightedLabel: {
cursor: 'pointer',
+ color: primaryColor,
+ fontWeight: 700,
borderRadius: 0,
minHeight: 0,
minWidth: 0,
diff --git a/new-lamassu-admin/src/pages/Dashboard/SystemStatus/MachinesTable.styles.js b/new-lamassu-admin/src/pages/Dashboard/SystemStatus/MachinesTable.styles.js
index 574bf476..a780b1c2 100644
--- a/new-lamassu-admin/src/pages/Dashboard/SystemStatus/MachinesTable.styles.js
+++ b/new-lamassu-admin/src/pages/Dashboard/SystemStatus/MachinesTable.styles.js
@@ -37,7 +37,8 @@ const styles = {
textTransform: 'none',
'&:hover': {
backgroundColor: 'transparent'
- }
+ },
+ marginBottom: -40
},
buttonLabel: {
position: 'absolute',
@@ -76,11 +77,16 @@ const styles = {
},
machinesTableContainer: {
marginTop: 10,
- height: 230
+ height: 220
},
expandedMachinesTableContainer: {
marginTop: 10,
- height: 442
+ height: 414
+ },
+ centerLabel: {
+ marginBottom: 0,
+ padding: 0,
+ textAlign: 'center'
}
}
diff --git a/new-lamassu-admin/src/pages/Dashboard/SystemStatus/SystemStatus.js b/new-lamassu-admin/src/pages/Dashboard/SystemStatus/SystemStatus.js
index a97661c7..25d03d33 100644
--- a/new-lamassu-admin/src/pages/Dashboard/SystemStatus/SystemStatus.js
+++ b/new-lamassu-admin/src/pages/Dashboard/SystemStatus/SystemStatus.js
@@ -17,7 +17,7 @@ import styles from './MachinesTable.styles'
const useStyles = makeStyles(styles)
// number of machines in the table to render on page load
-const NUM_TO_RENDER = 3
+const NUM_TO_RENDER = 4
const GET_DATA = gql`
query getData {
@@ -112,22 +112,22 @@ const SystemStatus = ({ onReset, onExpand, size }) => {
numToRender={showAllItems ? Infinity : NUM_TO_RENDER}
machines={machines}
/>
- {!showAllItems && machines.length > NUM_TO_RENDER && (
- <>
-
-
-
- >
- )}
+ {!showAllItems && machines.length > NUM_TO_RENDER && (
+
+
+
+
+
+ )}
>
)}
>