Skip to content

Commit 6151607

Browse files
committed
fix: pinned messages count in header
1 parent 8c68dbb commit 6151607

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

apps/web/src/components/features/channel/ChannelHeader/ChannelHeader.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ const ChannelHeader = () => {
2323
const isCollapsed = state === "collapsed"
2424
const { toggleStarChannel, isStarred } = useChannel(channelID)
2525

26-
const pinnedCount = channel?.pinned_messages_string?.split("\n").length || 0
27-
console.log(channel?.pinned_messages_string)
28-
console.log(pinnedCount)
26+
const pinnedCount = channel?.pinned_messages_string ? channel.pinned_messages_string.split("\n").length : 0
2927

3028
const [drawerType, setDrawerType] = useAtom(channelDrawerAtom(channelID))
3129

@@ -122,7 +120,7 @@ const ChannelHeader = () => {
122120
<Button variant="ghost" size="default" className="h-7 gap-2 rounded-sm" onClick={onOpenPins}>
123121
<Pin className="h-2 w-2 text-foreground/80" />
124122
<span className="sr-only">{_('Pinned')}</span>
125-
<span className="text-muted-foreground text-sm font-normal">{pinnedCount}</span>
123+
{pinnedCount > 0 && <span className="text-muted-foreground text-sm font-normal">{pinnedCount}</span>}
126124
</Button>
127125
</TooltipTrigger>
128126
<TooltipContent>

0 commit comments

Comments
 (0)