Display a message if relays list is empty

This commit is contained in:
Pierre HUBERT 2024-10-12 15:24:40 +02:00
parent e244fff700
commit 2f8b8aa59f

View File

@ -9,15 +9,16 @@ import {
TableHead,
TableRow,
Tooltip,
Typography,
} from "@mui/material";
import React from "react";
import { useNavigate } from "react-router-dom";
import { Device, DeviceApi, DeviceRelay, DeviceURL } from "../api/DeviceApi";
import { RelayApi, RelaysStatus } from "../api/RelayApi";
import { AsyncWidget } from "../widgets/AsyncWidget";
import { BoolText } from "../widgets/BoolText";
import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer";
import { TimeWidget } from "../widgets/TimeWidget";
import { useNavigate } from "react-router-dom";
export function RelaysListRoute(p: {
homeWidget?: boolean;
@ -86,6 +87,10 @@ function RelaysList(p: {
navigate(DeviceURL(dev!));
};
if (p.list.length === 0) {
return <Typography>There is no configured relay yet!</Typography>;
}
return (
<TableContainer component={Paper}>
<Table sx={{ minWidth: 650 }}>