import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { MessageSquare, Send, Users, Hash } from "lucide-react"; import { useState } from "react"; interface Message { id: string; author: string; content: string; timestamp: string; avatar?: string; } interface Channel { id: string; name: string; description: string; members: number; icon?: string; } export default function AdminStaffChat() { const [selectedChannel, setSelectedChannel] = useState("general"); const [messageInput, setMessageInput] = useState(""); const channels: Channel[] = [ { id: "general", name: "general", description: "General team discussion", members: 12, }, { id: "announcements", name: "announcements", description: "Important team announcements", members: 12, }, { id: "engineering", name: "engineering", description: "Engineering team discussion", members: 5, }, { id: "community", name: "community", description: "Community management team", members: 3, }, ]; const messages: Record = { general: [ { id: "1", author: "Alex Chen", content: "Good morning everyone! Starting weekly standup in 10 minutes.", timestamp: "09:50", }, { id: "2", author: "Jordan Martinez", content: "Ready! Just finishing up the API deployment.", timestamp: "09:55", }, { id: "3", author: "Sam Patel", content: "Community dashboard is live! 🎉", timestamp: "10:02", }, { id: "4", author: "Taylor Kim", content: "Great progress this week!", timestamp: "10:05", }, ], announcements: [ { id: "1", author: "Alex Chen", content: "Q1 roadmap has been published on the wiki.", timestamp: "2024-01-15 14:30", }, { id: "2", author: "Jordan Martinez", content: "Version 2.0 will be released next week.", timestamp: "2024-01-12 11:20", }, ], engineering: [ { id: "1", author: "Jordan Martinez", content: "API performance improvements merged to main.", timestamp: "10:15", }, ], community: [ { id: "1", author: "Sam Patel", content: "Community event next Friday at 3 PM UTC", timestamp: "09:30", }, ], }; const handleSendMessage = () => { if (!messageInput.trim()) return; // In a real app, this would send to the backend console.log(`Message sent to #${selectedChannel}: ${messageInput}`); setMessageInput(""); }; const currentMessages = messages[selectedChannel] || []; const currentChannel = channels.find((c) => c.id === selectedChannel); return (
{/* Channels sidebar */} Channels {channels.map((channel) => ( ))} {/* Main chat area */} {/* Header */}
{currentChannel?.name} {currentChannel?.description}
{currentChannel?.members}
{/* Messages */} {currentMessages.map((msg) => (
{msg.author[0]}
{msg.author} {msg.timestamp}

{msg.content}

))}
{/* Input */}
setMessageInput(e.target.value)} onKeyPress={(e) => e.key === "Enter" && handleSendMessage()} className="flex-1" />
); }