From acdc7148f78b66a8a0deb48fef65bb9231c02a7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Fri, 30 Aug 2024 15:50:08 -0700 Subject: [PATCH] Show text if all telescopes are unparked --- .../APITables/TelescopesTable/TelescopesTable.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/APITables/TelescopesTable/TelescopesTable.tsx b/src/components/APITables/TelescopesTable/TelescopesTable.tsx index eacb7e4..b371928 100644 --- a/src/components/APITables/TelescopesTable/TelescopesTable.tsx +++ b/src/components/APITables/TelescopesTable/TelescopesTable.tsx @@ -48,7 +48,7 @@ function ParkButton() { function TelescopeParked(props: TelescopeParkedProps) { const { data } = props; - const Pills = TELESCOPES.map((tel) => { + let Pills = TELESCOPES.map((tel) => { const telData = data?.[tel]; const parked = telData?.is_parked; @@ -62,8 +62,7 @@ function TelescopeParked(props: TelescopeParkedProps) { color = 'blue'; tooltip = 'Parked'; } else { - color = 'orange.9'; - tooltip = 'Not parked'; + return null; // No pill for unparked telescopes } return ( @@ -77,6 +76,10 @@ function TelescopeParked(props: TelescopeParkedProps) { ); }); + if (Pills.filter((p) => p !== null).length === 0) { + Pills = [No parked telescopes]; + } + return ( {Pills}