Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Fix unnecessary nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 committed Feb 27, 2024
1 parent 117af1d commit 7a7ba0e
Showing 1 changed file with 30 additions and 36 deletions.
66 changes: 30 additions & 36 deletions src/pages/taskQueue/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ import { H2, H2Props, H3, H3Props } from "@leafygreen-ui/typography";
import { useParams, useNavigate } from "react-router-dom";
import { useTaskQueueAnalytics } from "analytics";
import SearchableDropdown from "components/SearchableDropdown";
import {
TableControlOuterRow,
PageWrapper,
StyledRouterLink,
} from "components/styles";
import { PageWrapper, StyledRouterLink } from "components/styles";
import { getTaskQueueRoute, getAllHostsRoute } from "constants/routes";
import { size } from "constants/tokens";
import { useToastContext } from "context/toast";
Expand Down Expand Up @@ -85,37 +81,35 @@ const TaskQueue = () => {
return (
<StyledPageWrapper>
<StyledH2>Task Queue</StyledH2>
<TableControlOuterRow>
<SearchableDropdownWrapper>
<SearchableDropdown
data-cy="distro-dropdown"
label="Distro"
disabled={loadingDistrosData}
options={distrosData?.taskQueueDistros}
searchFunc={handleSearch}
optionRenderer={(option, onClick) => (
<DistroOption
option={option}
key={`distro-select-search-option-${option.id}`}
onClick={onClick}
/>
)}
onChange={onChangeDistroSelection}
value={selectedDistro}
buttonRenderer={(option: TaskQueueDistro) => (
<DistroLabel>
<StyledBadge>{`${option?.taskCount || 0} ${
option?.taskCount === 1 ? "TASK" : "TASKS"
}`}</StyledBadge>
<StyledBadge>{`${option?.hostCount || 0} ${
option?.hostCount === 1 ? "HOST" : "HOSTS"
}`}</StyledBadge>
<DistroName> {option?.id} </DistroName>
</DistroLabel>
)}
/>
</SearchableDropdownWrapper>
</TableControlOuterRow>
<SearchableDropdownWrapper>
<SearchableDropdown
data-cy="distro-dropdown"
label="Distro"
disabled={loadingDistrosData}
options={distrosData?.taskQueueDistros}
searchFunc={handleSearch}
optionRenderer={(option, onClick) => (
<DistroOption
option={option}
key={`distro-select-search-option-${option.id}`}
onClick={onClick}
/>
)}
onChange={onChangeDistroSelection}
value={selectedDistro}
buttonRenderer={(option: TaskQueueDistro) => (
<DistroLabel>
<StyledBadge>{`${option?.taskCount || 0} ${
option?.taskCount === 1 ? "TASK" : "TASKS"
}`}</StyledBadge>
<StyledBadge>{`${option?.hostCount || 0} ${
option?.hostCount === 1 ? "HOST" : "HOSTS"
}`}</StyledBadge>
<DistroName> {option?.id} </DistroName>
</DistroLabel>
)}
/>
</SearchableDropdownWrapper>
{
/* Only show name & link if distro exists. */
distro && (
Expand Down

0 comments on commit 7a7ba0e

Please sign in to comment.