import { useChat } from '@/providers/ChatProvider' import { useFetchProfile } from '@/hooks/useFetchProfile' import { useSecondaryPage } from '@/PageManager' import { Pubkey } from '@/domain' import { X, MessageSquare, Shield, Crown } from 'lucide-react' import { Button } from '../ui/button' export default function MemberListPanel({ onClose }: { onClose: () => void }) { const { currentChannel, channelParticipants, channelMods } = useChat() if (!currentChannel) return null // Sort: owner first, then mods, then everyone else const sorted = [...channelParticipants].sort((a, b) => { const aOwner = a === currentChannel.creator ? 0 : 1 const bOwner = b === currentChannel.creator ? 0 : 1 if (aOwner !== bOwner) return aOwner - bOwner const aMod = channelMods.includes(a) ? 0 : 1 const bMod = channelMods.includes(b) ? 0 : 1 return aMod - bMod }) return (