feat: replace corrections/tuner with dashboard module

Replace the corrections/adaptive-prompt-tuner feature with a new
dashboard module providing server stats and user profile overview.

Backend:
- Add dashboard module (routes, service, repository) with stats + user list + user detail endpoints
- Remove corrections module entirely
- Wire dashboard router in app.ts

Frontend:
- Add dashboard feature (DashboardStats, UserSummaryList, UserProfileDetail components + useDashboard hook)
- Remove tuner feature (CorrectionStats, CorrectionHistory, SubmitCorrection, useCorrections)
- Update API client from corrections → dashboard types/fns
- Rename tab 'tuner' → 'dashboard'
- Update MobileTabBar, Header, Sidebar links

Tests:
- Expand backend placeholder test with dashboard assertions
- Expand discord-gateway placeholder test with config/channel assertions

AI moderation:
- llmModerationClient: improve status/reply detection, expand safety categories, fix timer reset
- userProfileLearner: fix isReply refinement
- userProfileStore: add pending cache check
- messageMetadata: add crosspost type mapping
- migrate.ts: improve partial-index safety in schema push

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-13 11:24:42 +07:00
co-authored by Claude
parent e3249edb6c
commit 30f8d7cce3
32 changed files with 1409 additions and 1219 deletions
+3 -3
View File
@@ -1,10 +1,10 @@
import { useEffect, useMemo, useState } from "react";
import { AuthOverlay } from "./features/auth";
import { DashboardPanel } from "./features/dashboard";
import { LivePanel } from "./features/live";
import { useMediaControl } from "./features/live/hooks/useMediaControl";
import { useVoiceControl } from "./features/live/hooks/useVoiceControl";
import { MessagesPanel } from "./features/messages";
import { TunerPanel } from "./features/tuner";
import { ModerationAlertListener } from "./features/messages/components/ModerationAlertListener";
import {
mergeMessages,
@@ -183,11 +183,11 @@ export default function App() {
onVolumeChange={media.setVolume}
/>
)
) : activeTab === "tuner" ? (
) : activeTab === "dashboard" ? (
!isAuthenticated ? (
<AuthOverlay onAuthenticated={() => setIsAuthenticated(true)} />
) : (
<TunerPanel />
<DashboardPanel />
)
) : (
<MessagesPanel
@@ -0,0 +1,229 @@
import { motion } from "framer-motion";
import {
AlertCircle,
BarChart3,
MessageSquare,
Mic,
RefreshCw,
ShieldAlert,
UserCheck,
Users,
} from "lucide-react";
import { cardItem, cardStagger } from "../../../shared/hooks/useFramerStagger";
import { cn } from "../../../shared/lib/utils";
import {
Card,
CardContent,
CardHeader,
CardTitle,
Skeleton,
} from "../../../shared/ui";
import { useDashboardStats } from "../hooks/useDashboard";
export function DashboardStatsContent() {
const { stats, loading, error, refetch } = useDashboardStats();
if (loading) {
return <StatsSkeleton />;
}
if (error) {
return (
<div className="flex flex-col items-center gap-4 py-20 text-muted-foreground">
<AlertCircle className="h-10 w-10 text-destructive" />
<p className="text-sm">{error}</p>
<button
onClick={() => refetch()}
className="inline-flex items-center gap-1.5 rounded-xl border border-border px-4 py-2 text-sm font-medium hover:bg-accent transition-colors"
>
<RefreshCw className="h-4 w-4" /> Retry
</button>
</div>
);
}
if (!stats) {
return (
<div className="flex flex-col items-center gap-4 py-20 text-muted-foreground">
<BarChart3 className="h-10 w-10" />
<p className="text-sm">No data available yet.</p>
</div>
);
}
const cards = [
{
title: "Total Messages",
value: stats.total_messages.toLocaleString(),
icon: MessageSquare,
color: "text-primary",
bg: "bg-primary/10",
},
{
title: "Today's Messages",
value: stats.today_messages.toLocaleString(),
icon: MessageSquare,
color: "text-emerald-500",
bg: "bg-emerald-100",
},
{
title: "Total Users",
value: stats.total_users.toLocaleString(),
icon: Users,
color: "text-blue-500",
bg: "bg-blue-100",
},
{
title: "Active Users (24h)",
value: stats.active_users_24h.toLocaleString(),
icon: UserCheck,
color: "text-violet-500",
bg: "bg-violet-100",
},
{
title: "Flagged",
value: stats.total_flagged.toLocaleString(),
icon: ShieldAlert,
color: "text-destructive",
bg: "bg-destructive/10",
},
{
title: "Clean",
value: stats.total_clean.toLocaleString(),
icon: ShieldAlert,
color: "text-emerald-600",
bg: "bg-emerald-100",
},
{
title: "Voice Recordings",
value: stats.total_voice_recordings.toLocaleString(),
icon: Mic,
color: "text-cyan-500",
bg: "bg-cyan-100",
},
{
title: "AI Profiles",
value: stats.total_profiles.toLocaleString(),
icon: Users,
color: "text-amber-500",
bg: "bg-amber-100",
},
];
return (
<motion.div
className="grid gap-6"
variants={cardStagger}
initial="initial"
animate="animate"
>
{/* Summary cards grid */}
<motion.div
variants={cardItem}
className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4"
>
{cards.map((card) => (
<Card key={card.title} className="overflow-hidden">
<CardContent className="p-4">
<div className="flex items-center justify-between">
<div className="space-y-1">
<p className="text-xs font-medium text-muted-foreground">
{card.title}
</p>
<p className="text-2xl font-bold tracking-tight">
{card.value}
</p>
</div>
<div className={cn("rounded-xl p-2.5", card.bg)}>
<card.icon className={cn("h-5 w-5", card.color)} />
</div>
</div>
</CardContent>
</Card>
))}
</motion.div>
{/* Top channels */}
<motion.div variants={cardItem}>
<Card>
<CardHeader>
<CardTitle className="text-primary">Top Channels</CardTitle>
</CardHeader>
<CardContent>
{stats.top_channels.length === 0 ? (
<p className="text-sm text-muted-foreground">
No channel data yet.
</p>
) : (
<div className="space-y-2">
{stats.top_channels.map((ch, i) => (
<div
key={ch.channel_id}
className="flex items-center justify-between rounded-lg bg-muted/50 px-3 py-2 text-sm"
>
<span className="truncate font-mono text-xs text-muted-foreground">
#{ch.channel_id}
</span>
<span className="ml-2 shrink-0 font-medium">
{ch.message_count.toLocaleString()}
</span>
</div>
))}
</div>
)}
</CardContent>
</Card>
</motion.div>
{/* Moderation overview */}
<motion.div variants={cardItem}>
<Card>
<CardHeader>
<CardTitle className="text-primary">Moderation Queue</CardTitle>
</CardHeader>
<CardContent>
<div className="grid gap-4 sm:grid-cols-3">
<div className="rounded-xl border border-border bg-card p-4 text-center">
<p className="text-2xl font-bold text-muted-foreground">
{stats.moderation_overview.pending}
</p>
<p className="text-xs text-muted-foreground mt-1">Pending</p>
</div>
<div className="rounded-xl border border-border bg-card p-4 text-center">
<p className="text-2xl font-bold text-amber-500">
{stats.moderation_overview.processing}
</p>
<p className="text-xs text-muted-foreground mt-1">Processing</p>
</div>
<div className="rounded-xl border border-border bg-card p-4 text-center">
<p className="text-2xl font-bold text-destructive">
{stats.moderation_overview.error}
</p>
<p className="text-xs text-muted-foreground mt-1">Errors</p>
</div>
</div>
</CardContent>
</Card>
</motion.div>
</motion.div>
);
}
function StatsSkeleton() {
return (
<div className="grid gap-6">
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
{Array.from({ length: 8 }).map((_, i) => (
<Card key={i}>
<CardContent className="p-4">
<div className="space-y-2">
<Skeleton className="h-3 w-24" />
<Skeleton className="h-7 w-16" />
</div>
</CardContent>
</Card>
))}
</div>
</div>
);
}
@@ -0,0 +1,277 @@
import { motion } from "framer-motion";
import { AlertCircle, ArrowLeft, RefreshCw, User } from "lucide-react";
import type { DashboardUserDetail } from "../../../shared/api/client";
import {
cardItem,
cardStagger,
fadeSlideUp,
} from "../../../shared/hooks/useFramerStagger";
import { cn } from "../../../shared/lib/utils";
import {
Badge,
Card,
CardContent,
CardHeader,
CardTitle,
Skeleton,
} from "../../../shared/ui";
interface UserProfileDetailProps {
detail: DashboardUserDetail | null;
loading: boolean;
error: string | null;
onBack: () => void;
onRefetch: () => void;
}
export function UserProfileDetail({
detail,
loading,
error,
onBack,
onRefetch,
}: UserProfileDetailProps) {
return (
<motion.div
className="grid gap-6"
variants={cardStagger}
initial="initial"
animate="animate"
>
{/* Back button */}
<motion.div variants={cardItem}>
<button
onClick={onBack}
className="inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors"
>
<ArrowLeft className="h-4 w-4" /> Back to users
</button>
</motion.div>
{/* Loading */}
{loading && <DetailSkeleton />}
{/* Error */}
{error && (
<motion.div
variants={cardItem}
className="flex flex-col items-center gap-4 py-20 text-muted-foreground"
>
<AlertCircle className="h-10 w-10 text-destructive" />
<p className="text-sm">{error}</p>
<button
onClick={onRefetch}
className="inline-flex items-center gap-1.5 rounded-xl border border-border px-4 py-2 text-sm font-medium hover:bg-accent transition-colors"
>
<RefreshCw className="h-4 w-4" /> Retry
</button>
</motion.div>
)}
{detail && !error && (
<>
{/* Profile header */}
<motion.div variants={cardItem}>
<Card>
<CardContent className="p-6">
<div className="flex items-start gap-4">
{/* Avatar */}
<div className="shrink-0">
{detail.avatar_url ? (
<img
src={detail.avatar_url}
alt={detail.username ?? "User"}
className="h-16 w-16 rounded-full object-cover ring-2 ring-border"
/>
) : (
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-muted ring-2 ring-border">
<User className="h-8 w-8 text-muted-foreground" />
</div>
)}
</div>
{/* Info */}
<div className="min-w-0 flex-1">
<h2 className="text-lg font-bold">
{detail.username ?? detail.user_id}
</h2>
<p className="mt-0.5 truncate font-mono text-xs text-muted-foreground">
{detail.user_id}
</p>
<div className="mt-3 flex flex-wrap items-center gap-2">
{detail.trust_score !== null && (
<Badge
variant={
detail.trust_score >= 80
? "success"
: detail.trust_score >= 50
? "warning"
: "destructive"
}
>
Trust: {detail.trust_score}
</Badge>
)}
{detail.total_infractions !== null &&
detail.total_infractions > 0 && (
<Badge variant="destructive">
{detail.total_infractions} infractions
</Badge>
)}
{detail.clean_message_streak !== null &&
detail.clean_message_streak > 0 && (
<Badge variant="success">
Streak: {detail.clean_message_streak}
</Badge>
)}
</div>
</div>
</div>
{/* Profile summary */}
{detail.profile_summary && (
<div className="mt-4 rounded-lg bg-muted/50 p-3">
<p className="text-xs font-medium text-muted-foreground mb-1">
AI Profile Summary
</p>
<p className="text-sm whitespace-pre-wrap">
{detail.profile_summary}
</p>
{detail.last_analyzed_at && (
<p className="mt-1 text-[11px] text-muted-foreground">
Last analyzed:{" "}
{new Date(detail.last_analyzed_at).toLocaleString()}
</p>
)}
</div>
)}
</CardContent>
</Card>
</motion.div>
{/* Stats grid */}
<motion.div variants={cardItem} className="grid gap-4 sm:grid-cols-3">
<Card>
<CardContent className="p-4 text-center">
<p className="text-2xl font-bold text-primary">
{detail.total_messages.toLocaleString()}
</p>
<p className="text-xs text-muted-foreground mt-1">
Total Messages
</p>
</CardContent>
</Card>
<Card>
<CardContent className="p-4 text-center">
<p className="text-2xl font-bold text-emerald-600">
{detail.clean_count.toLocaleString()}
</p>
<p className="text-xs text-muted-foreground mt-1">Clean</p>
</CardContent>
</Card>
<Card>
<CardContent className="p-4 text-center">
<p
className={cn(
"text-2xl font-bold",
detail.flagged_count > 0
? "text-destructive"
: "text-muted-foreground",
)}
>
{detail.flagged_count.toLocaleString()}
</p>
<p className="text-xs text-muted-foreground mt-1">Flagged</p>
</CardContent>
</Card>
</motion.div>
{/* Recent messages */}
<motion.div variants={cardItem}>
<Card>
<CardHeader>
<CardTitle className="text-primary">Recent Messages</CardTitle>
</CardHeader>
<CardContent>
{detail.recent_messages.length === 0 ? (
<p className="text-sm text-muted-foreground">
No messages found.
</p>
) : (
<div className="space-y-2 max-h-80 overflow-y-auto">
{detail.recent_messages.map((msg) => (
<div
key={msg.id}
className="rounded-lg border border-border p-3 text-sm"
>
<div className="flex items-start justify-between gap-2">
<p className="line-clamp-2 flex-1 break-words text-xs text-foreground">
{msg.content}
</p>
{msg.ai_status && (
<span
className={cn(
"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium",
msg.ai_status === "flagged"
? "bg-red-100 text-red-700"
: msg.ai_status === "clean"
? "bg-emerald-100 text-emerald-700"
: msg.ai_status === "warn"
? "bg-amber-100 text-amber-700"
: "bg-muted text-muted-foreground",
)}
>
{msg.ai_status}
</span>
)}
</div>
<p className="mt-1 text-[10px] text-muted-foreground">
#{msg.channel_id} ·{" "}
{new Date(msg.created_at).toLocaleString()}
</p>
</div>
))}
</div>
)}
</CardContent>
</Card>
</motion.div>
</>
)}
</motion.div>
);
}
function DetailSkeleton() {
return (
<div className="space-y-6">
<Card>
<CardContent className="p-6">
<div className="flex items-start gap-4">
<Skeleton className="h-16 w-16 rounded-full" />
<div className="flex-1 space-y-2">
<Skeleton className="h-5 w-40" />
<Skeleton className="h-3 w-60" />
<div className="flex gap-2 mt-2">
<Skeleton className="h-5 w-20 rounded-full" />
<Skeleton className="h-5 w-24 rounded-full" />
</div>
</div>
</div>
<Skeleton className="mt-4 h-20 w-full rounded-lg" />
</CardContent>
</Card>
<div className="grid gap-4 sm:grid-cols-3">
{Array.from({ length: 3 }).map((_, i) => (
<Card key={i}>
<CardContent className="p-4 text-center space-y-1">
<Skeleton className="mx-auto h-7 w-16" />
<Skeleton className="mx-auto h-3 w-20" />
</CardContent>
</Card>
))}
</div>
</div>
);
}
@@ -0,0 +1,197 @@
import { motion } from "framer-motion";
import { AlertCircle, Loader2, RefreshCw, Search, User } from "lucide-react";
import type { DashboardUser } from "../../../shared/api/client";
import { cardItem, cardStagger } from "../../../shared/hooks/useFramerStagger";
import { cn } from "../../../shared/lib/utils";
import {
Card,
CardContent,
CardHeader,
CardTitle,
Input,
Skeleton,
} from "../../../shared/ui";
interface UserSummaryListProps {
users: DashboardUser[];
loading: boolean;
error: string | null;
search: string;
onSearchChange: (value: string) => void;
onLoadMore: () => void;
hasMore: boolean;
onRefetch: () => void;
onSelectUser: (userId: string) => void;
}
export function UserSummaryList({
users,
loading,
error,
search,
onSearchChange,
onLoadMore,
hasMore,
onRefetch,
onSelectUser,
}: UserSummaryListProps) {
return (
<motion.div
className="grid gap-6"
variants={cardStagger}
initial="initial"
animate="animate"
>
{/* Search bar */}
<motion.div variants={cardItem} className="flex items-center gap-2">
<div className="relative flex-1">
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-primary" />
<Input
className="pl-9 rounded-full focus-visible:ring-primary"
placeholder="Search by username or user ID..."
value={search}
onChange={(e) => onSearchChange(e.target.value)}
/>
</div>
</motion.div>
{/* Error state */}
{error && (
<motion.div
variants={cardItem}
className="flex flex-col items-center gap-4 py-10 text-muted-foreground"
>
<AlertCircle className="h-10 w-10 text-destructive" />
<p className="text-sm">{error}</p>
<button
onClick={onRefetch}
className="inline-flex items-center gap-1.5 rounded-xl border border-border px-4 py-2 text-sm font-medium hover:bg-accent transition-colors"
>
<RefreshCw className="h-4 w-4" /> Retry
</button>
</motion.div>
)}
{/* Loading state */}
{loading && users.length === 0 && !error && <UserListSkeleton />}
{/* Empty state */}
{!loading && !error && users.length === 0 && (
<motion.div
variants={cardItem}
className="flex flex-col items-center gap-4 py-20 text-muted-foreground"
>
<User className="h-10 w-10" />
<p className="text-sm">No users found.</p>
</motion.div>
)}
{/* User cards */}
{users.length > 0 && (
<motion.div variants={cardItem} className="grid gap-3 sm:grid-cols-2">
{users.map((u) => (
<button
key={u.user_id}
onClick={() => onSelectUser(u.user_id)}
className="group w-full text-left"
>
<Card className="transition-all hover:ring-1 hover:ring-primary/30 cursor-pointer">
<CardContent className="p-4">
<div className="flex items-start gap-3">
{/* Avatar */}
<div className="shrink-0">
{u.avatar_url ? (
<img
src={u.avatar_url}
alt={u.username ?? "User"}
className="h-10 w-10 rounded-full object-cover"
/>
) : (
<div className="flex h-10 w-10 items-center justify-center rounded-full bg-muted">
<User className="h-5 w-5 text-muted-foreground" />
</div>
)}
</div>
{/* Info */}
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<span className="truncate text-sm font-semibold">
{u.username ?? u.user_id}
</span>
{u.trust_score !== null && (
<span
className={cn(
"shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium",
u.trust_score >= 80
? "bg-emerald-100 text-emerald-700"
: u.trust_score >= 50
? "bg-amber-100 text-amber-700"
: "bg-red-100 text-red-700",
)}
>
{u.trust_score}
</span>
)}
</div>
{u.profile_summary && (
<p className="mt-1 line-clamp-2 text-xs text-muted-foreground">
{u.profile_summary}
</p>
)}
<div className="mt-1.5 flex items-center gap-3 text-[11px] text-muted-foreground">
<span>{u.total_messages} messages</span>
{u.flagged_count > 0 && (
<span className="text-destructive">
{u.flagged_count} flagged
</span>
)}
</div>
</div>
</div>
</CardContent>
</Card>
</button>
))}
</motion.div>
)}
{/* Load more */}
{hasMore && (
<motion.div variants={cardItem} className="flex justify-center">
<button
onClick={onLoadMore}
disabled={loading}
className="inline-flex items-center gap-2 rounded-xl border border-border px-6 py-2 text-sm font-medium hover:bg-accent transition-colors disabled:opacity-50"
>
{loading && <Loader2 className="h-4 w-4 animate-spin" />}
{loading ? "Loading..." : "Load More"}
</button>
</motion.div>
)}
</motion.div>
);
}
function UserListSkeleton() {
return (
<div className="grid gap-3 sm:grid-cols-2">
{Array.from({ length: 6 }).map((_, i) => (
<Card key={i}>
<CardContent className="p-4">
<div className="flex items-start gap-3">
<Skeleton className="h-10 w-10 rounded-full" />
<div className="flex-1 space-y-2">
<Skeleton className="h-4 w-32" />
<Skeleton className="h-3 w-full" />
<Skeleton className="h-3 w-24" />
</div>
</div>
</CardContent>
</Card>
))}
</div>
);
}
@@ -0,0 +1,135 @@
import { useCallback, useEffect, useState } from "react";
import {
type DashboardStats,
type DashboardUser,
type DashboardUserDetail,
getDashboardStats,
getDashboardUserDetail,
listDashboardUsers,
} from "../../../shared/api/client";
const logger = console;
/**
* Fetch dashboard aggregate stats.
*/
export function useDashboardStats() {
const [stats, setStats] = useState<DashboardStats | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const fetch = useCallback(async () => {
setLoading(true);
setError(null);
try {
const data = await getDashboardStats();
setStats(data);
} catch (e) {
const msg = e instanceof Error ? e.message : "Failed to load stats";
setError(msg);
logger.error("[useDashboardStats]", msg);
} finally {
setLoading(false);
}
}, []);
useEffect(() => {
fetch().catch(() => undefined);
}, [fetch]);
return { stats, loading, error, refetch: fetch };
}
/**
* Fetch paginated user list with optional search.
*/
export function useDashboardUsers() {
const [users, setUsers] = useState<DashboardUser[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [nextCursor, setNextCursor] = useState<string | null>(null);
const [search, setSearch] = useState("");
const fetchUsers = useCallback(
async (cursor?: string) => {
setLoading(true);
setError(null);
try {
const result = await listDashboardUsers({
limit: 20,
cursor,
search: search || undefined,
});
if (cursor) {
setUsers((prev) => [...prev, ...result.data]);
} else {
setUsers(result.data);
}
setNextCursor(result.nextCursor);
} catch (e) {
const msg = e instanceof Error ? e.message : "Failed to load users";
setError(msg);
logger.error("[useDashboardUsers]", msg);
} finally {
setLoading(false);
}
},
[search],
);
useEffect(() => {
fetchUsers().catch(() => undefined);
}, [fetchUsers]);
const loadMore = useCallback(() => {
if (nextCursor && !loading) {
fetchUsers(nextCursor).catch(() => undefined);
}
}, [nextCursor, loading, fetchUsers]);
return {
users,
loading,
error,
search,
setSearch,
loadMore,
hasMore: !!nextCursor,
refetch: () => fetchUsers().catch(() => undefined),
};
}
/**
* Fetch a single user detail by userId.
*/
export function useDashboardUserDetail(userId: string | null) {
const [detail, setDetail] = useState<DashboardUserDetail | null>(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const fetch = useCallback(async () => {
if (!userId) return;
setLoading(true);
setError(null);
try {
const data = await getDashboardUserDetail(userId);
if (!data) {
setError("User not found");
return;
}
setDetail(data);
} catch (e) {
const msg = e instanceof Error ? e.message : "Failed to load user detail";
setError(msg);
logger.error("[useDashboardUserDetail]", msg);
} finally {
setLoading(false);
}
}, [userId]);
useEffect(() => {
fetch().catch(() => undefined);
}, [fetch]);
return { detail, loading, error, refetch: fetch };
}
@@ -0,0 +1,72 @@
import { useState } from "react";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../shared/ui";
import { DashboardStatsContent } from "./components/DashboardStats";
import { UserProfileDetail } from "./components/UserProfileDetail";
import { UserSummaryList } from "./components/UserSummaryList";
import {
useDashboardUserDetail,
useDashboardUsers,
} from "./hooks/useDashboard";
export function DashboardPanel() {
const [activeTab, setActiveTab] = useState("stats");
const [selectedUserId, setSelectedUserId] = useState<string | null>(null);
const {
users,
loading: usersLoading,
error: usersError,
search,
setSearch,
loadMore,
hasMore,
refetch: refetchUsers,
} = useDashboardUsers();
const {
detail,
loading: detailLoading,
error: detailError,
refetch: refetchDetail,
} = useDashboardUserDetail(selectedUserId);
// Show user detail view
if (selectedUserId) {
return (
<UserProfileDetail
detail={detail}
loading={detailLoading}
error={detailError}
onBack={() => {
setSelectedUserId(null);
}}
onRefetch={refetchDetail}
/>
);
}
return (
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
<TabsList className="mb-6">
<TabsTrigger value="stats">Stats</TabsTrigger>
<TabsTrigger value="users">Users</TabsTrigger>
</TabsList>
<TabsContent value="stats">
<DashboardStatsContent />
</TabsContent>
<TabsContent value="users">
<UserSummaryList
users={users}
loading={usersLoading}
error={usersError}
search={search}
onSearchChange={setSearch}
onLoadMore={loadMore}
hasMore={hasMore}
onRefetch={refetchUsers}
onSelectUser={setSelectedUserId}
/>
</TabsContent>
</Tabs>
);
}
@@ -1,192 +0,0 @@
import { motion } from "framer-motion";
import { AlertCircle, ChevronDown, RefreshCw } from "lucide-react";
import { useCorrectionHistory } from "../hooks/useCorrections";
import {
Badge,
Button,
Card,
CardContent,
CardHeader,
CardTitle,
ScrollArea,
Skeleton,
} from "../../../shared/ui";
import { formatDate } from "../../../shared/lib/utils";
import { EmptyStateMascot } from "../../../shared/ui";
import { cardStagger, cardItem } from "../../../shared/hooks/useFramerStagger";
function parseFlags(flags: string): string[] {
try {
return JSON.parse(flags) as string[];
} catch {
return [];
}
}
function CorrectionRow({
entry,
index,
}: {
entry: {
id: string;
created_at: number;
original_flags: string;
corrected_flags: string;
content_snippet: string;
correction_notes: string | null;
};
index: number;
}) {
const originalFlags = parseFlags(entry.original_flags);
const correctedFlags = parseFlags(entry.corrected_flags);
const isCleared = correctedFlags.length === 0;
return (
<motion.tr
variants={cardItem}
className="border-b border-border/40 last:border-0 hover:bg-primary/5 transition-colors"
>
<td className="whitespace-nowrap py-3 pr-4 text-xs text-muted-foreground">
{formatDate(entry.created_at)}
</td>
<td className="py-3 pr-4">
<div className="flex flex-wrap gap-1">
{originalFlags.map((f) => (
<Badge
key={f}
variant="destructive"
className="text-[10px] capitalize"
>
{f.replace(/_/g, " ")}
</Badge>
))}
</div>
</td>
<td className="py-3 pr-4">
{isCleared ? (
<Badge
variant="success"
className="text-[10px] bg-emerald-100 text-emerald-800 border-emerald-200"
>
Cleared
</Badge>
) : (
<div className="flex flex-wrap gap-1">
{correctedFlags.map((f) => (
<Badge
key={f}
variant="outline"
className="text-[10px] capitalize"
>
{f.replace(/_/g, " ")}
</Badge>
))}
</div>
)}
</td>
<td className="max-w-[200px] truncate py-3 pr-4 text-sm text-muted-foreground">
{entry.content_snippet}
</td>
<td className="max-w-[150px] truncate py-3 text-xs text-muted-foreground">
{entry.correction_notes || "—"}
</td>
</motion.tr>
);
}
export function CorrectionHistoryContent() {
const { entries, loading, loadingMore, error, hasMore, loadMore, refetch } =
useCorrectionHistory();
if (loading) {
return (
<div className="space-y-3">
<Skeleton className="h-12 rounded-xl" />
<Skeleton className="h-12 rounded-xl" />
<Skeleton className="h-12 rounded-xl" />
<Skeleton className="h-12 rounded-xl" />
<Skeleton className="h-12 rounded-xl" />
</div>
);
}
if (error) {
return (
<Card className="rounded-xl border-red-200 bg-red-50">
<CardContent className="flex items-center gap-3 py-6">
<AlertCircle className="h-5 w-5 shrink-0 text-red-500" />
<p className="flex-1 text-sm text-red-700">{error}</p>
<button
type="button"
onClick={refetch}
className="flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium text-red-700 hover:bg-red-100 transition-colors"
>
<RefreshCw className="h-4 w-4" />
Retry
</button>
</CardContent>
</Card>
);
}
if (entries.length === 0) {
return (
<Card className="rounded-xl">
<CardContent className="flex flex-col items-center py-12">
<EmptyStateMascot />
<p className="mt-4 text-sm text-muted-foreground text-center max-w-md">
No corrections submitted yet. Use the Submit tab to record your
first correction.
</p>
</CardContent>
</Card>
);
}
return (
<Card className="rounded-xl">
<CardHeader>
<CardTitle className="text-sm font-medium text-muted-foreground">
Correction History
</CardTitle>
</CardHeader>
<CardContent className="p-0">
<ScrollArea className="max-h-[60vh]">
<table className="w-full">
<thead>
<tr className="border-b border-border/40 text-left text-xs font-medium text-muted-foreground">
<th className="whitespace-nowrap px-4 py-3">Date</th>
<th className="px-4 py-3">Original</th>
<th className="px-4 py-3">Corrected</th>
<th className="px-4 py-3">Content</th>
<th className="px-4 py-3">Notes</th>
</tr>
</thead>
<tbody>
{entries.map((entry, i) => (
<CorrectionRow key={entry.id} entry={entry} index={i} />
))}
</tbody>
</table>
</ScrollArea>
{hasMore && (
<div className="flex justify-center border-t border-border/40 px-4 py-3">
<Button
variant="ghost"
size="sm"
onClick={loadMore}
disabled={loadingMore}
className="gap-1.5 text-xs"
>
<ChevronDown
className={`h-3.5 w-3.5 transition-transform ${loadingMore ? "animate-bounce" : ""}`}
/>
{loadingMore ? "Loading..." : "Load More"}
</Button>
</div>
)}
</CardContent>
</Card>
);
}
@@ -1,166 +0,0 @@
import { motion } from "framer-motion";
import { AlertCircle, RefreshCw } from "lucide-react";
import { useCorrectionStats } from "../hooks/useCorrections";
import {
Card,
CardContent,
CardHeader,
CardTitle,
Skeleton,
} from "../../../shared/ui";
import { EmptyStateMascot } from "../../../shared/ui";
function FlagsBar({
flag,
count,
max,
}: {
flag: string;
count: number;
max: number;
}) {
const pct = max > 0 ? (count / max) * 100 : 0;
return (
<div className="flex items-center gap-3">
<span className="w-36 shrink-0 truncate text-sm font-medium capitalize text-muted-foreground">
{flag.replace(/_/g, " ")}
</span>
<div className="flex-1">
<div className="h-2.5 rounded-full bg-primary/10">
<motion.div
className="h-2.5 rounded-full bg-gradient-to-r from-primary to-blue-400"
initial={{ width: 0 }}
animate={{ width: `${pct}%` }}
transition={{ duration: 0.8, ease: "easeOut" }}
/>
</div>
</div>
<span className="w-8 text-right text-sm font-bold text-foreground">
{count}
</span>
</div>
);
}
export function CorrectionStatsContent() {
const { stats, loading, error, refetch } = useCorrectionStats();
if (loading) {
return (
<div className="grid gap-4 md:grid-cols-3">
<Skeleton className="h-32 rounded-xl" />
<Skeleton className="h-32 rounded-xl" />
<Skeleton className="h-32 rounded-xl" />
</div>
);
}
if (error) {
return (
<Card className="rounded-xl border-red-200 bg-red-50">
<CardContent className="flex items-center gap-3 py-6">
<AlertCircle className="h-5 w-5 shrink-0 text-red-500" />
<p className="flex-1 text-sm text-red-700">{error}</p>
<button
type="button"
onClick={refetch}
className="flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium text-red-700 hover:bg-red-100 transition-colors"
>
<RefreshCw className="h-4 w-4" />
Retry
</button>
</CardContent>
</Card>
);
}
if (!stats || stats.total_corrections === 0) {
return (
<Card className="rounded-xl">
<CardContent className="flex flex-col items-center py-12">
<EmptyStateMascot />
<p className="mt-4 text-sm text-muted-foreground text-center max-w-md">
No corrections yet. When admins correct false positives, statistics
will appear here.
</p>
</CardContent>
</Card>
);
}
return (
<motion.div
initial="initial"
animate="animate"
variants={{
initial: { opacity: 0 },
animate: { transition: { staggerChildren: 0.1 } },
}}
className="space-y-4"
>
{/* Summary cards */}
<div className="grid gap-4 md:grid-cols-2">
<motion.div
variants={{
initial: { opacity: 0, y: 16 },
animate: { opacity: 1, y: 0, transition: { duration: 0.4 } },
}}
>
<Card className="rounded-xl">
<CardHeader className="pb-2">
<CardTitle className="text-sm font-medium text-muted-foreground">
Total Corrections
</CardTitle>
</CardHeader>
<CardContent>
<p className="text-3xl font-bold text-foreground">
{stats.total_corrections}
</p>
</CardContent>
</Card>
</motion.div>
<motion.div
variants={{
initial: { opacity: 0, y: 16 },
animate: { opacity: 1, y: 0, transition: { duration: 0.4 } },
}}
>
<Card className="rounded-xl">
<CardHeader className="pb-2">
<CardTitle className="text-sm font-medium text-muted-foreground">
Last 7 Days
</CardTitle>
</CardHeader>
<CardContent>
<p className="text-3xl font-bold text-foreground">
{stats.recent_count_7d}
</p>
</CardContent>
</Card>
</motion.div>
</div>
{/* Flags bar chart */}
{stats.by_flag.length > 0 && (
<Card className="rounded-xl">
<CardHeader>
<CardTitle className="text-sm font-medium text-muted-foreground">
Most Corrected Flags
</CardTitle>
</CardHeader>
<CardContent className="space-y-3">
{stats.by_flag.map((item) => (
<FlagsBar
key={item.flag}
flag={item.flag}
count={item.count}
max={stats.by_flag[0].count}
/>
))}
</CardContent>
</Card>
)}
</motion.div>
);
}
@@ -1,229 +0,0 @@
import { useState } from "react";
import { motion } from "framer-motion";
import { AlertCircle, CheckCircle, Send, X } from "lucide-react";
import { useSubmitCorrection } from "../hooks/useCorrections";
import {
Badge,
Button,
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
Input,
} from "../../../shared/ui";
import { useToast } from "../../../shared/ui";
export function SubmitCorrectionContent() {
const { submit, submitting, error, success, reset } = useSubmitCorrection();
const { addToast } = useToast();
const [messageId, setMessageId] = useState("");
const [contentSnippet, setContentSnippet] = useState("");
const [correctionNotes, setCorrectionNotes] = useState("");
// Pre-selected flags that were wrong
const [originalFlags, setOriginalFlags] = useState<string[]>([]);
const [flagInput, setFlagInput] = useState("");
const [formError, setFormError] = useState<string | null>(null);
const addFlag = () => {
const trimmed = flagInput.trim().toLowerCase();
if (!trimmed) return;
if (originalFlags.includes(trimmed)) return;
setOriginalFlags((prev) => [...prev, trimmed]);
setFlagInput("");
};
const removeFlag = (flag: string) => {
setOriginalFlags((prev) => prev.filter((f) => f !== flag));
};
const handleSubmit = async () => {
setFormError(null);
reset();
// Client-side validation
if (!messageId.trim()) {
setFormError("Message ID is required");
return;
}
if (originalFlags.length === 0) {
setFormError("Add at least one original flag that was incorrect");
return;
}
if (!contentSnippet.trim()) {
setFormError("Content snippet is required");
return;
}
try {
await submit({
message_id: messageId.trim(),
original_flags: originalFlags,
corrected_flags: [], // Always clearing the false positive flags
correction_notes: correctionNotes.trim() || undefined,
content_snippet: contentSnippet.trim(),
});
addToast(
"Correction submitted — the AI prompt will learn from this.",
"success",
);
// Reset form
setMessageId("");
setContentSnippet("");
setCorrectionNotes("");
setOriginalFlags([]);
} catch {
addToast(error || "Failed to submit correction", "error");
}
};
return (
<motion.div
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4 }}
className="max-w-2xl"
>
<Card className="rounded-xl">
<CardHeader>
<CardTitle className="text-sm font-medium text-muted-foreground">
Submit Correction
</CardTitle>
<CardDescription className="text-xs">
Record a false positive a message that was incorrectly flagged by
AI moderation. This helps the system learn and improve accuracy.
</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
{/* Message ID */}
<div className="space-y-1.5">
<label className="text-xs font-medium text-muted-foreground">
Message ID
</label>
<Input
placeholder="Paste the message ID here..."
value={messageId}
onChange={(e) => setMessageId(e.target.value)}
/>
</div>
{/* Content Snippet */}
<div className="space-y-1.5">
<label className="text-xs font-medium text-muted-foreground">
Content Snippet
</label>
<Input
placeholder="The message content (for pattern matching)..."
value={contentSnippet}
onChange={(e) => setContentSnippet(e.target.value)}
/>
</div>
{/* Original Flags (the incorrect ones) */}
<div className="space-y-1.5">
<label className="text-xs font-medium text-muted-foreground">
Incorrect Flags
</label>
<p className="text-[10px] text-muted-foreground/70">
Add the AI flags that were wrong for this message.
</p>
<div className="flex gap-2">
<Input
placeholder="e.g. sexual_deviation"
value={flagInput}
onChange={(e) => setFlagInput(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter") {
e.preventDefault();
addFlag();
}
}}
className="flex-1"
/>
<Button
variant="outline"
size="sm"
onClick={addFlag}
type="button"
>
Add
</Button>
</div>
{originalFlags.length > 0 && (
<div className="flex flex-wrap gap-1.5 pt-2">
{originalFlags.map((f) => (
<Badge
key={f}
variant="destructive"
className="flex items-center gap-1 px-2 py-1 text-xs capitalize"
>
{f.replace(/_/g, " ")}
<button
type="button"
onClick={() => removeFlag(f)}
className="ml-0.5 rounded-full p-0.5 hover:bg-red-200 transition-colors"
>
<X className="h-3 w-3" />
</button>
</Badge>
))}
</div>
)}
</div>
{/* Correction Notes */}
<div className="space-y-1.5">
<label className="text-xs font-medium text-muted-foreground">
Notes (optional)
</label>
<Input
placeholder="Why was this a false positive?"
value={correctionNotes}
onChange={(e) => setCorrectionNotes(e.target.value)}
/>
</div>
{/* Error message */}
{(formError || error) && (
<div className="flex items-center gap-2 rounded-lg bg-red-50 px-3 py-2 text-sm text-red-700">
<AlertCircle className="h-4 w-4 shrink-0" />
{formError || error}
</div>
)}
{/* Success message */}
{success && (
<div className="flex items-center gap-2 rounded-lg bg-emerald-50 px-3 py-2 text-sm text-emerald-700">
<CheckCircle className="h-4 w-4 shrink-0" />
Correction recorded successfully.
</div>
)}
{/* Submit button */}
<Button
onClick={handleSubmit}
disabled={submitting}
className="w-full gap-2"
>
{submitting ? (
<>
<div className="h-4 w-4 animate-spin rounded-full border-2 border-white/30 border-t-white" />
Submitting...
</>
) : (
<>
<Send className="h-4 w-4" />
Submit Correction
</>
)}
</Button>
</CardContent>
</Card>
</motion.div>
);
}
@@ -1,137 +0,0 @@
import { useCallback, useEffect, useRef, useState } from "react";
import {
type CorrectionEntry,
type CorrectionStats,
getCorrectionStats,
listCorrections,
submitCorrection,
} from "../../../shared/api/client";
// ─── Stats ──────────────────────────────────────────────────────────────────
export function useCorrectionStats() {
const [stats, setStats] = useState<CorrectionStats | null>(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const fetch = useCallback(async () => {
setLoading(true);
setError(null);
try {
const result = await getCorrectionStats();
setStats(result);
} catch (err) {
setError(err instanceof Error ? err.message : "Failed to load stats");
} finally {
setLoading(false);
}
}, []);
useEffect(() => {
fetch().catch(() => undefined);
}, [fetch]);
return { stats, loading, error, refetch: fetch };
}
// ─── History ────────────────────────────────────────────────────────────────
export function useCorrectionHistory() {
const [entries, setEntries] = useState<CorrectionEntry[]>([]);
const [loading, setLoading] = useState(true);
const [loadingMore, setLoadingMore] = useState(false);
const [error, setError] = useState<string | null>(null);
const cursorRef = useRef<string | null>(null);
const hasMoreRef = useRef(true);
const fetchInitial = useCallback(async () => {
setLoading(true);
setError(null);
try {
const result = await listCorrections({ limit: 20 });
setEntries(result.data);
cursorRef.current = result.nextCursor;
hasMoreRef.current = result.nextCursor !== null;
} catch (err) {
setError(
err instanceof Error ? err.message : "Failed to load corrections",
);
} finally {
setLoading(false);
}
}, []);
const loadMore = useCallback(async () => {
if (!cursorRef.current || loadingMore) return;
setLoadingMore(true);
try {
const result = await listCorrections({
limit: 20,
cursor: cursorRef.current,
});
setEntries((prev) => [...prev, ...result.data]);
cursorRef.current = result.nextCursor;
hasMoreRef.current = result.nextCursor !== null;
} catch (err) {
setError(err instanceof Error ? err.message : "Failed to load more");
} finally {
setLoadingMore(false);
}
}, [loadingMore]);
useEffect(() => {
fetchInitial().catch(() => undefined);
}, [fetchInitial]);
return {
entries,
loading,
loadingMore,
error,
hasMore: hasMoreRef.current,
loadMore,
refetch: fetchInitial,
};
}
// ─── Submit ─────────────────────────────────────────────────────────────────
export function useSubmitCorrection() {
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState<string | null>(null);
const [success, setSuccess] = useState<CorrectionEntry | null>(null);
const submit = useCallback(
async (data: {
message_id: string;
original_flags: string[];
corrected_flags: string[];
correction_notes?: string;
content_snippet: string;
}) => {
setSubmitting(true);
setError(null);
setSuccess(null);
try {
const result = await submitCorrection(data);
setSuccess(result);
return result;
} catch (err) {
const msg =
err instanceof Error ? err.message : "Failed to submit correction";
setError(msg);
throw err;
} finally {
setSubmitting(false);
}
},
[],
);
const reset = useCallback(() => {
setError(null);
setSuccess(null);
}, []);
return { submit, submitting, error, success, reset };
}
@@ -1,28 +0,0 @@
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../shared/ui";
import { CorrectionStatsContent } from "./components/CorrectionStats";
import { CorrectionHistoryContent } from "./components/CorrectionHistory";
import { SubmitCorrectionContent } from "./components/SubmitCorrection";
export function TunerPanel() {
return (
<Tabs defaultValue="stats" className="w-full">
<TabsList className="mb-6">
<TabsTrigger value="stats">Stats</TabsTrigger>
<TabsTrigger value="history">History</TabsTrigger>
<TabsTrigger value="submit">Submit</TabsTrigger>
</TabsList>
<TabsContent value="stats">
<CorrectionStatsContent />
</TabsContent>
<TabsContent value="history">
<CorrectionHistoryContent />
</TabsContent>
<TabsContent value="submit">
<SubmitCorrectionContent />
</TabsContent>
</Tabs>
);
}
+56 -33
View File
@@ -118,7 +118,7 @@ export interface UIState {
selectedTextChannel?: string;
selectedAnalyticsGuild?: string;
selectedAnalyticsChannel?: string;
activeTab?: "live" | "messages" | "tuner";
activeTab?: "live" | "messages" | "dashboard";
isListening?: boolean;
isStreaming?: boolean;
}
@@ -131,7 +131,7 @@ export interface ChatResponse {
response?: string;
}
export type DashboardTab = "live" | "messages" | "tuner";
export type DashboardTab = "live" | "messages" | "dashboard";
// ─── Messages ────────────────────────────────────────────────────────────────
@@ -272,50 +272,73 @@ export function login(password: string): Promise<{ ok: boolean }> {
});
}
// ─── Corrections (Adaptive Prompt Tuner) ──────────────────────────────────────
// ─── Dashboard ─────────────────────────────────────────────────────────────────
export interface CorrectionStats {
total_corrections: number;
recent_count_7d: number;
by_flag: Array<{ flag: string; count: number }>;
export interface DashboardStats {
total_messages: number;
total_users: number;
total_flagged: number;
total_clean: number;
total_warned: number;
total_error: number;
total_voice_recordings: number;
total_profiles: number;
today_messages: number;
today_flagged: number;
active_users_24h: number;
top_channels: Array<{ channel_id: string; message_count: number }>;
moderation_overview: {
pending: number;
processing: number;
error: number;
};
}
export interface CorrectionEntry {
id: string;
message_id: string;
original_flags: string;
corrected_flags: string;
correction_notes: string | null;
content_snippet: string;
created_at: number;
export interface DashboardUser {
user_id: string;
username: string | null;
avatar_url: string | null;
profile_summary: string | null;
total_messages: number;
flagged_count: number;
last_message_at: number | null;
trust_score: number | null;
}
export function getCorrectionStats(): Promise<CorrectionStats> {
return request<CorrectionStats>("/api/corrections/stats");
export interface DashboardUserDetail extends DashboardUser {
last_analyzed_at: number | null;
clean_message_streak: number | null;
total_infractions: number | null;
clean_count: number;
recent_messages: Array<{
id: string;
content: string;
channel_id: string;
created_at: number;
ai_status: string | null;
}>;
}
export function listCorrections(
params: { limit?: number; cursor?: string } = {},
): Promise<{ data: CorrectionEntry[]; nextCursor: string | null }> {
export function getDashboardStats(): Promise<DashboardStats> {
return request<DashboardStats>("/api/dashboard/stats");
}
export function listDashboardUsers(
params: { limit?: number; cursor?: string; search?: string } = {},
): Promise<{ data: DashboardUser[]; nextCursor: string | null }> {
const sp = new URLSearchParams();
if (params.limit) sp.set("limit", String(params.limit));
if (params.cursor) sp.set("cursor", params.cursor);
return request<{ data: CorrectionEntry[]; nextCursor: string | null }>(
`/api/corrections?${sp}`,
if (params.search) sp.set("search", params.search);
return request<{ data: DashboardUser[]; nextCursor: string | null }>(
`/api/dashboard/users?${sp}`,
);
}
export function submitCorrection(data: {
message_id: string;
original_flags: string[];
corrected_flags: string[];
correction_notes?: string;
content_snippet: string;
}): Promise<CorrectionEntry> {
return request<CorrectionEntry>("/api/corrections", {
method: "POST",
body: JSON.stringify(data),
});
export function getDashboardUserDetail(
userId: string,
): Promise<DashboardUserDetail> {
return request<DashboardUserDetail>(`/api/dashboard/users/${userId}`);
}
// ─── UI State ────────────────────────────────────────────────────────────────
@@ -1,11 +1,11 @@
import { MessageSquare, Radio, SlidersHorizontal } from "lucide-react";
import { LayoutDashboard, MessageSquare, Radio } from "lucide-react";
import type { DashboardTab } from "../../entities/ui/types";
import { cn } from "../lib/utils";
const tabs: Array<{ id: DashboardTab; label: string; Icon: typeof Radio }> = [
{ id: "live", label: "Live", Icon: Radio },
{ id: "messages", label: "Messages", Icon: MessageSquare },
{ id: "tuner", label: "Tuner", Icon: SlidersHorizontal },
{ id: "dashboard", label: "Dashboard", Icon: LayoutDashboard },
];
interface MobileTabBarProps {
+2 -2
View File
@@ -10,13 +10,13 @@ import type { WsStatus } from "../shared/ws/socket";
const titles: Record<DashboardTab, string> = {
live: "Voice & Media",
messages: "Messages & Moderation",
tuner: "Prompt Tuner",
dashboard: "Dashboard",
};
const subtitles: Record<DashboardTab, string> = {
live: "Join voice channels, play media, stream audio, and browse recordings.",
messages: "Capture, analyse, and moderate Discord messages.",
tuner: "Monitor correction patterns and improve AI moderation accuracy.",
dashboard: "Server statistics, user profiles, and AI moderation overview.",
};
interface HeaderProps {
+2 -2
View File
@@ -1,5 +1,5 @@
import { motion } from "framer-motion";
import { MessageSquare, Radio, SlidersHorizontal } from "lucide-react";
import { LayoutDashboard, MessageSquare, Radio } from "lucide-react";
import type { DashboardTab } from "../entities/ui/types";
import type { MessageRecord } from "../shared/api/client";
import { useMascotChat } from "../shared/hooks/useMascotChat";
@@ -11,7 +11,7 @@ const navItems: Array<{ id: DashboardTab; label: string; icon: typeof Radio }> =
[
{ id: "live", label: "Live", icon: Radio },
{ id: "messages", label: "Messages", icon: MessageSquare },
{ id: "tuner", label: "Tuner", icon: SlidersHorizontal },
{ id: "dashboard", label: "Dashboard", icon: LayoutDashboard },
];
interface SidebarProps {