Feat: make footer expand on hover
chore: rename status variable from showExpandBtn to canExpand Chore: disable notific. card, redirect to dashboard on logo click This commit also fixes eslint warnings about anonymous exports On the header, the Dashboard link is removed, in favour of adding a redirect on click on the Lamassu Admin text. "Machines" header link is removed as well, and a machine profile can be accessed through the dashboard -> System Status card
This commit is contained in:
parent
00f176fccc
commit
5572fb0eb1
16 changed files with 126 additions and 103 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import { useQuery } from '@apollo/react-hooks'
|
||||
import Button from '@material-ui/core/Button'
|
||||
// import Button from '@material-ui/core/Button'
|
||||
import Grid from '@material-ui/core/Grid'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
import gql from 'graphql-tag'
|
||||
import React, { useState, useEffect } from 'react'
|
||||
|
||||
import ActionButton from 'src/components/buttons/ActionButton'
|
||||
// import ActionButton from 'src/components/buttons/ActionButton'
|
||||
import { H4, TL2, Label1 } from 'src/components/typography'
|
||||
|
||||
import MachinesTable from './MachinesTable'
|
||||
|
|
@ -14,7 +14,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 = 3
|
||||
|
||||
const GET_DATA = gql`
|
||||
query getData {
|
||||
|
|
@ -49,23 +49,23 @@ const SystemStatus = ({ cardState, setRightSideState }) => {
|
|||
const classes = useStyles()
|
||||
const { data, loading } = useQuery(GET_DATA)
|
||||
const [showAllItems, setShowAllItems] = useState(false)
|
||||
const [showExpandButton, setShowExpandButton] = useState(false)
|
||||
const [numToRender, setNumToRender] = useState(NUM_TO_RENDER)
|
||||
// const [showExpandButton, setShowExpandButton] = useState(false)
|
||||
// const [numToRender, setNumToRender] = useState(NUM_TO_RENDER)
|
||||
|
||||
useEffect(() => {
|
||||
if (showAllItems) {
|
||||
/* if (showAllItems) {
|
||||
setShowExpandButton(false)
|
||||
setNumToRender(data?.machines.length)
|
||||
} else if (data && data?.machines.length > numToRender) {
|
||||
setShowExpandButton(true)
|
||||
}
|
||||
} */
|
||||
if (cardState.cardSize === 'small' || cardState.cardSize === 'default') {
|
||||
setShowAllItems(false)
|
||||
setNumToRender(NUM_TO_RENDER)
|
||||
// setNumToRender(NUM_TO_RENDER)
|
||||
}
|
||||
}, [cardState.cardSize, data, numToRender, showAllItems])
|
||||
}, [cardState.cardSize, data, /* numToRender, */ showAllItems])
|
||||
|
||||
const reset = () => {
|
||||
/* const reset = () => {
|
||||
setShowAllItems(false)
|
||||
setNumToRender(NUM_TO_RENDER)
|
||||
setRightSideState({
|
||||
|
|
@ -81,7 +81,7 @@ const SystemStatus = ({ cardState, setRightSideState }) => {
|
|||
systemStatus: { cardSize: 'big', buttonName: 'Show less' },
|
||||
alerts: { cardSize: 'small', buttonName: 'Show alerts' }
|
||||
})
|
||||
}
|
||||
} */
|
||||
|
||||
// placeholder data
|
||||
if (data) {
|
||||
|
|
@ -92,8 +92,9 @@ const SystemStatus = ({ cardState, setRightSideState }) => {
|
|||
return (
|
||||
<>
|
||||
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
||||
<H4 className={classes.h4}>System status</H4>
|
||||
{(showAllItems || cardState.cardSize === 'small') && (
|
||||
<H4 className={classes.h4}>System status</H4>{' '}
|
||||
</div>
|
||||
{/* {(showAllItems || cardState.cardSize === 'small') && (
|
||||
<>
|
||||
<Label1
|
||||
style={{
|
||||
|
|
@ -112,7 +113,7 @@ const SystemStatus = ({ cardState, setRightSideState }) => {
|
|||
</Label1>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div> */}
|
||||
{!loading && cardState.cardSize !== 'small' && (
|
||||
<>
|
||||
<Grid container spacing={1}>
|
||||
|
|
@ -127,21 +128,22 @@ const SystemStatus = ({ cardState, setRightSideState }) => {
|
|||
<Label1 style={{ display: 'inline' }}> server version</Label1>
|
||||
</Grid>
|
||||
<Grid item xs={4}>
|
||||
<ActionButton
|
||||
{/* <ActionButton
|
||||
color="primary"
|
||||
className={classes.actionButton}
|
||||
onClick={() => console.log('Upgrade button clicked')}>
|
||||
Update to v10.6.0
|
||||
</ActionButton>
|
||||
</ActionButton> */}
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid container spacing={1} style={{ marginTop: 23 }}>
|
||||
<Grid item xs={12}>
|
||||
<MachinesTable
|
||||
numToRender={numToRender}
|
||||
/* numToRender={numToRender} */
|
||||
numToRender={Infinity}
|
||||
machines={data?.machines ?? []}
|
||||
/>
|
||||
{showExpandButton && (
|
||||
{/* {showExpandButton && (
|
||||
<>
|
||||
<Label1 style={{ textAlign: 'center', marginBottom: 0 }}>
|
||||
<Button
|
||||
|
|
@ -154,7 +156,7 @@ const SystemStatus = ({ cardState, setRightSideState }) => {
|
|||
</Button>
|
||||
</Label1>
|
||||
</>
|
||||
)}
|
||||
)} */}
|
||||
</Grid>
|
||||
</Grid>
|
||||
</>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue