Skip to content

Commit 2058e20

Browse files
committed
fix: Hide 'None' group filter when no directive groups exist
- Add conditional rendering to only show group filter section when groups exist - Prevents confusing 'None' button from appearing when there are no groups to filter - Improves UI cleanliness when all directives are ungrouped - Maintains filter functionality when groups are actually present
1 parent f27c2c0 commit 2058e20

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

hyperglass/ui/components/query-type.tsx

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,23 @@ const MenuList = (props: MenuListProps<QueryTypeOption, boolean>): JSX.Element =
127127
}
128128
return (
129129
<components.MenuList {...rest}>
130-
<HStack pt={4} px={2} zIndex={2} {...getRootProps()}>
131-
<GroupFilter {...getRadioProps({ value: '', onClick: () => handleClick('') })}>
132-
None
133-
</GroupFilter>
134-
{filtered.groups.map(value => {
135-
return (
136-
<GroupFilter
137-
key={value}
138-
{...getRadioProps({ value, onClick: () => handleClick(value) })}
139-
>
140-
{value}
141-
</GroupFilter>
142-
);
143-
})}
144-
</HStack>
130+
{filtered.groups.length > 0 && (
131+
<HStack pt={4} px={2} zIndex={2} {...getRootProps()}>
132+
<GroupFilter {...getRadioProps({ value: '', onClick: () => handleClick('') })}>
133+
None
134+
</GroupFilter>
135+
{filtered.groups.map(value => {
136+
return (
137+
<GroupFilter
138+
key={value}
139+
{...getRadioProps({ value, onClick: () => handleClick(value) })}
140+
>
141+
{value}
142+
</GroupFilter>
143+
);
144+
})}
145+
</HStack>
146+
)}
145147
{children}
146148
</components.MenuList>
147149
);

0 commit comments

Comments
 (0)