Skip to content

Commit 43e5a3c

Browse files
fix: hide peer icon tooltip on slots nav
1 parent 7a27761 commit 43e5a3c

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/components/PeerIcon.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ interface PeerIconProps {
1212
isYou?: boolean;
1313
size: number;
1414
hideFallback?: boolean;
15+
hideTooltip?: boolean;
1516
}
1617

1718
export default function PeerIcon({
1819
url,
1920
size,
2021
hideFallback,
22+
hideTooltip = false,
2123
isYou,
2224
}: PeerIconProps) {
2325
const [globalHasError, setGlobalHasError] = useAtom(
@@ -31,15 +33,16 @@ export default function PeerIcon({
3133
if (!url || hasError) {
3234
if (hideFallback) {
3335
return <div style={iconStyles} />;
34-
} else if (isYou) {
35-
return (
36-
<Tooltip content="Your current validator">
37-
<img src={privateYouIcon} style={iconStyles} />
38-
</Tooltip>
39-
);
40-
} else {
41-
return <img src={privateIcon} alt="private" style={iconStyles} />;
4236
}
37+
38+
if (isYou) {
39+
const img = <img src={privateYouIcon} style={iconStyles} />;
40+
41+
if (hideTooltip) return img;
42+
return <Tooltip content="Your current validator">{img}</Tooltip>;
43+
}
44+
45+
return <img src={privateIcon} alt="private" style={iconStyles} />;
4346
}
4447

4548
const handleError = () => {

src/features/Navigation/SlotsRenderer.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,12 @@ function SlotIconName({
268268
const { peer, isLeader, name } = useSlotInfo(slot);
269269
return (
270270
<Flex gap="4px" minWidth="0">
271-
<PeerIcon url={peer?.info?.icon_url} size={iconSize} isYou={isLeader} />
271+
<PeerIcon
272+
url={peer?.info?.icon_url}
273+
size={iconSize}
274+
isYou={isLeader}
275+
hideTooltip
276+
/>
272277
<Text className={clsx(styles.slotName, styles.ellipsis)}>{name}</Text>
273278
</Flex>
274279
);

0 commit comments

Comments
 (0)