import { useChat } from '@/providers/ChatProvider' import { useSecondaryPage } from '@/PageManager' import { toChatChannel } from '@/lib/link' import { cn } from '@/lib/utils' import { Hash, Plus, Loader2, RefreshCw, Lock, BellOff } from 'lucide-react' import { useState } from 'react' import { Button } from '../ui/button' import CreateChannelDialog from './CreateChannelDialog' export default function ChannelList() { const { channels, currentChannel, isLoadingChannels, refreshChannels, unreadCounts, mutedChannels } = useChat() const { push, pop } = useSecondaryPage() const [showCreate, setShowCreate] = useState(false) return (
Channels
{isLoadingChannels ? (
) : channels.length === 0 ? (
No channels yet
) : ( channels.map((ch) => { const unread = unreadCounts[ch.id] || 0 const isMuted = mutedChannels.has(ch.id) return ( ) }) )}
) }