Spaces:
Build error

File size: 2,949 Bytes
dae886b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"use client";

import Link from "next/link";
import { usePathname } from "next/navigation";
import type { ReactNode } from "react";

export function AdminLayout({ children }: { children: ReactNode }) {
  return (
    <div className="flex min-h-screen bg-ps-bg text-ps-text-main">
      <aside className="flex w-60 flex-col border-r border-ps-border bg-ps-surface px-4 py-4 text-xs">
        <div className="mb-6 flex items-center gap-2 px-2">
          <div className="flex h-8 w-8 items-center justify-center rounded bg-ps-primary text-sm font-semibold text-white">
            PS
          </div>
          <div>
            <div className="text-sm font-semibold">Prime stake</div>
            <div className="text-[11px] text-ps-text-muted">Admin</div>
          </div>
        </div>
        <div className="mb-3 text-[11px] font-semibold uppercase tracking-wide text-ps-text-muted">
          Sports Management
        </div>
        <nav className="space-y-1">
          <AdminNavItem href="/admin">Dashboard</AdminNavItem>
          <AdminNavItem href="/admin/matches">Matches</AdminNavItem>
          <AdminNavItem href="/admin/casino">Casino</AdminNavItem>
          <AdminNavItem href="/admin/markets">Markets</AdminNavItem>
          <AdminNavItem href="/admin/bets">Bets</AdminNavItem>
        </nav>
        <div className="mt-6 mb-3 text-[11px] font-semibold uppercase tracking-wide text-ps-text-muted">
          Administration
        </div>
        <nav className="space-y-1">
          <AdminNavItem href="/admin/users">Users</AdminNavItem>
          <AdminNavItem href="/admin/deposits">Deposits</AdminNavItem>
          <AdminNavItem href="/admin/withdrawals">Withdrawals</AdminNavItem>
          <AdminNavItem href="/admin/cms">CMS / Banners</AdminNavItem>
          <AdminNavItem href="/admin/settings">Settings</AdminNavItem>
        </nav>
        <div className="mt-auto flex items-center gap-3 rounded-lg bg-ps-surface-alt border border-ps-border px-3 py-3 text-[11px]">
          <div className="flex h-9 w-9 items-center justify-center rounded-full bg-ps-primary text-xs text-white font-bold">
            A
          </div>
          <div>
            <div className="font-semibold">Alex Admin</div>
            <div className="text-ps-primary font-semibold">Super Admin</div>
          </div>
        </div>
      </aside>
      <main className="flex-1 px-6 py-5">
        {children}
      </main>
    </div>
  );
}

function AdminNavItem({
  href,
  children
}: {
  href: string;
  children: ReactNode;
}) {
  const pathname = usePathname();
  const isActive = pathname === href;
  
  return (
    <Link
      href={href}
      className={`flex items-center justify-between rounded-md px-3 py-2 font-medium transition-colors ${
        isActive 
          ? "bg-ps-primary text-white shadow-sm" 
          : "text-ps-text-main hover:bg-ps-surface-alt"
      }`}
    >
      <span>{children}</span>
    </Link>
  );
}