Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/emsesp/EMS-ESP32 into idf4
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDvP committed May 4, 2022
2 parents 221e28c + d344924 commit ca7bea3
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 98 deletions.
36 changes: 18 additions & 18 deletions interface/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion interface/package.json
Expand Up @@ -25,7 +25,7 @@
"react": "^17.0.2",
"react-app-rewired": "^2.2.1",
"react-dom": "^17.0.2",
"react-dropzone": "^14.1.1",
"react-dropzone": "^14.2.0",
"react-icons": "^4.3.1",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
Expand Down
20 changes: 2 additions & 18 deletions interface/src/CustomTheme.tsx
Expand Up @@ -11,28 +11,12 @@ const theme = responsiveFontSizes(
},
palette: {
mode: 'dark',
// background: {
// default: grey[900], // #212121
// // paper: grey[800]
// },
// primary: {
// main: '#33bfff'
// },
secondary: {
main: blue[500] // in buttons
main: blue[500]
},
info: {
main: blueGrey[500] // used in icons
main: blueGrey[500]
}
// warning: {
// main: orange[500]
// },
// error: {
// main: red[200]
// },
// success: {
// main: green[700]
// }
}
})
);
Expand Down
1 change: 0 additions & 1 deletion interface/src/components/MessageBox.tsx
Expand Up @@ -32,7 +32,6 @@ const MessageBox: FC<MessageBoxProps> = ({ level, message, sx, children, ...rest
const theme = useTheme();
const Icon = LEVEL_ICONS[level];
const backgroundColor = LEVEL_BACKGROUNDS[level](theme);
// const color = theme.palette.getContrastText(backgroundColor);
const color = 'white';
return (
<Box p={2} display="flex" alignItems="center" borderRadius={1} sx={{ backgroundColor, color, ...sx }} {...rest}>
Expand Down
1 change: 0 additions & 1 deletion interface/src/components/layout/LayoutAppBar.tsx
Expand Up @@ -25,7 +25,6 @@ const LayoutAppBar: FC<LayoutAppBarProps> = ({ title, onToggleDrawer }) => {
ml: { md: `${DRAWER_WIDTH}px` },
boxShadow: 'none',
backgroundColor: '#2e586a'
// color: "#2196f3",
}}
>
<Toolbar>
Expand Down
2 changes: 1 addition & 1 deletion interface/src/components/layout/LayoutDrawer.tsx
Expand Up @@ -47,7 +47,7 @@ const LayoutDrawer: FC<LayoutDrawerProps> = ({ mobileOpen, onClose }) => {
open={mobileOpen}
onClose={onClose}
ModalProps={{
keepMounted: true // Better open performance on mobile.
keepMounted: true
}}
sx={{
display: { xs: 'block', md: 'none' },
Expand Down
115 changes: 77 additions & 38 deletions interface/src/project/DashboardData.tsx
Expand Up @@ -137,6 +137,11 @@ const DashboardData: FC = () => {
border-top: 1px solid transparent;
border-right: 1px solid transparent;
border-bottom: 1px solid transparent;
&:not(.stiff) > div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&:nth-of-type(1) {
padding-left: 8px;
min-width: 42px;
Expand All @@ -146,8 +151,8 @@ const DashboardData: FC = () => {
}
}
&:nth-of-type(2) {
min-width: 120px;
width: 120px;
min-width: 100px;
width: 100px;
}
&:nth-of-type(3) {
flex: 1;
Expand All @@ -157,8 +162,11 @@ const DashboardData: FC = () => {
max-width: 100px;
}
&:last-of-type {
text-align: right;
min-width: 64px;
padding-left: 0px;
text-align: center;
width: 32px;
min-width: 32px;
max-width: 32px;
}
`
});
Expand Down Expand Up @@ -206,34 +214,62 @@ const DashboardData: FC = () => {
border-top: 1px solid transparent;
border-right: 1px solid transparent;
border-bottom: 1px solid transparent;
&:not(.stiff) > div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&:nth-of-type(1) {
padding-left: 16px;
width: 260px;
}
&:nth-of-type(4) {
padding-left: 16px;
&:nth-of-type(2) {
flex: 1;
text-align: right;
}
width: 124px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&:last-of-type {
text-align: right;
padding-left: 0px;
text-align: center;
width: 32px;
min-width: 32px;
max-width: 32px;
}
`,
HeaderCell: `
padding-left: 8px;
&:nth-of-type(1) {
padding-left: 8px;
}
&:nth-of-type(4) {
padding-left: 16px;
}
&:not(:last-of-type) {
border-right: 1px solid #565656;
padding-left: 8px;
border-left: 1px solid #565656;
}
&:first-of-type {
border-left: 0px;
}
`
});

const temperature_theme = useTheme([data_theme]);

const analog_theme = useTheme([
data_theme,
{
BaseCell: `
&:nth-of-type(1) {
width: 100px;
min-width: 100px;
}
&:nth-of-type(2) {
text-align: left;
}
&:nth-of-type(3) {
width: 100px;
min-width: 100px;
}
&:nth-of-type(4) {
text-align: right;
flex: 1;
}
`
}
]);

const getSortIcon = (state: any, sortKey: any) => {
if (state.sortKey === sortKey && state.reverse) {
return <KeyboardArrowDownOutlinedIcon />;
Expand Down Expand Up @@ -671,8 +707,8 @@ const DashboardData: FC = () => {
<Header>
<HeaderRow>
<HeaderCell />
<HeaderCell resize>TYPE</HeaderCell>
<HeaderCell resize>DESCRIPTION</HeaderCell>
<HeaderCell>TYPE</HeaderCell>
<HeaderCell>DESCRIPTION</HeaderCell>
<HeaderCell>ENTITIES</HeaderCell>
<HeaderCell />
</HeaderRow>
Expand All @@ -681,9 +717,7 @@ const DashboardData: FC = () => {
{tableList.map((device: Device, index: number) => (
<Row key={device.id} item={device}>
<Cell>
{/* <IconButton onClick={() => refreshDataIndex(device.id)}> */}
<DeviceIcon type={device.t} />
{/* </IconButton> */}
</Cell>
<Cell>{device.t}</Cell>
<Cell>{device.n}</Cell>
Expand All @@ -698,9 +732,7 @@ const DashboardData: FC = () => {
{(coreData.active_sensors > 0 || coreData.analog_enabled) && (
<Row key="sensor" item={{ id: 'sensor' }}>
<Cell>
{/* <IconButton onClick={() => refreshDataIndex('sensor')}> */}
<DeviceIcon type="Sensor" />
{/* </IconButton> */}
</Cell>
<Cell>Sensors</Cell>
<Cell>Attached EMS-ESP Sensors</Cell>
Expand Down Expand Up @@ -746,12 +778,15 @@ const DashboardData: FC = () => {
<Typography sx={{ pt: 2, pb: 1 }} variant="h6" color="primary">
{deviceData.label}
</Typography>

<FormControlLabel
control={<Checkbox size="small" name="onlyFav" checked={onlyFav} onChange={() => setOnlyFav(!onlyFav)} />}
label={<span style={{ fontSize: '12px' }}>show only favorites</span>}
label={
<span style={{ fontSize: '12px' }}>
only show favorites&nbsp;
<StarIcon color="primary" sx={{ fontSize: 12 }} />
</span>
}
/>

<Table
data={{
nodes: onlyFav
Expand All @@ -760,7 +795,7 @@ const DashboardData: FC = () => {
}}
theme={data_theme}
sort={dv_sort}
// layout={{ custom: true }}
layout={{ custom: true }}
>
{(tableList: any) => (
<>
Expand All @@ -776,10 +811,10 @@ const DashboardData: FC = () => {
ENTITY NAME
</Button>
</HeaderCell>
<HeaderCell resize>
<HeaderCell>
<Button
fullWidth
style={{ fontSize: '14px', justifyContent: 'flex-start' }}
style={{ fontSize: '14px', justifyContent: 'flex-end' }}
endIcon={getSortIcon(dv_sort.state, 'VALUE')}
onClick={() => dv_sort.fns.onToggleSort({ sortKey: 'VALUE' })}
>
Expand Down Expand Up @@ -832,8 +867,12 @@ const DashboardData: FC = () => {
<Typography sx={{ pt: 2, pb: 1 }} variant="h6" color="primary">
Temperature Sensors
</Typography>

<Table data={{ nodes: sensorData.sensors }} theme={data_theme} sort={sensor_sort}>
<Table
data={{ nodes: sensorData.sensors }}
theme={temperature_theme}
sort={sensor_sort}
layout={{ custom: true }}
>
{(tableList: any) => (
<>
<Header>
Expand All @@ -848,10 +887,10 @@ const DashboardData: FC = () => {
NAME
</Button>
</HeaderCell>
<HeaderCell resize>
<HeaderCell>
<Button
fullWidth
style={{ fontSize: '14px', justifyContent: 'flex-start' }}
style={{ fontSize: '14px', justifyContent: 'flex-end' }}
endIcon={getSortIcon(sensor_sort.state, 'TEMPERATURE')}
onClick={() => sensor_sort.fns.onToggleSort({ sortKey: 'TEMPERATURE' })}
>
Expand Down Expand Up @@ -888,7 +927,7 @@ const DashboardData: FC = () => {
Analog Sensors
</Typography>

<Table data={{ nodes: sensorData.analogs }} theme={data_theme} sort={analog_sort}>
<Table data={{ nodes: sensorData.analogs }} theme={analog_theme} sort={analog_sort} layout={{ custom: true }}>
{(tableList: any) => (
<>
<Header>
Expand Down Expand Up @@ -923,7 +962,7 @@ const DashboardData: FC = () => {
TYPE
</Button>
</HeaderCell>
<HeaderCell resize>VALUE</HeaderCell>
<HeaderCell>VALUE</HeaderCell>
<HeaderCell />
</HeaderRow>
</Header>
Expand Down

0 comments on commit ca7bea3

Please sign in to comment.