Skip to content

Commit

Permalink
Show text if all telescopes are unparked
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Aug 30, 2024
1 parent 74502e2 commit acdc714
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/APITables/TelescopesTable/TelescopesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 (
Expand All @@ -77,6 +76,10 @@ function TelescopeParked(props: TelescopeParkedProps) {
);
});

if (Pills.filter((p) => p !== null).length === 0) {
Pills = [<APIStatusText key="no-parked">No parked telescopes</APIStatusText>];
}

return (
<Group gap="xs" pr={4}>
{Pills}
Expand Down

0 comments on commit acdc714

Please sign in to comment.