Chore: post-rebase fixes

This commit is contained in:
csrapr 2021-02-05 00:05:50 +00:00 committed by Josh Harvey
parent c0106592eb
commit ef60b15d82
29 changed files with 224 additions and 470 deletions

View file

@ -1,8 +1,10 @@
import { withStyles, makeStyles } from '@material-ui/core'
import { makeStyles } from '@material-ui/core'
import List from '@material-ui/core/List'
import ListItem from '@material-ui/core/ListItem'
import * as R from 'ramda'
import React from 'react'
import { useHistory } from 'react-router-dom'
import { P } from 'src/components/typography/index'
import { ReactComponent as Wrench } from 'src/styling/icons/action/wrench/zodiac.svg'
import { ReactComponent as LinkIcon } from 'src/styling/icons/button/link/zodiac.svg'
@ -12,12 +14,6 @@ import { ReactComponent as WarningIcon } from 'src/styling/icons/warning-icon/to
import styles from './Alerts.styles'
const useStyles = makeStyles(styles)
const StyledListItem = withStyles(() => ({
root: {
...styles.root
}
}))(ListItem)
const icons = {
error: <WarningIcon style={{ height: 20, width: 20, marginRight: 12 }} />,
fiatBalance: (
@ -34,25 +30,23 @@ const links = {
const AlertsTable = ({ numToRender, alerts, machines }) => {
const history = useHistory()
const classes = useStyles()
const alertsToRender = R.slice(0, numToRender, alerts)
return (
<List dense className={classes.table}>
{alerts.map((alert, idx) => {
if (idx < numToRender) {
return (
<StyledListItem key={idx}>
{icons[alert.type] || (
<Wrench style={{ height: 23, width: 23, marginRight: 8 }} />
)}
<P className={classes.listItemText}>{`${alert.message}${alert
.detail.deviceId &&
' - ' + machines[alert.detail.deviceId]}`}</P>
<LinkIcon
className={classes.linkIcon}
onClick={() => history.push(links[alert.type] || '/dashboard')}
/>
</StyledListItem>
)
} else return null
{alertsToRender.map((alert, idx) => {
return (
<ListItem key={idx}>
{icons[alert.type] || (
<Wrench style={{ height: 23, width: 23, marginRight: 8 }} />
)}
<P className={classes.listItemText}>{`${alert.message}${alert.detail
.deviceId && ' - ' + machines[alert.detail.deviceId]}`}</P>
<LinkIcon
className={classes.linkIcon}
onClick={() => history.push(links[alert.type] || '/dashboard')}
/>
</ListItem>
)
})}
</List>
)