feat(dash): Revamp dashboard UI with glassmorphism and real bot data
This commit is contained in:
@@ -20,6 +20,10 @@ export function getClientStats(): ClientStats {
|
||||
|
||||
// Fetch fresh stats
|
||||
const stats: ClientStats = {
|
||||
bot: {
|
||||
name: AuroraClient.user?.username || "Aurora",
|
||||
avatarUrl: AuroraClient.user?.displayAvatarURL() || null,
|
||||
},
|
||||
guilds: AuroraClient.guilds.cache.size,
|
||||
ping: AuroraClient.ws.ping,
|
||||
cachedUsers: AuroraClient.users.cache.size,
|
||||
|
||||
@@ -37,6 +37,7 @@ describe("dashboardService", () => {
|
||||
describe("getActiveUserCount", () => {
|
||||
test("should return active user count from database", async () => {
|
||||
mockSelect.mockImplementationOnce(() => ({
|
||||
// @ts-ignore ts(2322)
|
||||
from: mock(() => ({
|
||||
where: mock(() => Promise.resolve([{ count: "5" }])),
|
||||
})),
|
||||
@@ -48,7 +49,9 @@ describe("dashboardService", () => {
|
||||
});
|
||||
|
||||
test("should return 0 when no users found", async () => {
|
||||
|
||||
mockSelect.mockImplementationOnce(() => ({
|
||||
// @ts-ignore ts(2322)
|
||||
from: mock(() => ({
|
||||
where: mock(() => Promise.resolve([{ count: "0" }])),
|
||||
})),
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
export interface DashboardStats {
|
||||
bot: {
|
||||
name: string;
|
||||
avatarUrl: string | null;
|
||||
};
|
||||
guilds: {
|
||||
count: number;
|
||||
changeFromLastMonth?: number;
|
||||
@@ -32,6 +36,10 @@ export interface RecentEvent {
|
||||
}
|
||||
|
||||
export interface ClientStats {
|
||||
bot: {
|
||||
name: string;
|
||||
avatarUrl: string | null;
|
||||
};
|
||||
guilds: number;
|
||||
ping: number;
|
||||
cachedUsers: number;
|
||||
|
||||
38
tickets/2026-01-08-dashboard-activity-charts.md
Normal file
38
tickets/2026-01-08-dashboard-activity-charts.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# DASH-003: Visual Analytics & Activity Charts
|
||||
|
||||
**Status:** Draft
|
||||
**Created:** 2026-01-08
|
||||
**Tags:** dashboard, analytics, charts, frontend
|
||||
|
||||
## 1. Context & User Story
|
||||
* **As a:** Bot Administrator
|
||||
* **I want to:** View a graphical representation of bot usage over the last 24 hours.
|
||||
* **So that:** I can identify peak usage times and trends in command execution.
|
||||
|
||||
## 2. Technical Requirements
|
||||
### Data Model Changes
|
||||
- [ ] No new tables.
|
||||
- [ ] Requires complex aggregation queries on the `transactions` table.
|
||||
|
||||
### API / Interface
|
||||
- [ ] `GET /api/stats/activity`: Returns an array of data points for the last 24 hours (hourly granularity).
|
||||
- [ ] Response Structure: `Array<{ hour: string, commands: number, transactions: number }>`.
|
||||
|
||||
## 3. Constraints & Validations (CRITICAL)
|
||||
- **Input Validation:** Hourly buckets must be strictly validated for the 24h window.
|
||||
- **System Constraints:**
|
||||
- Database query must be cached for at least 5 minutes as it involves heavy aggregation.
|
||||
- Chart must be responsive and handle mobile viewports.
|
||||
- **Business Logic Guardrails:**
|
||||
- If no data exists for an hour, it must return 0 rather than skipping the point.
|
||||
|
||||
## 4. Acceptance Criteria
|
||||
1. [ ] **Given** a 24-hour history of transactions, **When** the dashboard loads, **Then** a line or area chart displays the command volume over time.
|
||||
2. [ ] **Given** the premium glassmorphic theme, **When** the chart is rendered, **Then** it must use the primary brand colors and gradients to match the UI.
|
||||
3. [ ] **Given** a mouse hover on the chart, **When** hovering over a point, **Then** a glassmorphic tooltip shows exact counts for that hour.
|
||||
|
||||
## 5. Implementation Plan
|
||||
- [ ] Step 1: Add an aggregation method to `dashboard.service.ts` to fetch hourly counts from the `transactions` table.
|
||||
- [ ] Step 2: Create the `/api/stats/activity` endpoint.
|
||||
- [ ] Step 3: Install a charting library (e.g., `recharts` or `lucide-react` compatible library).
|
||||
- [ ] Step 4: Implement the `ActivityChart` component into the middle column of the dashboard.
|
||||
38
tickets/2026-01-08-dashboard-control-panel.md
Normal file
38
tickets/2026-01-08-dashboard-control-panel.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# DASH-004: Administrative Control Panel
|
||||
|
||||
**Status:** Draft
|
||||
**Created:** 2026-01-08
|
||||
**Tags:** dashboard, control-panel, bot-actions, operations
|
||||
|
||||
## 1. Context & User Story
|
||||
* **As a:** Bot Administrator
|
||||
* **I want to:** Execute common maintenance tasks directly from the dashboard buttons.
|
||||
* **So that:** I don't have to use terminal commands or Discord slash commands for system-level operations.
|
||||
|
||||
## 2. Technical Requirements
|
||||
### Data Model Changes
|
||||
- [ ] N/A.
|
||||
|
||||
### API / Interface
|
||||
- [ ] `POST /api/actions/reload-commands`: Triggers the bot's command loader.
|
||||
- [ ] `POST /api/actions/clear-cache`: Clears internal bot caches.
|
||||
- [ ] `POST /api/actions/maintenance-mode`: Toggles a maintenance flag for the bot.
|
||||
|
||||
## 3. Constraints & Validations (CRITICAL)
|
||||
- **Input Validation:** Standard JSON body with optional `reason` field.
|
||||
- **System Constraints:**
|
||||
- Actions must be idempotent where possible.
|
||||
- Actions must provide a response within 10 seconds.
|
||||
- **Business Logic Guardrails:**
|
||||
- **SECURITY**: This endpoint MUST require high-privilege authentication (currently we have single admin assumption, but token-based check should be planned).
|
||||
- Maintenance mode toggle must be logged to the event feed.
|
||||
|
||||
## 4. Acceptance Criteria
|
||||
1. [ ] **Given** a "Quick Actions" card, **When** the "Reload Commands" button is clicked, **Then** the bot reloads its local command files and posts a "Success" event to the feed.
|
||||
2. [ ] **Given** a running bot, **When** the "Clear Cache" button is pushed, **Then** the bot flushes its internal memory maps and the memory usage metric reflects the drop.
|
||||
|
||||
## 5. Implementation Plan
|
||||
- [ ] Step 1: Create an `action.service.ts` to handle the logic of triggering bot-specific functions.
|
||||
- [ ] Step 2: Implement the `/api/actions` route group.
|
||||
- [ ] Step 3: Design a "Quick Actions" card with premium styled buttons in `Dashboard.tsx`.
|
||||
- [ ] Step 4: Add loading states to buttons to show when an operation is "In Progress."
|
||||
43
tickets/2026-01-08-real-time-dashboard-updates.md
Normal file
43
tickets/2026-01-08-real-time-dashboard-updates.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# DASH-002: Real-time Live Updates via WebSockets
|
||||
|
||||
**Status:** Draft
|
||||
**Created:** 2026-01-08
|
||||
**Tags:** dashboard, websocket, real-time, performance
|
||||
|
||||
## 1. Context & User Story
|
||||
* **As a:** Bot Administrator
|
||||
* **I want to:** See metrics and events update instantly on my screen without refreshing or waiting for polling intervals.
|
||||
* **So that:** I can react immediately to errors or spikes in latency and have a dashboard that feels "alive."
|
||||
|
||||
## 2. Technical Requirements
|
||||
### Data Model Changes
|
||||
- [ ] No database schema changes required.
|
||||
- [ ] Redis or an in-memory event emitter might be useful for broadcasting events.
|
||||
|
||||
### API / Interface
|
||||
- [ ] Establish a WebSocket endpoint at `/ws/stats`.
|
||||
- [ ] Define the message protocol:
|
||||
- `HEARTBEAT`: Client to server to keep connection alive.
|
||||
- `STATS_UPDATE`: Server to client containing partial or full `DashboardStats`.
|
||||
- `NEW_EVENT`: Server to client when a transaction or moderation case occurs.
|
||||
|
||||
## 3. Constraints & Validations (CRITICAL)
|
||||
- **Input Validation:** WS messages must be validated using Zod.
|
||||
- **System Constraints:**
|
||||
- Limit to 10 concurrent WS connections to prevent server strain.
|
||||
- Maximum message size: 16KB.
|
||||
- Connection timeout: 60s of inactivity triggers a disconnect.
|
||||
- **Business Logic Guardrails:**
|
||||
- Websocket updates should not exceed 1 update per second for metrics.
|
||||
- Events are pushed immediately as they occur.
|
||||
|
||||
## 4. Acceptance Criteria
|
||||
1. [ ] **Given** the dashboard is open, **When** a command is run in Discord, **Then** the "Recent Events" list updates instantly on the web UI.
|
||||
2. [ ] **Given** a changing network environment, **When** the bot's ping fluctuates, **Then** the "Avg Latency" card updates in real-time.
|
||||
3. [ ] **Given** a connection loss, **When** the network returns, **Then** the client automatically reconnects to the WS room.
|
||||
|
||||
## 5. Implementation Plan
|
||||
- [ ] Step 1: Integrate a WebSocket library (e.g., `bun`'s native `ws` or `socket.io`) into `web/src/server.ts`.
|
||||
- [ ] Step 2: Implement a broadcast system in `dashboard.service.ts` to push events to the WS handler.
|
||||
- [ ] Step 3: Create a `useDashboardSocket` hook in the frontend to handle connection lifecycle.
|
||||
- [ ] Step 4: Refactor `Dashboard.tsx` to prefer WebSocket data over periodic polling.
|
||||
60
web/build.ts
60
web/build.ts
@@ -127,28 +127,46 @@ const entrypoints = [...new Bun.Glob("**.html").scanSync("src")]
|
||||
.filter(dir => !dir.includes("node_modules"));
|
||||
console.log(`📄 Found ${entrypoints.length} HTML ${entrypoints.length === 1 ? "file" : "files"} to process\n`);
|
||||
|
||||
const result = await Bun.build({
|
||||
entrypoints,
|
||||
outdir,
|
||||
plugins: [plugin],
|
||||
minify: true,
|
||||
target: "browser",
|
||||
sourcemap: "linked",
|
||||
define: {
|
||||
"process.env.NODE_ENV": JSON.stringify("production"),
|
||||
},
|
||||
...cliConfig,
|
||||
});
|
||||
const build = async () => {
|
||||
const result = await Bun.build({
|
||||
entrypoints,
|
||||
outdir,
|
||||
plugins: [plugin],
|
||||
minify: true,
|
||||
target: "browser",
|
||||
sourcemap: "linked",
|
||||
define: {
|
||||
"process.env.NODE_ENV": JSON.stringify("production"),
|
||||
},
|
||||
...cliConfig,
|
||||
});
|
||||
|
||||
const outputTable = result.outputs.map(output => ({
|
||||
File: path.relative(process.cwd(), output.path),
|
||||
Type: output.kind,
|
||||
Size: formatFileSize(output.size),
|
||||
}));
|
||||
|
||||
console.table(outputTable);
|
||||
return result;
|
||||
};
|
||||
|
||||
const result = await build();
|
||||
|
||||
const end = performance.now();
|
||||
|
||||
const outputTable = result.outputs.map(output => ({
|
||||
File: path.relative(process.cwd(), output.path),
|
||||
Type: output.kind,
|
||||
Size: formatFileSize(output.size),
|
||||
}));
|
||||
|
||||
console.table(outputTable);
|
||||
const buildTime = (end - start).toFixed(2);
|
||||
|
||||
console.log(`\n✅ Build completed in ${buildTime}ms\n`);
|
||||
|
||||
if ((cliConfig as any).watch) {
|
||||
console.log("👀 Watching for changes...\n");
|
||||
// Keep the process alive for watch mode
|
||||
// Bun.build with watch:true handles the watching,
|
||||
// we just need to make sure the script doesn't exit.
|
||||
process.stdin.resume();
|
||||
|
||||
// Also, handle manual exit
|
||||
process.on("SIGINT", () => {
|
||||
console.log("\n👋 Stopping build watcher...");
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
import { LayoutDashboard, Settings, Activity, Server, Zap } from "lucide-react";
|
||||
import { LayoutDashboard, Settings, Activity } from "lucide-react";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import {
|
||||
Sidebar,
|
||||
@@ -14,6 +13,7 @@ import {
|
||||
SidebarFooter,
|
||||
SidebarRail,
|
||||
} from "@/components/ui/sidebar";
|
||||
import { useDashboardStats } from "@/hooks/use-dashboard-stats";
|
||||
|
||||
// Menu items.
|
||||
const items = [
|
||||
@@ -36,37 +36,52 @@ const items = [
|
||||
|
||||
export function AppSidebar() {
|
||||
const location = useLocation();
|
||||
const { stats } = useDashboardStats();
|
||||
|
||||
const botName = stats?.bot?.name || "Aurora";
|
||||
const botAvatar = stats?.bot?.avatarUrl;
|
||||
|
||||
return (
|
||||
<Sidebar>
|
||||
<SidebarHeader>
|
||||
<Sidebar className="glass-sidebar border-r border-white/5">
|
||||
<SidebarHeader className="p-4">
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton size="lg" asChild>
|
||||
<Link to="/">
|
||||
<div className="flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground">
|
||||
<Zap className="size-4" />
|
||||
<SidebarMenuButton size="lg" asChild className="hover:bg-white/5 transition-all duration-300 rounded-xl">
|
||||
<Link to="/" className="flex items-center gap-3">
|
||||
<div className="flex aspect-square size-10 items-center justify-center rounded-xl bg-gradient-to-br from-primary to-purple-600 text-primary-foreground shadow-lg shadow-primary/20 overflow-hidden border border-white/10">
|
||||
{botAvatar ? (
|
||||
<img src={botAvatar} alt={botName} className="size-full object-cover" />
|
||||
) : (
|
||||
<div className="size-full flex items-center justify-center font-bold text-lg italic">A</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-col gap-0.5 leading-none">
|
||||
<span className="font-semibold">Aurora</span>
|
||||
<span className="">v1.0.0</span>
|
||||
<div className="flex flex-col gap-0 leading-none">
|
||||
<span className="text-lg font-bold tracking-tight bg-clip-text text-transparent bg-gradient-to-r from-white to-white/70">{botName}</span>
|
||||
<span className="text-[10px] uppercase tracking-widest text-primary font-bold">Admin Portal</span>
|
||||
</div>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
</SidebarMenu>
|
||||
</SidebarHeader>
|
||||
<SidebarContent>
|
||||
<SidebarContent className="px-2">
|
||||
<SidebarGroup>
|
||||
<SidebarGroupLabel>Application</SidebarGroupLabel>
|
||||
<SidebarGroupLabel className="px-4 text-[10px] font-bold uppercase tracking-[0.2em] text-white/30 mb-2">Main Navigation</SidebarGroupLabel>
|
||||
<SidebarGroupContent>
|
||||
<SidebarMenu>
|
||||
<SidebarMenu className="gap-1">
|
||||
{items.map((item) => (
|
||||
<SidebarMenuItem key={item.title}>
|
||||
<SidebarMenuButton asChild isActive={location.pathname === item.url}>
|
||||
<Link to={item.url}>
|
||||
<item.icon />
|
||||
<span>{item.title}</span>
|
||||
<SidebarMenuButton
|
||||
asChild
|
||||
isActive={location.pathname === item.url}
|
||||
className={`transition-all duration-200 rounded-lg px-4 py-6 ${location.pathname === item.url
|
||||
? "bg-primary/10 text-primary border border-primary/20 shadow-lg shadow-primary/5"
|
||||
: "hover:bg-white/5 text-white/60 hover:text-white"
|
||||
}`}
|
||||
>
|
||||
<Link to={item.url} className="flex items-center gap-3">
|
||||
<item.icon className={`size-5 ${location.pathname === item.url ? "text-primary" : ""}`} />
|
||||
<span className="font-medium">{item.title}</span>
|
||||
</Link>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
@@ -75,16 +90,16 @@ export function AppSidebar() {
|
||||
</SidebarGroupContent>
|
||||
</SidebarGroup>
|
||||
</SidebarContent>
|
||||
<SidebarFooter>
|
||||
<SidebarFooter className="p-4 border-t border-white/5">
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
<SidebarMenuButton size="lg">
|
||||
<div className="bg-muted flex aspect-square size-8 items-center justify-center rounded-lg">
|
||||
<span className="text-xs font-bold">U</span>
|
||||
<SidebarMenuButton size="lg" className="hover:bg-white/5 rounded-xl transition-colors">
|
||||
<div className="bg-primary/20 border border-primary/20 flex aspect-square size-10 items-center justify-center rounded-full overflow-hidden">
|
||||
<span className="text-sm font-bold text-primary italic">A</span>
|
||||
</div>
|
||||
<div className="flex flex-col gap-0.5 leading-none">
|
||||
<span className="font-semibold">User</span>
|
||||
<span className="text-xs text-muted-foreground">Admin</span>
|
||||
<div className="flex flex-col gap-0.5 leading-none ml-2">
|
||||
<span className="font-bold text-sm text-white/90">Administrator</span>
|
||||
<span className="text-[10px] text-white/40 font-medium">Session Active</span>
|
||||
</div>
|
||||
</SidebarMenuButton>
|
||||
</SidebarMenuItem>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
interface DashboardStats {
|
||||
bot: {
|
||||
name: string;
|
||||
avatarUrl: string | null;
|
||||
};
|
||||
guilds: {
|
||||
count: number;
|
||||
};
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Aurora</title>
|
||||
|
||||
|
||||
<title>Aurora Dashboard</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -7,21 +7,28 @@ import { Separator } from "../components/ui/separator";
|
||||
export function DashboardLayout() {
|
||||
return (
|
||||
<SidebarProvider>
|
||||
<div className="fixed inset-0 -z-10 overflow-hidden pointer-events-none">
|
||||
<div className="absolute top-[-10%] left-[-10%] w-[40%] h-[40%] bg-primary/20 blur-[120px] rounded-full animate-pulse" />
|
||||
<div className="absolute bottom-[-10%] right-[-10%] w-[30%] h-[30%] bg-purple-500/10 blur-[100px] rounded-full" />
|
||||
</div>
|
||||
|
||||
<AppSidebar />
|
||||
<SidebarInset>
|
||||
<header className="flex h-16 shrink-0 items-center gap-2 border-b px-4">
|
||||
<SidebarTrigger className="-ml-1" />
|
||||
<Separator orientation="vertical" className="mr-2 h-4" />
|
||||
<div className="flex items-center gap-2 px-4">
|
||||
{/* Breadcrumbs could go here */}
|
||||
<h1 className="text-lg font-semibold">Dashboard</h1>
|
||||
<SidebarInset className="bg-transparent">
|
||||
<header className="flex h-16 shrink-0 items-center gap-2 px-6 backdrop-blur-md bg-background/30 border-b border-white/5 sticky top-0 z-10">
|
||||
<SidebarTrigger className="-ml-1 hover:bg-white/5 transition-colors" />
|
||||
<Separator orientation="vertical" className="mx-4 h-4 bg-white/10" />
|
||||
<div className="flex items-center gap-2">
|
||||
<h1 className="text-lg font-semibold tracking-tight text-glow">Dashboard</h1>
|
||||
</div>
|
||||
<div className="ml-auto flex items-center gap-4">
|
||||
<div className="h-2 w-2 rounded-full bg-emerald-500 shadow-[0_0_10px_rgba(16,185,129,0.5)]" />
|
||||
</div>
|
||||
</header>
|
||||
<div className="flex flex-1 flex-col gap-4 p-4 pt-0">
|
||||
<div className="min-h-[100vh] flex-1 rounded-xl bg-muted/50 md:min-h-min p-4">
|
||||
<main className="flex flex-1 flex-col gap-6 p-6">
|
||||
<div className="flex-1 rounded-2xl md:min-h-min">
|
||||
<Outlet />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</SidebarInset>
|
||||
</SidebarProvider>
|
||||
);
|
||||
|
||||
@@ -50,119 +50,115 @@ export function Dashboard() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div>
|
||||
<h2 className="text-3xl font-bold tracking-tight">Dashboard</h2>
|
||||
<p className="text-muted-foreground">Overview of your bot's activity and performance.</p>
|
||||
<div className="space-y-8 animate-in fade-in duration-700">
|
||||
<div className="flex flex-col gap-2">
|
||||
<h2 className="text-4xl font-extrabold tracking-tight bg-clip-text text-transparent bg-gradient-to-r from-white via-white to-white/40">
|
||||
{stats.bot.name} Overview
|
||||
</h2>
|
||||
<p className="text-white/40 font-medium">Monitoring real-time activity and core bot metrics.</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
|
||||
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
{/* Metric Cards */}
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">Total Servers</CardTitle>
|
||||
<Server className="h-4 w-4 text-muted-foreground" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">{stats.guilds.count}</div>
|
||||
<p className="text-xs text-muted-foreground">Active guilds</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">Active Users</CardTitle>
|
||||
<Users className="h-4 w-4 text-muted-foreground" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">{stats.users.active.toLocaleString()}</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{stats.users.total.toLocaleString()} total registered
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">Commands</CardTitle>
|
||||
<Zap className="h-4 w-4 text-muted-foreground" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">{stats.commands.total}</div>
|
||||
<p className="text-xs text-muted-foreground">Registered commands</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">Avg Ping</CardTitle>
|
||||
<Activity className="h-4 w-4 text-muted-foreground" />
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-2xl font-bold">{stats.ping.avg}ms</div>
|
||||
<p className="text-xs text-muted-foreground">WebSocket latency</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
{[
|
||||
{ title: "Active Users", value: stats.users.active.toLocaleString(), label: `${stats.users.total.toLocaleString()} total registered`, icon: Users, color: "from-purple-500 to-pink-500" },
|
||||
{ title: "Commands registered", value: stats.commands.total, label: "Total system capabilities", icon: Zap, color: "from-yellow-500 to-orange-500" },
|
||||
{ title: "Avg Latency", value: `${stats.ping.avg}ms`, label: "WebSocket heartbeat", icon: Activity, color: "from-emerald-500 to-teal-500" },
|
||||
].map((metric, i) => (
|
||||
<Card key={i} className="glass group hover:border-primary/50 transition-all duration-300 hover:scale-[1.02]">
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-xs font-bold uppercase tracking-widest text-white/50">{metric.title}</CardTitle>
|
||||
<div className={`p-2 rounded-lg bg-gradient-to-br ${metric.color} bg-opacity-10 group-hover:scale-110 transition-transform duration-300`}>
|
||||
<metric.icon className="h-4 w-4 text-white" />
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="text-3xl font-bold tracking-tight mb-1">{metric.value}</div>
|
||||
<p className="text-xs font-medium text-white/30">{metric.label}</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-7">
|
||||
<Card className="col-span-4">
|
||||
<CardHeader>
|
||||
<CardTitle>Economy Overview</CardTitle>
|
||||
<CardDescription>Server economy statistics</CardDescription>
|
||||
<div className="grid gap-6 md:grid-cols-2 lg:grid-cols-7">
|
||||
<Card className="col-span-4 glass border-white/5">
|
||||
<CardHeader className="flex flex-row items-start justify-between">
|
||||
<div>
|
||||
<CardTitle className="text-xl font-bold flex items-center gap-2">
|
||||
<div className="h-5 w-1 bg-primary rounded-full" />
|
||||
Economy Overview
|
||||
</CardTitle>
|
||||
<CardDescription className="text-white/40">Global wealth and progression statistics</CardDescription>
|
||||
</div>
|
||||
<div className="bg-white/5 px-3 py-1.5 rounded-full border border-white/10 flex items-center gap-2">
|
||||
<div className="h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse" />
|
||||
<span className="text-[10px] font-bold uppercase tracking-widest text-white/50">
|
||||
Uptime: {Math.floor(stats.uptime / 3600)}h {Math.floor((stats.uptime % 3600) / 60)}m
|
||||
</span>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<p className="text-sm font-medium">Total Wealth</p>
|
||||
<p className="text-2xl font-bold">{BigInt(stats.economy.totalWealth).toLocaleString()} AU</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<p className="text-sm font-medium">Average Level</p>
|
||||
<p className="text-xl font-bold">{stats.economy.avgLevel}</p>
|
||||
<div className="grid gap-8">
|
||||
<div className="relative group">
|
||||
<div className="absolute -inset-1 bg-gradient-to-r from-primary/20 to-purple-500/20 rounded-2xl blur opacity-0 group-hover:opacity-100 transition duration-1000"></div>
|
||||
<div className="relative bg-white/5 rounded-xl p-6 border border-white/10">
|
||||
<p className="text-sm font-bold uppercase tracking-wider text-white/30 mb-1">Total Distributed Wealth</p>
|
||||
<p className="text-4xl font-black text-glow bg-clip-text text-transparent bg-gradient-to-r from-primary to-purple-400">
|
||||
{BigInt(stats.economy.totalWealth).toLocaleString()} <span className="text-xl font-bold text-white/20">AU</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-sm font-medium">Top Streak</p>
|
||||
<p className="text-xl font-bold">{stats.economy.topStreak} days</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-6">
|
||||
<div className="bg-white/5 rounded-xl p-4 border border-white/5">
|
||||
<p className="text-xs font-bold text-white/30 uppercase tracking-widest mb-1">Avg Level</p>
|
||||
<p className="text-2xl font-bold">{stats.economy.avgLevel}</p>
|
||||
</div>
|
||||
<div className="bg-white/5 rounded-xl p-4 border border-white/5">
|
||||
<p className="text-xs font-bold text-white/30 uppercase tracking-widest mb-1">Peak Streak</p>
|
||||
<p className="text-2xl font-bold">{stats.economy.topStreak} <span className="text-sm text-white/20">days</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="col-span-3">
|
||||
<CardHeader>
|
||||
<CardTitle>Recent Events</CardTitle>
|
||||
<CardDescription>Latest system and bot events.</CardDescription>
|
||||
<Card className="col-span-3 glass border-white/5 overflow-hidden">
|
||||
<CardHeader className="bg-white/[0.02] border-b border-white/5">
|
||||
<CardTitle className="text-xl font-bold">Recent Events</CardTitle>
|
||||
<CardDescription className="text-white/30">Live system activity feed</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="space-y-4">
|
||||
<CardContent className="p-0">
|
||||
<div className="divide-y divide-white/5">
|
||||
{stats.recentEvents.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground">No recent events</p>
|
||||
<div className="p-8 text-center bg-transparent">
|
||||
<p className="text-sm text-white/20 font-medium">No activity recorded</p>
|
||||
</div>
|
||||
) : (
|
||||
stats.recentEvents.slice(0, 5).map((event, i) => (
|
||||
<div key={i} className="flex items-center">
|
||||
<div
|
||||
className={`w-2 h-2 rounded-full mr-2 ${event.type === 'success'
|
||||
? 'bg-emerald-500'
|
||||
: event.type === 'error'
|
||||
? 'bg-destructive'
|
||||
: 'bg-blue-500'
|
||||
}`}
|
||||
/>
|
||||
stats.recentEvents.slice(0, 6).map((event, i) => (
|
||||
<div key={i} className="flex items-start gap-4 p-4 hover:bg-white/[0.03] transition-colors group">
|
||||
<div className={`mt-1 p-2 rounded-lg ${event.type === 'success' ? 'bg-emerald-500/10 text-emerald-500' :
|
||||
event.type === 'error' ? 'bg-red-500/10 text-red-500' :
|
||||
'bg-blue-500/10 text-blue-500'
|
||||
} group-hover:scale-110 transition-transform`}>
|
||||
<div className="text-lg leading-none">{event.icon}</div>
|
||||
</div>
|
||||
<div className="space-y-1 flex-1">
|
||||
<p className="text-sm font-medium leading-none">
|
||||
{event.icon} {event.message}
|
||||
<p className="text-sm font-semibold text-white/90 leading-tight">
|
||||
{event.message}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{new Date(event.timestamp).toLocaleString()}
|
||||
<p className="text-[10px] font-bold text-white/20 uppercase tracking-wider">
|
||||
{new Date(event.timestamp).toLocaleTimeString()}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
{stats.recentEvents.length > 0 && (
|
||||
<button className="w-full py-3 text-[10px] font-bold uppercase tracking-[0.2em] text-white/20 hover:text-primary hover:bg-white/[0.02] transition-all border-t border-white/5">
|
||||
View Event Logs
|
||||
</button>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
@@ -78,6 +78,7 @@ export async function createWebServer(config: WebServerConfig = {}): Promise<Web
|
||||
]);
|
||||
|
||||
const stats = {
|
||||
bot: clientStats.bot,
|
||||
guilds: {
|
||||
count: clientStats.guilds,
|
||||
},
|
||||
|
||||
@@ -42,79 +42,65 @@
|
||||
}
|
||||
|
||||
:root {
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--radius: 1rem;
|
||||
--background: oklch(0.12 0.02 260);
|
||||
--foreground: oklch(0.98 0.01 260);
|
||||
--card: oklch(0.16 0.03 260 / 0.5);
|
||||
--card-foreground: oklch(0.98 0.01 260);
|
||||
--popover: oklch(0.14 0.02 260 / 0.8);
|
||||
--popover-foreground: oklch(0.98 0.01 260);
|
||||
--primary: oklch(0.65 0.18 250);
|
||||
--primary-foreground: oklch(1 0 0);
|
||||
--secondary: oklch(0.25 0.04 260);
|
||||
--secondary-foreground: oklch(0.98 0.01 260);
|
||||
--muted: oklch(0.2 0.03 260 / 0.6);
|
||||
--muted-foreground: oklch(0.7 0.02 260);
|
||||
--accent: oklch(0.3 0.05 250 / 0.4);
|
||||
--accent-foreground: oklch(0.98 0.01 260);
|
||||
--destructive: oklch(0.6 0.18 25);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
--input: oklch(1 0 0 / 5%);
|
||||
--ring: oklch(0.65 0.18 250 / 50%);
|
||||
--chart-1: oklch(0.6 0.18 250);
|
||||
--chart-2: oklch(0.7 0.15 160);
|
||||
--chart-3: oklch(0.8 0.12 80);
|
||||
--chart-4: oklch(0.6 0.2 300);
|
||||
--chart-5: oklch(0.6 0.25 20);
|
||||
--sidebar: oklch(0.14 0.02 260 / 0.6);
|
||||
--sidebar-foreground: oklch(0.98 0.01 260);
|
||||
--sidebar-primary: oklch(0.65 0.18 250);
|
||||
--sidebar-primary-foreground: oklch(1 0 0);
|
||||
--sidebar-accent: oklch(1 0 0 / 5%);
|
||||
--sidebar-accent-foreground: oklch(0.98 0.01 260);
|
||||
--sidebar-border: oklch(1 0 0 / 8%);
|
||||
--sidebar-ring: oklch(0.65 0.18 250 / 50%);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border outline-ring/50;
|
||||
}
|
||||
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
@apply bg-background text-foreground selection:bg-primary/30;
|
||||
font-family: 'Outfit', 'Inter', system-ui, sans-serif;
|
||||
background-image:
|
||||
radial-gradient(at 0% 0%, oklch(0.25 0.1 260 / 0.15) 0px, transparent 50%),
|
||||
radial-gradient(at 100% 0%, oklch(0.35 0.12 300 / 0.1) 0px, transparent 50%);
|
||||
background-attachment: fixed;
|
||||
}
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
.glass {
|
||||
@apply bg-card backdrop-blur-xl border border-white/10 shadow-2xl;
|
||||
}
|
||||
|
||||
.glass-sidebar {
|
||||
@apply bg-sidebar backdrop-blur-2xl border-r border-white/5;
|
||||
}
|
||||
|
||||
.text-glow {
|
||||
text-shadow: 0 0 10px oklch(var(--primary) / 0.5);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user