import type { BulkCreateHashtagChannelsResult, Channel } from '../types'; import { getConversationHash } from '../utils/urlHash'; import { Button } from './ui/button'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from './ui/dialog'; interface BulkAddChannelResultModalProps { open: boolean; result: BulkCreateHashtagChannelsResult | null; onClose: () => void; } function getChannelHref(channel: Channel): string { const hash = getConversationHash({ type: 'channel', id: channel.key, name: channel.name, }); if (typeof window === 'undefined') { return hash; } return `${window.location.origin}${window.location.pathname}${hash}`; } export function BulkAddChannelResultModal({ open, result, onClose, }: BulkAddChannelResultModalProps) { const createdChannels = result?.created_channels ?? []; return ( !isOpen && onClose()}> Bulk Add Complete {result?.message ?? 'Review the newly added rooms below.'}
{result && (
Created
{createdChannels.length}
Already Present
{result.existing_count}
)} {createdChannels.length > 0 ? (

Ctrl+click any room to open it in a new tab.

) : (

No new rooms were added.

)} {result && result.invalid_names.length > 0 && (
Ignored invalid room names: {result.invalid_names.join(', ')}
)}
); }