diff --git a/src/renderer/src/components/DeviceCard.tsx b/src/renderer/src/components/DeviceCard.tsx index 0081350..842199e 100644 --- a/src/renderer/src/components/DeviceCard.tsx +++ b/src/renderer/src/components/DeviceCard.tsx @@ -1,12 +1,11 @@ import React from "react"; import Typography from "@mui/material/Typography"; -import Button from "@mui/material/Button"; import Box from "@mui/material/Box"; import Card from "@mui/material/Card"; import CardContent from "@mui/material/CardContent"; -import CardActions from "@mui/material/CardActions"; import Chip from "@mui/material/Chip"; import Stack from "@mui/material/Stack"; +import ButtonBase from "@mui/material/ButtonBase"; import { useTheme } from "@mui/material/styles"; // Icons @@ -19,8 +18,6 @@ import RouterIcon from "@mui/icons-material/Router"; import TvIcon from "@mui/icons-material/Tv"; import AcUnitIcon from "@mui/icons-material/AcUnit"; import DeviceUnknownIcon from "@mui/icons-material/DeviceUnknown"; -import ArrowForwardIcon from "@mui/icons-material/ArrowForward"; - import { AnyDevice } from "../../../api/types"; import { DeviceControls } from "./DeviceControls"; import { findDeviceDefinition, getStatusFieldsForDevice } from "../deviceDefinitions"; @@ -91,7 +88,19 @@ export const DeviceCard: React.FC = ({ device, status, onSelect > - + onSelect(device.deviceId)} + aria-label={device.deviceName || t("Unnamed Device")} + sx={{ + display: "flex", + alignItems: "center", + gap: 1.5, + overflow: "hidden", + textAlign: "left", + borderRadius: 2, + p: 0.5, + }} + > = ({ device, status, onSelect {device.deviceType} - + {highlightTempHumidity && (temperatureText || humidityText) ? ( @@ -172,17 +181,6 @@ export const DeviceCard: React.FC = ({ device, status, onSelect - - - ); }; diff --git a/src/renderer/src/components/DeviceControls.tsx b/src/renderer/src/components/DeviceControls.tsx index 197951f..88480ff 100644 --- a/src/renderer/src/components/DeviceControls.tsx +++ b/src/renderer/src/components/DeviceControls.tsx @@ -42,6 +42,7 @@ interface DeviceControlsProps { dense?: boolean; showCustomCommands?: boolean; showNightLightInstruction?: boolean; + showChildLockControls?: boolean; } const clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value)); @@ -62,6 +63,7 @@ export const DeviceControls: React.FC = ({ dense = false, showCustomCommands = true, showNightLightInstruction = true, + showChildLockControls = false, }) => { const dispatch: AppDispatch = useDispatch(); const isSending = useSelector((state: RootState) => selectIsCommandSendingForDevice(state, device.deviceId)); @@ -231,6 +233,14 @@ export const DeviceControls: React.FC = ({ const sliderLabel = (value: number) => `${value}`; const sectionLabelSx = { fontWeight: 700, color: "text.secondary", mt: dense ? 0.25 : 1 }; + const renderSectionLabel = (label: React.ReactNode) => { + if (dense) return null; + return ( + + {label} + + ); + }; const gridColumns = dense ? 2 : 3; const maxControlWidth = dense ? 360 : 520; const buttonGridSx = { @@ -378,9 +388,7 @@ export const DeviceControls: React.FC = ({ if (cmds.length === 0 || isHiddenByDefinition) return null; return ( - - Controls - + {renderSectionLabel("Controls")} {cmds.map((cmd) => ( @@ -407,9 +415,11 @@ export const DeviceControls: React.FC = ({ {isSending && } {deviceError && {deviceError}} - - {t("Virtual Remote")} - {remoteTypeLabel || t("Infrared device")} - + {renderSectionLabel( + <> + {t("Virtual Remote")} - {remoteTypeLabel || t("Infrared device")} + + )} {remoteSupportsDefaultCommands && ( @@ -624,7 +634,7 @@ export const DeviceControls: React.FC = ({ {isBot && ( <> - Bot + {renderSectionLabel("Bot")} {botModeType !== "unknown" && ( @@ -666,7 +676,7 @@ export const DeviceControls: React.FC = ({ {isPlug && ( <> - Plug + {renderSectionLabel("Plug")} @@ -721,7 +731,7 @@ export const DeviceControls: React.FC = ({ {isLight && ( <> - Lighting + {renderSectionLabel("Lighting")}