Dont show filter if nothing to filter

Reviewed By: lblasa

Differential Revision: D48471138

fbshipit-source-id: c86d2542b7dc98e323fdde9ae8cc687bd10dfb3a
This commit is contained in:
Luke De Feo
2023-08-21 04:24:16 -07:00
committed by Facebook GitHub Bot
parent 22d1bc2552
commit 03ba22451d

View File

@@ -72,6 +72,8 @@ export const FrameworkEventsInspector: React.FC<Props> = ({
filteredThreads.size === 0 || filteredThreads.has(event.thread!),
);
const showThreadsSection = allThreads.length > 1;
const showEventTypesSection = allEventTypes.length > 1;
return (
<Layout.Container gap="small" padv="small">
<Layout.Right center gap>
@@ -90,6 +92,7 @@ export const FrameworkEventsInspector: React.FC<Props> = ({
}
/>
</Tooltip>
{(showEventTypesSection || showThreadsSection) && (
<Dropdown
overlayStyle={{minWidth: 200}}
overlay={
@@ -101,7 +104,7 @@ export const FrameworkEventsInspector: React.FC<Props> = ({
borderRadius: theme.borderRadius,
boxShadow: `0 0 4px 1px rgba(0,0,0,0.10)`,
}}>
{allThreads.length > 1 && (
{showThreadsSection && (
<>
<Typography.Text strong>By thread</Typography.Text>
{allThreads.map((thread) => (
@@ -126,7 +129,7 @@ export const FrameworkEventsInspector: React.FC<Props> = ({
</>
)}
{allEventTypes.length > 1 && (
{showEventTypesSection && (
<>
<Typography.Text strong>By event type</Typography.Text>
{allEventTypes.map((eventType) => (
@@ -164,6 +167,7 @@ export const FrameworkEventsInspector: React.FC<Props> = ({
}
/>
</Dropdown>
)}
</Layout.Horizontal>
</Layout.Right>