From 00f8d0949997cae8c2efa0ad347287a928df9e8c Mon Sep 17 00:00:00 2001 From: Marek Vesely <xvesely4@fi.muni.cz> Date: Thu, 23 May 2024 10:54:55 +0200 Subject: [PATCH] fix: channel button hide label --- frontend/src/views/ChannelButton.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/ChannelButton.tsx b/frontend/src/views/ChannelButton.tsx index 114feedc8..f17e8b4e3 100644 --- a/frontend/src/views/ChannelButton.tsx +++ b/frontend/src/views/ChannelButton.tsx @@ -141,6 +141,16 @@ const ChannelButton: FC<ChannelButtonProps> = ({ [channel.readReceipt, teamId] ) + const children = useMemo(() => { + if (hideLabel) { + return undefined + } + if (isUnread) { + return <b>{channel.name}</b> + } + return channel.name + }, [channel.name, hideLabel, isUnread]) + return ( <LinkButton key={getLink(channel)[0] as string} @@ -155,7 +165,7 @@ const ChannelButton: FC<ChannelButtonProps> = ({ intent: isUnread ? 'warning' : undefined, rightIcon: isUnread ? <Dot color={Colors.RED3} /> : undefined, onClick: mutate, - children: !hideLabel && isUnread ? <b>{channel.name}</b> : channel.name, + children, }} /> ) -- GitLab