dmActionsTarget (app/lib/slots.ts) answers the open DM's row or null; ChatHeader renders the slot from it. Same behaviour, testable outside a component.
12 lines
503 B
TypeScript
12 lines
503 B
TypeScript
// The layer's slot rules, shared by the components that render the slots.
|
|
import type { ChatConversationRow } from './types'
|
|
|
|
/**
|
|
* dmActionsTarget is the conversation the conversation-actions slot renders
|
|
* for: the open DM's row when it is a DM, else null (channels never show
|
|
* the slot, so a call button placed in it appears in DMs only).
|
|
*/
|
|
export function dmActionsTarget(dm: ChatConversationRow | null | undefined): ChatConversationRow | null {
|
|
return dm && dm.type === 'dm' ? dm : null
|
|
}
|