"use client"; import ProfilePicture from "@/components/ProfilePicture"; import SettingsDialog from "@/components/settings/SettingsDialog"; import AppLayout from "@/components/app/AppLayout"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Separator } from "@/components/ui/separator"; import useApp from "@/hooks/use-app"; import { ProfileSettings } from "@/types/settings"; import { Server } from "@/types/types"; import { motion } from "framer-motion"; import { ChevronLeft, ChevronRight, MessageCircle, Users, Settings, PlusCircle, } from "lucide-react"; import Link from "next/link"; import StartNewDM from "./StartNewDM"; import AsyncValue from "@/components/AsyncValue"; export default function ChatHub() { const app = useApp(); const recentDMs = app.dms?.slice(0, 5) || []; const activeServers: Server[] = Object.values(app.servers).slice(0, 5) || []; const suggestedServers: Server[] = [ { id: "1", name: "Frontend Devs", icon_url: "", channels: [] }, { id: "2", name: "Gamers Lounge", icon_url: "", channels: [] }, { id: "3", name: "Music Hub", icon_url: "", channels: [] }, ]; const recentActivity = app.messages.slice(0, 5); const stats = { dms: app.dms?.length || 0, servers: app.servers?.length || 0, // friends: app.friends?.length || 0, }; return (
{/* Greeting */}
app.setSidebarOpen(true)}>

Hey {app.profile?.display_name || "there"}!

Here’s what’s happening in your network today.

{/* Recent DMs + Active Servers */}
{/* Recent DMs */} Recent DMs {recentDMs.length ? ( recentDMs.map((dm) => ( {dm.display_name || dm.id} )) ) : (

No recent DMs yet.

)}
{/* Active Servers */} Active Servers {activeServers.length ? ( activeServers.map((srv) => ( {srv.name} )) ) : (

No servers joined yet.

)}
{/* Recent Activity Feed */} Recent Activity {recentActivity.length ? ( recentActivity.map((msg) => ( app.getUserById(msg.from)} render={({ value: user }) => (

{user?.display_name || ""}

{msg.contents}

)} /> )) ) : (

No recent messages yet.

)}
{/* Server Discovery */} Discover Servers
{suggestedServers.map((srv) => (

{srv.name}

))}
{/* Quick Actions */}
); }