diff --git a/services/frontend/src/app/(dashboard)/dashboard/page.tsx b/services/frontend/src/app/(dashboard)/dashboard/page.tsx index bd7c14a..78c2c5b 100644 --- a/services/frontend/src/app/(dashboard)/dashboard/page.tsx +++ b/services/frontend/src/app/(dashboard)/dashboard/page.tsx @@ -77,6 +77,20 @@ export default function DashboardPage() { {view === "stats" && } + {view === "users" && ( + { + setSelectedUserId(userId); + setView("user-detail"); + }} + /> + )} + {view === "user-detail" && selectedUserId && ( + setView("users")} + /> + )} {view === "channels" && ( void }) { + const [search, setSearch] = useState(""); + const { data: users, isLoading } = useUsers(search || undefined); + + return ( +
+
+ + setSearch(e.target.value)} + className="pl-9 h-9" + /> +
+ {isLoading ? ( + + ) : !users || users.length === 0 ? ( + + ) : ( +
+ {users.map((u) => ( + onSelect(u.user_id)} + > + +
+
+ {u.avatar_url ? ( + + ) : ( + (u.username ?? "?").charAt(0).toUpperCase() + )} +
+
+

+ {u.username ?? "Unknown"} +

+

+ {u.total_messages} messages + {u.flagged_count > 0 && ( + + {u.flagged_count} flagged + + )} +

+
+ +
+
+
+ ))} +
+ )} +
+ ); +} + +// ── User Detail ─────────────────────────────────────────────── + +function UserDetailSection({ + userId, + onBack, +}: { + userId: string; + onBack: () => void; +}) { + const { data: user, isLoading } = useUserDetail(userId); + if (isLoading) return ; + if (!user) return ; + + return ( +
+ + + +
+
+ {user.avatar_url ? ( + + ) : ( + (user.username ?? "?").charAt(0).toUpperCase() + )} +
+
+

+ {user.username ?? "Unknown"} +

+

+ {user.user_id} +

+
+
+
+ + + + +
+ {user.profile_summary && ( +
+
+ +

+ AI Profile +

+
+

{user.profile_summary}

+
+ )} + {user.recent_messages.length > 0 && ( +
+

+ Recent + Messages +

+
+ {user.recent_messages.slice(0, 5).map((msg) => ( +
+

+ + {new Date(msg.created_at).toLocaleString()} +

+

{msg.content}

+
+ ))} +
+
+ )} +
+
+
+ ); +} + // ── Channels ────────────────────────────────────────────────── function ChannelsSection({ diff --git a/services/frontend/src/components/shared/guild-selector.tsx b/services/frontend/src/components/shared/guild-selector.tsx index 3a8d7ce..4872560 100644 --- a/services/frontend/src/components/shared/guild-selector.tsx +++ b/services/frontend/src/components/shared/guild-selector.tsx @@ -124,7 +124,9 @@ export function GuildSelector({