import React, { Component, Fragment } from "react"; import { WithTheme, withTheme } from "@material-ui/core/styles"; import { TableContainer, Table, TableBody, TableCell, TableRow, List, ListItem, ListItemAvatar, ListItemText, withWidth, WithWidthProps, isWidthDown, } from "@material-ui/core"; import RefreshIcon from "@material-ui/icons/Refresh"; import DeviceHubIcon from "@material-ui/icons/DeviceHub"; import { RestFormProps, FormActions, FormButton, HighlightAvatar, } from "../components"; import { busStatus, busStatusHighlight, isConnected, } from "./EMSESPStatus"; import { EMSESPStatus } from "./EMSESPtypes"; function formatNumber(num: number) { return new Intl.NumberFormat().format(num); } type EMSESPStatusFormProps = RestFormProps & WithTheme & WithWidthProps; class EMSESPStatusForm extends Component { createListItems() { const { data, theme, width } = this.props; return ( {isConnected(data) && ( # Telegrams Received {formatNumber(data.rx_received)} ({data.rx_quality}%) # Telegrams Sent {formatNumber(data.tx_sent)} ({data.tx_quality}%)
)}
); } render() { return ( {this.createListItems()} } variant="contained" color="secondary" onClick={this.props.loadData}> Refresh ); } } export default withTheme(withWidth()(EMSESPStatusForm));