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