From 2f8b8aa59f4a1d9331b6354a557db44cac240cbf Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 12 Oct 2024 15:24:40 +0200 Subject: [PATCH] Display a message if relays list is empty --- central_frontend/src/routes/RelaysListRoute.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/central_frontend/src/routes/RelaysListRoute.tsx b/central_frontend/src/routes/RelaysListRoute.tsx index 7f0de77..6696bc6 100644 --- a/central_frontend/src/routes/RelaysListRoute.tsx +++ b/central_frontend/src/routes/RelaysListRoute.tsx @@ -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 There is no configured relay yet!; + } + return (