import { useQuery } from '@apollo/react-hooks' 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 from 'react' import { cardState as cardState_ } from 'src/components/CollapsibleCard' // import ActionButton from 'src/components/buttons/ActionButton' import { H4, TL2, Label1 } from 'src/components/typography' import MachinesTable from './MachinesTable' 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 GET_DATA = gql` query getData { machines { name deviceId cashbox cassette1 cassette2 statuses { label type } } serverVersion uptime { name state uptime } } ` /* const parseUptime = time => { if (time < 60) return `${time}s` if (time < 3600) return `${Math.floor(time / 60)}m` if (time < 86400) return `${Math.floor(time / 60 / 60)}h` return `${Math.floor(time / 60 / 60 / 24)}d` } */ const SystemStatus = ({ onReset, onExpand, size }) => { const classes = useStyles() const { data, loading } = useQuery(GET_DATA) const showAllItems = size === cardState_.EXPANDED // const uptime = data?.uptime ?? [{}] return ( <>