forked from syntaxbullet/AuroraBot-discord
feat(dash): Revamp dashboard UI with glassmorphism and real bot data
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user