diff --git a/src/renderer/src/components/BufferList.tsx b/src/renderer/src/components/BufferList.tsx index 0f6e87b..640635c 100644 --- a/src/renderer/src/components/BufferList.tsx +++ b/src/renderer/src/components/BufferList.tsx @@ -89,7 +89,7 @@ export function BufferList(): JSX.Element { active={b.id === activeBufferId} muted={isEffectivelyMuted(b)} pinned - showAccountPrefix + showServiceIcon accounts={accounts} onSelect={() => void store.selectBuffer(b.id)} onTogglePin={() => togglePin(b.id)} @@ -345,7 +345,9 @@ interface BufferRowProps { muted: boolean pinned: boolean accounts: Account[] - showAccountPrefix?: boolean + /** Pinned rows sit outside their account group, so they carry the service + * mark instead of the buffer-kind glyph to show where they belong. */ + showServiceIcon?: boolean onSelect: () => void onTogglePin: () => void onToggleMute: () => void @@ -359,7 +361,7 @@ function BufferRow({ muted, pinned, accounts, - showAccountPrefix, + showServiceIcon, onSelect, onTogglePin, onToggleMute, @@ -369,6 +371,24 @@ function BufferRow({ const { menu, open, close } = useContextMenu() const account = accounts.find((a) => a.id === buffer.accountId) + // Under an account header the row's own kind is what's worth showing (a + // channel vs a DM vs the server buffer). A pinned row has no header above + // it, so it shows the service instead - the Discord or Matrix mark, or the + // "#" that IRC channels already use - rather than repeating the account + // name as text in front of every entry. + const service = serviceIcon(account?.service ?? '') + const leading = showServiceIcon ? ( + service.svg ? ( + + ) : ( + + ) + ) : buffer.avatarUrl ? ( + + ) : ( + + ) + const entries: MenuEntry[] = [ { label: pinned ? 'Unpin' : 'Pin', icon: 'push_pin', onClick: onTogglePin }, { label: muted ? 'Unmute' : 'Mute', icon: muted ? 'notifications' : 'notifications_off', onClick: onToggleMute }, @@ -388,15 +408,8 @@ function BufferRow({ onContextMenu={open} title={buffer.name} > - {buffer.avatarUrl ? ( - - ) : ( - - )} - - {showAccountPrefix && account ? `${account.displayName} ยท ` : ''} - {bufferDisplayName(buffer.name)} - + {leading} + {bufferDisplayName(buffer.name)} {muted && } {buffer.unread > 0 && !muted && (