feat: add analytics hooks and routes for moderation statistics

- Implemented `useAnalytics` hook for fetching and managing analytics data.
- Created `analyticsStore.ts` to handle database queries for hourly stats, topic trends, user leaderboard, and moderation stats.
- Added Express routes for analytics endpoints including overview, hourly stats, topic trends, user leaderboard, moderation stats, and top violators.
- Introduced a utility function `filterHits` for filtering specific terms in text.
This commit is contained in:
MythEclipse
2026-05-29 19:37:08 +07:00
parent fb09ac81c5
commit 8c3bb77984
15 changed files with 2157 additions and 17 deletions
@@ -9,6 +9,7 @@ const titles: Record<DashboardTab, string> = {
media: "Media Player",
messages: "Messages",
recordings: "Voice Recordings",
analytics: "Analytics & Insights",
review: "Moderation Review",
};
+2 -1
View File
@@ -1,4 +1,4 @@
import { Bot, MessageSquare, Music2, ShieldAlert, Volume2, Mic } from "lucide-react";
import { Bot, BarChart3, MessageSquare, Music2, ShieldAlert, Volume2, Mic } from "lucide-react";
import type { DashboardTab } from "../../types/ui";
import { cn } from "../../lib/utils";
import { Button } from "../ui/button";
@@ -8,6 +8,7 @@ const navItems: Array<{ id: DashboardTab; label: string; icon: typeof Volume2 }>
{ id: "media", label: "Media", icon: Music2 },
{ id: "messages", label: "Messages", icon: MessageSquare },
{ id: "recordings", label: "Recordings", icon: Mic },
{ id: "analytics", label: "Analytics", icon: BarChart3 },
{ id: "review", label: "Review", icon: ShieldAlert },
];