import React from "react"; import { useParams } from "react-router"; import { Hash, Volume2, Users, HelpCircle, Inbox, Pin } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { useInstanceDetails } from "@/hooks/useServers"; import { useChannels } from "@/hooks/useChannel"; import { useUiStore } from "@/stores/uiStore"; const ChatPage: React.FC = () => { const { instanceId, channelId } = useParams(); const { instance } = useInstanceDetails(instanceId); const { categories } = useChannels(instanceId); const { toggleMemberList, showMemberList } = useUiStore(); // Find current channel const currentChannel = categories ?.flatMap((cat) => cat.channels) ?.find((ch) => ch.id === channelId); // Handle Direct Messages view // if (!instanceId || instanceId === '@me') { // return ( //
// {/* DM Header */} //
//
// // Direct Messages //
//
// //
//
// {/* DM Content */} //
//
//
// //
//

No Direct Messages

//

// When someone sends you a direct message, it will show up here. //

//
//
//
// ); // } if (!currentChannel && channelId) { return (

Channel not found

The channel you're looking for doesn't exist or you don't have access to it.

); } // Default channel view (when just /channels/instanceId) if (!channelId && instance) { const firstChannel = categories?.[0]?.channels?.[0]; return (

Welcome to {instance.name}!

{firstChannel ? `Select a channel from the sidebar to start chatting, or head to #${firstChannel.name} to get started.` : "This server doesn't have any channels yet. Create one to get started!"}

); } const ChannelIcon = currentChannel?.type === "voice" ? Volume2 : Hash; return (
{/* Channel Header */}
{currentChannel?.name} {currentChannel?.topic && ( <>
{currentChannel.topic} )}
{/* Chat Content */}
{/* Messages Area */}
{/* Welcome Message */}

Welcome to #{currentChannel?.name}!

This is the start of the #{currentChannel?.name} channel.

{currentChannel?.topic && (
Topic: {currentChannel.topic}
)}
{/* Placeholder messages */}

No messages yet. Start the conversation!

{/* Message Input */}
{/* Emoji picker, file upload, etc. would go here */}
Press Enter to send
); }; export default ChatPage;