remove tooltip, add icons for fav and cmd

This commit is contained in:
proddy
2022-03-28 17:49:57 +02:00
parent 3f68c0001e
commit cf10791c95

View File

@@ -20,8 +20,7 @@ import {
ListItem, ListItem,
ListItemText, ListItemText,
Grid, Grid,
useMediaQuery, useMediaQuery
Tooltip
} from '@mui/material'; } from '@mui/material';
import TableCell, { tableCellClasses } from '@mui/material/TableCell'; import TableCell, { tableCellClasses } from '@mui/material/TableCell';
@@ -38,6 +37,8 @@ import CancelIcon from '@mui/icons-material/Cancel';
import SendIcon from '@mui/icons-material/TrendingFlat'; import SendIcon from '@mui/icons-material/TrendingFlat';
import SaveIcon from '@mui/icons-material/Save'; import SaveIcon from '@mui/icons-material/Save';
import RemoveIcon from '@mui/icons-material/RemoveCircleOutline'; import RemoveIcon from '@mui/icons-material/RemoveCircleOutline';
import FavoriteIcon from '@mui/icons-material/Favorite';
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
import DeviceIcon from './DeviceIcon'; import DeviceIcon from './DeviceIcon';
@@ -219,7 +220,7 @@ const DashboardData: FC = () => {
{deviceValue.l && ( {deviceValue.l && (
<ValidatedTextField <ValidatedTextField
name="v" name="v"
label={deviceValue.n} label={deviceValue.n.slice(2)}
value={deviceValue.v} value={deviceValue.v}
autoFocus autoFocus
sx={{ width: '30ch' }} sx={{ width: '30ch' }}
@@ -234,7 +235,7 @@ const DashboardData: FC = () => {
{!deviceValue.l && ( {!deviceValue.l && (
<ValidatedTextField <ValidatedTextField
name="v" name="v"
label={deviceValue.n} label={deviceValue.n.slice(2)}
value={deviceValue.u ? numberValue(deviceValue.v) : deviceValue.v} value={deviceValue.u ? numberValue(deviceValue.v) : deviceValue.v}
autoFocus autoFocus
sx={{ width: '30ch' }} sx={{ width: '30ch' }}
@@ -493,16 +494,29 @@ const DashboardData: FC = () => {
}; };
const renderNameCell = (dv: DeviceValue) => { const renderNameCell = (dv: DeviceValue) => {
var mask = Number(dv.n.slice(0, 2));
var name = dv.n.slice(2);
if (dv.v === undefined && dv.c) { if (dv.v === undefined && dv.c) {
return ( return (
<StyledTableCell component="th" scope="row" sx={{ color: 'yellow' }}> <StyledTableCell component="th" scope="row">
command:&nbsp;{dv.n} {name}&nbsp;
<PlayArrowIcon color="primary" sx={{ fontSize: 10 }} />
</StyledTableCell> </StyledTableCell>
); );
} }
if ((mask & 8) === 8) {
return (
<StyledTableCell component="th" scope="row">
{name}&nbsp;
<FavoriteIcon color="error" sx={{ fontSize: 10 }} />
</StyledTableCell>
);
}
return ( return (
<StyledTableCell component="th" scope="row"> <StyledTableCell component="th" scope="row">
{dv.n} {name}
</StyledTableCell> </StyledTableCell>
); );
}; };
@@ -526,9 +540,7 @@ const DashboardData: FC = () => {
<StyledTableCell padding="checkbox"> <StyledTableCell padding="checkbox">
{dv.c && me.admin && ( {dv.c && me.admin && (
<IconButton size="small"> <IconButton size="small">
<Tooltip title="Change value..."> <EditIcon color="primary" fontSize="small" />
<EditIcon color="primary" fontSize="small" />
</Tooltip>
</IconButton> </IconButton>
)} )}
</StyledTableCell> </StyledTableCell>