Skip to content

Commit

Permalink
chore(network): don't re-show help indicator for every node
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Nov 26, 2024
1 parent e11a71a commit bed806a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/js/components/Search/SearchResultsCounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const SearchResultsCounts = ({
].join(' ')}
>
<Statistic
title={<CountsTitleWithHelp entity="individual" />}
title={<CountsTitleWithHelp entity="individual" showHelp={!isBeaconNetwork} />}
value={
hasInsufficientData
? t(message ?? '')
Expand All @@ -72,14 +72,14 @@ const SearchResultsCounts = ({
/>
</div>
<Statistic
title={<CountsTitleWithHelp entity="biosample" />}
title={<CountsTitleWithHelp entity="biosample" showHelp={!isBeaconNetwork} />}
value={hasInsufficientData || (!uncensoredCounts && !biosampleCount) ? NO_RESULTS_DASHES : biosampleCount}
valueStyle={STAT_STYLE}
// Slight fixup for alignment of non-Antd icon:
prefix={<BiDna style={{ marginTop: 6, verticalAlign: 'top' }} />}
/>
<Statistic
title={<CountsTitleWithHelp entity="experiment" />}
title={<CountsTitleWithHelp entity="experiment" showHelp={!isBeaconNetwork} />}
value={hasInsufficientData || (!uncensoredCounts && !experimentCount) ? NO_RESULTS_DASHES : experimentCount}
valueStyle={STAT_STYLE}
prefix={<ExperimentOutlined />}
Expand Down
19 changes: 12 additions & 7 deletions src/js/components/Util/CountsTitleWithHelp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,31 @@ const CountsHelpPopoverText = ({ children }: { children: ReactNode }) => (
<div style={{ maxWidth: 360 }}>{children}</div>
);

const CountsTitleWithHelp = ({ entity }: CountsHelpProps) => {
const CountsTitleWithHelp = ({ entity, showHelp }: CountsHelpProps) => {
const t = useTranslationFn();

showHelp = showHelp ?? true; // If undefined, we should show help by default.

const title = t(`entities.${entity}`, T_PLURAL_COUNT);

return (
<Space>
{title}
<Popover
title={title}
content={<CountsHelpPopoverText>{t(`entities.${entity}_help`, { joinArrays: ' ' })}</CountsHelpPopoverText>}
>
<InfoCircleOutlined />
</Popover>
{showHelp && (
<Popover
title={title}
content={<CountsHelpPopoverText>{t(`entities.${entity}_help`, { joinArrays: ' ' })}</CountsHelpPopoverText>}
>
<InfoCircleOutlined />
</Popover>
)}
</Space>
);
};

type CountsHelpProps = {
entity: BentoEntity;
showHelp?: boolean;
};

export default CountsTitleWithHelp;

0 comments on commit bed806a

Please sign in to comment.