Spaces:
Running
Running
| <html lang="en" class="light"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>AdminFinity Dashboard</title> | |
| <link rel="icon" type="image/x-icon" href="/static/favicon.ico"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script> | |
| <script> | |
| tailwind.config = { | |
| darkMode: 'class', | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: { | |
| 50: '#f0f9ff', | |
| 100: '#e0f2fe', | |
| 200: '#bae6fd', | |
| 300: '#7dd3fc', | |
| 400: '#38bdf8', | |
| 500: '#0ea5e9', | |
| 600: '#0284c7', | |
| 700: '#0369a1', | |
| 800: '#075985', | |
| 900: '#0c4a6e', | |
| }, | |
| secondary: { | |
| 50: '#f5f3ff', | |
| 100: '#ede9fe', | |
| 200: '#ddd6fe', | |
| 300: '#c4b5fd', | |
| 400: '#a78bfa', | |
| 500: '#8b5cf6', | |
| 600: '#7c3aed', | |
| 700: '#6d28d9', | |
| 800: '#5b21b6', | |
| 900: '#4c1d95', | |
| } | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| .sidebar-collapsed { | |
| width: 5rem ; | |
| } | |
| .sidebar-collapsed .nav-text { | |
| display: none ; | |
| } | |
| .sidebar-collapsed .logo-text { | |
| display: none ; | |
| } | |
| .sidebar-collapsed .logo-icon { | |
| margin-right: 0 ; | |
| } | |
| .sidebar-collapsed ~ .main-content { | |
| margin-left: 5rem ; | |
| } | |
| .transition-all { | |
| transition-property: all; | |
| transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); | |
| transition-duration: 300ms; | |
| } | |
| /* Custom scrollbar */ | |
| ::-webkit-scrollbar { | |
| width: 8px; | |
| height: 8px; | |
| } | |
| ::-webkit-scrollbar-track { | |
| background: rgba(0, 0, 0, 0.05); | |
| border-radius: 4px; | |
| } | |
| ::-webkit-scrollbar-thumb { | |
| background: rgba(0, 0, 0, 0.2); | |
| border-radius: 4px; | |
| } | |
| ::-webkit-scrollbar-thumb:hover { | |
| background: rgba(0, 0, 0, 0.3); | |
| } | |
| .dark ::-webkit-scrollbar-track { | |
| background: rgba(255, 255, 255, 0.05); | |
| } | |
| .dark ::-webkit-scrollbar-thumb { | |
| background: rgba(255, 255, 255, 0.2); | |
| } | |
| .dark ::-webkit-scrollbar-thumb:hover { | |
| background: rgba(255, 255, 255, 0.3); | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 dark:bg-gray-900 text-gray-800 dark:text-gray-200 transition-all duration-300"> | |
| <div class="flex h-screen overflow-hidden"> | |
| <!-- Sidebar --> | |
| <div id="sidebar" class="w-64 bg-white dark:bg-gray-800 shadow-lg z-10 transition-all duration-300 flex-shrink-0"> | |
| <div class="flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700"> | |
| <div class="flex items-center"> | |
| <div class="logo-icon bg-primary-500 text-white p-2 rounded-lg mr-3"> | |
| <i data-feather="command"></i> | |
| </div> | |
| <span class="logo-text text-xl font-bold text-primary-600 dark:text-primary-400">AdminFinity</span> | |
| </div> | |
| <button id="sidebar-toggle" class="text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"> | |
| <i data-feather="chevron-left"></i> | |
| </button> | |
| </div> | |
| <div class="p-4"> | |
| <div class="mb-6"> | |
| <div class="text-xs uppercase font-semibold text-gray-500 dark:text-gray-400 mb-2 tracking-wider">Main</div> | |
| <ul> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-gray-700"> | |
| <i data-feather="home" class="mr-3"></i> | |
| <span class="nav-text">Dashboard</span> | |
| </a> | |
| </li> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg hover:text-primary-600 dark:hover:text-primary-400 hover:bg-primary-50 dark:hover:bg-gray-700"> | |
| <i data-feather="activity" class="mr-3"></i> | |
| <span class="nav-text">Analytics</span> | |
| </a> | |
| </li> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg hover:text-primary-600 dark:hover:text-primary-400 hover:bg-primary-50 dark:hover:bg-gray-700"> | |
| <i data-feather="users" class="mr-3"></i> | |
| <span class="nav-text">Users</span> | |
| </a> | |
| </li> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg hover:text-primary-600 dark:hover:text-primary-400 hover:bg-primary-50 dark:hover:bg-gray-700"> | |
| <i data-feather="shopping-cart" class="mr-3"></i> | |
| <span class="nav-text">Products</span> | |
| </a> | |
| </li> | |
| </ul> | |
| </div> | |
| <div class="mb-6"> | |
| <div class="text-xs uppercase font-semibold text-gray-500 dark:text-gray-400 mb-2 tracking-wider">Management</div> | |
| <ul> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg hover:text-primary-600 dark:hover:text-primary-400 hover:bg-primary-50 dark:hover:bg-gray-700"> | |
| <i data-feather="settings" class="mr-3"></i> | |
| <span class="nav-text">Settings</span> | |
| </a> | |
| </li> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg hover:text-primary-600 dark:hover:text-primary-400 hover:bg-primary-50 dark:hover:bg-gray-700"> | |
| <i data-feather="file-text" class="mr-3"></i> | |
| <span class="nav-text">Reports</span> | |
| </a> | |
| </li> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg hover:text-primary-600 dark:hover:text-primary-400 hover:bg-primary-50 dark:hover:bg-gray-700"> | |
| <i data-feather="bell" class="mr-3"></i> | |
| <span class="nav-text">Notifications</span> | |
| </a> | |
| </li> | |
| </ul> | |
| </div> | |
| <div> | |
| <div class="text-xs uppercase font-semibold text-gray-500 dark:text-gray-400 mb-2 tracking-wider">Support</div> | |
| <ul> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg hover:text-primary-600 dark:hover:text-primary-400 hover:bg-primary-50 dark:hover:bg-gray-700"> | |
| <i data-feather="help-circle" class="mr-3"></i> | |
| <span class="nav-text">Help Center</span> | |
| </a> | |
| </li> | |
| <li class="mb-1"> | |
| <a href="#" class="flex items-center p-2 rounded-lg hover:text-primary-600 dark:hover:text-primary-400 hover:bg-primary-50 dark:hover:bg-gray-700"> | |
| <i data-feather="mail" class="mr-3"></i> | |
| <span class="nav-text">Contact</span> | |
| </a> | |
| </li> | |
| </ul> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Main Content --> | |
| <div class="main-content flex-1 overflow-auto transition-all duration-300" style="margin-left: 16rem;"> | |
| <!-- Header --> | |
| <header class="bg-white dark:bg-gray-800 shadow-sm"> | |
| <div class="flex items-center justify-between px-6 py-4"> | |
| <div class="flex items-center"> | |
| <h1 class="text-xl font-semibold text-gray-800 dark:text-gray-200">Dashboard</h1> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <button id="dark-mode-toggle" class="p-2 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700"> | |
| <i data-feather="moon" class="text-gray-600 dark:text-gray-300 hidden dark:block"></i> | |
| <i data-feather="sun" class="text-gray-600 dark:text-gray-300 block dark:hidden"></i> | |
| </button> | |
| <div class="relative"> | |
| <button class="p-2 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700 relative"> | |
| <i data-feather="bell"></i> | |
| <span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span> | |
| </button> | |
| </div> | |
| <div class="flex items-center"> | |
| <div class="w-8 h-8 rounded-full bg-primary-500 flex items-center justify-center text-white mr-2"> | |
| <i data-feather="user"></i> | |
| </div> | |
| <div class="hidden md:block"> | |
| <div class="text-sm font-medium">John Doe</div> | |
| <div class="text-xs text-gray-500 dark:text-gray-400">Admin</div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </header> | |
| <!-- Content --> | |
| <main class="p-6"> | |
| <!-- Stats Cards --> | |
| <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6"> | |
| <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6"> | |
| <div class="flex items-center justify-between"> | |
| <div> | |
| <p class="text-gray-500 dark:text-gray-400 text-sm">Total Revenue</p> | |
| <h3 class="text-2xl font-bold text-gray-800 dark:text-gray-200">$45,231</h3> | |
| <p class="text-green-500 text-sm mt-1 flex items-center"> | |
| <i data-feather="trending-up" class="w-4 h-4 mr-1"></i> | |
| <span>12% from last month</span> | |
| </p> | |
| </div> | |
| <div class="p-3 rounded-lg bg-primary-100 dark:bg-primary-900 text-primary-600 dark:text-primary-300"> | |
| <i data-feather="dollar-sign"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6"> | |
| <div class="flex items-center justify-between"> | |
| <div> | |
| <p class="text-gray-500 dark:text-gray-400 text-sm">New Users</p> | |
| <h3 class="text-2xl font-bold text-gray-800 dark:text-gray-200">2,341</h3> | |
| <p class="text-green-500 text-sm mt-1 flex items-center"> | |
| <i data-feather="trending-up" class="w-4 h-4 mr-1"></i> | |
| <span>19% from last month</span> | |
| </p> | |
| </div> | |
| <div class="p-3 rounded-lg bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-300"> | |
| <i data-feather="users"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6"> | |
| <div class="flex items-center justify-between"> | |
| <div> | |
| <p class="text-gray-500 dark:text-gray-400 text-sm">Total Orders</p> | |
| <h3 class="text-2xl font-bold text-gray-800 dark:text-gray-200">1,245</h3> | |
| <p class="text-red-500 text-sm mt-1 flex items-center"> | |
| <i data-feather="trending-down" class="w-4 h-4 mr-1"></i> | |
| <span>4% from last month</span> | |
| </p> | |
| </div> | |
| <div class="p-3 rounded-lg bg-orange-100 dark:bg-orange-900 text-orange-600 dark:text-orange-300"> | |
| <i data-feather="shopping-bag"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6"> | |
| <div class="flex items-center justify-between"> | |
| <div> | |
| <p class="text-gray-500 dark:text-gray-400 text-sm">Active Projects</p> | |
| <h3 class="text-2xl font-bold text-gray-800 dark:text-gray-200">43</h3> | |
| <p class="text-green-500 text-sm mt-1 flex items-center"> | |
| <i data-feather="trending-up" class="w-4 h-4 mr-1"></i> | |
| <span>8% from last month</span> | |
| </p> | |
| </div> | |
| <div class="p-3 rounded-lg bg-indigo-100 dark:bg-indigo-900 text-indigo-600 dark:text-indigo-300"> | |
| <i data-feather="file-text"></i> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Charts --> | |
| <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6"> | |
| <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6"> | |
| <div class="flex items-center justify-between mb-4"> | |
| <h2 class="text-lg font-semibold text-gray-800 dark:text-gray-200">Revenue Overview</h2> | |
| <div class="flex space-x-2"> | |
| <button class="px-3 py-1 text-xs bg-primary-100 dark:bg-primary-900 text-primary-600 dark:text-primary-300 rounded-md">Year</button> | |
| <button class="px-3 py-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200 rounded-md">Month</button> | |
| <button class="px-3 py-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200 rounded-md">Week</button> | |
| </div> | |
| </div> | |
| <div class="h-64"> | |
| <canvas id="revenueChart"></canvas> | |
| </div> | |
| </div> | |
| <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6"> | |
| <div class="flex items-center justify-between mb-4"> | |
| <h2 class="text-lg font-semibold text-gray-800 dark:text-gray-200">User Acquisition</h2> | |
| <div class="flex space-x-2"> | |
| <button class="px-3 py-1 text-xs bg-primary-100 dark:bg-primary-900 text-primary-600 dark:text-primary-300 rounded-md">Year</button> | |
| <button class="px-3 py-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200 rounded-md">Month</button> | |
| <button class="px-3 py-1 text-xs bg-gray-100 dark:bg-gray-700 text-gray-800 dark:text-gray-200 rounded-md">Week</button> | |
| </div> | |
| </div> | |
| <div class="h-64"> | |
| <canvas id="userChart"></canvas> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Recent Orders --> | |
| <div class="bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden"> | |
| <div class="px-6 py-4 border-b border-gray-200 dark:border-gray-700"> | |
| <h2 class="text-lg font-semibold text-gray-800 dark:text-gray-200">Recent Orders</h2> | |
| </div> | |
| <div class="overflow-x-auto"> | |
| <table class="min-w-full divide-y divide-gray-200 dark:divide-gray-700"> | |
| <thead class="bg-gray-50 dark:bg-gray-700"> | |
| <tr> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Order ID</th> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Customer</th> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Date</th> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Amount</th> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Status</th> | |
| <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider">Action</th> | |
| </tr> | |
| </thead> | |
| <tbody class="bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700"> | |
| <tr> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">#ORD-0001</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">John Smith</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">12/05/2023</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">$125.00</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200">Completed</span> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"> | |
| <button class="text-primary-600 dark:text-primary-400 hover:text-primary-900 dark:hover:text-primary-300">View</button> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">#ORD-0002</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">Sarah Johnson</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">11/05/2023</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">$89.99</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200">Completed</span> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"> | |
| <button class="text-primary-600 dark:text-primary-400 hover:text-primary-900 dark:hover:text-primary-300">View</button> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">#ORD-0003</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">Michael Brown</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">10/05/2023</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">$245.50</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200">Pending</span> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"> | |
| <button class="text-primary-600 dark:text-primary-400 hover:text-primary-900 dark:hover:text-primary-300">View</button> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">#ORD-0004</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">Emily Davis</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">09/05/2023</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">$199.99</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200">Shipped</span> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"> | |
| <button class="text-primary-600 dark:text-primary-400 hover:text-primary-900 dark:hover:text-primary-300">View</button> | |
| </td> | |
| </tr> | |
| <tr> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">#ORD-0005</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">Robert Wilson</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400">08/05/2023</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">$75.25</td> | |
| <td class="px-6 py-4 whitespace-nowrap"> | |
| <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200">Cancelled</span> | |
| </td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"> | |
| <button class="text-primary-600 dark:text-primary-400 hover:text-primary-900 dark:hover:text-primary-300">View</button> | |
| </td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| <div class="px-6 py-4 border-t border-gray-200 dark:border-gray-700 flex items-center justify-between"> | |
| <div class="text-sm text-gray-500 dark:text-gray-400"> | |
| Showing <span class="font-medium">1</span> to <span class="font-medium">5</span> of <span class="font-medium">32</span> results | |
| </div> | |
| <div class="flex space-x-2"> | |
| <button class="px-3 py-1 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700">Previous</button> | |
| <button class="px-3 py-1 border border-primary-500 bg-primary-500 text-white rounded-md text-sm font-medium hover:bg-primary-600">1</button> | |
| <button class="px-3 py-1 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700">2</button> | |
| <button class="px-3 py-1 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700">3</button> | |
| <button class="px-3 py-1 border border-gray-300 dark:border-gray-600 rounded-md text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700">Next</button> | |
| </div> | |
| </div> | |
| </div> | |
| </main> | |
| </div> | |
| </div> | |
| <script> | |
| // Initialize feather icons | |
| feather.replace(); | |
| // Dark mode toggle | |
| const darkModeToggle = document.getElementById('dark-mode-toggle'); | |
| const html = document.documentElement; | |
| // Check for saved user preference or system preference | |
| if (localStorage.getItem('darkMode') === 'true' || (!localStorage.getItem('darkMode') && window.matchMedia('(prefers-color-scheme: dark)').matches)) { | |
| html.classList.add('dark'); | |
| } | |
| darkModeToggle.addEventListener('click', () => { | |
| html.classList.toggle('dark'); | |
| localStorage.setItem('darkMode', html.classList.contains('dark')); | |
| feather.replace(); | |
| }); | |
| // Sidebar toggle | |
| const sidebarToggle = document.getElementById('sidebar-toggle'); | |
| const sidebar = document.getElementById('sidebar'); | |
| sidebarToggle.addEventListener('click', () => { | |
| sidebar.classList.toggle('sidebar-collapsed'); | |
| const isCollapsed = sidebar.classList.contains('sidebar-collapsed'); | |
| localStorage.setItem('sidebarCollapsed', isCollapsed); | |
| // Change the icon based on sidebar state | |
| const icon = sidebarToggle.querySelector('i'); | |
| if (isCollapsed) { | |
| icon.setAttribute('data-feather', 'chevron-right'); | |
| } else { | |
| icon.setAttribute('data-feather', 'chevron-left'); | |
| } | |
| feather.replace(); | |
| }); | |
| // Check for saved sidebar state | |
| if (localStorage.getItem('sidebarCollapsed') === 'true') { | |
| sidebar.classList.add('sidebar-collapsed'); | |
| sidebarToggle.querySelector('i').setAttribute('data-feather', 'chevron-right'); | |
| feather.replace(); | |
| } | |
| // Charts | |
| document.addEventListener('DOMContentLoaded', function() { | |
| // Revenue Chart | |
| const revenueCtx = document.getElementById('revenueChart').getContext('2d'); | |
| const revenueChart = new Chart(revenueCtx, { | |
| type: 'line', | |
| data: { | |
| labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'], | |
| datasets: [{ | |
| label: 'Revenue', | |
| data: [5000, 8000, 6000, 9000, 12000, 10000, 15000], | |
| backgroundColor: 'rgba(14, 165, 233, 0.1)', | |
| borderColor: 'rgba(14, 165, 233, 1)', | |
| borderWidth: 2, | |
| tension: 0.4, | |
| pointBackgroundColor: 'rgba(14, 165, 233, 1)', | |
| pointRadius: 4, | |
| pointHoverRadius: 6 | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| display: false | |
| } | |
| }, | |
| scales: { | |
| y: { | |
| beginAtZero: true, | |
| grid: { | |
| color: 'rgba(0, 0, 0, 0.05)' | |
| } | |
| }, | |
| x: { | |
| grid: { | |
| display: false | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| // User Chart | |
| const userCtx = document.getElementById('userChart').getContext('2d'); | |
| const userChart = new Chart(userCtx, { | |
| type: 'bar', | |
| data: { | |
| labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'], | |
| datasets: [{ | |
| label: 'New Users', | |
| data: [200, 300, 250, 400, 350, 500, 450], | |
| backgroundColor: 'rgba(139, 92, 246, 0.7)', | |
| borderColor: 'rgba(139, 92, 246, 1)', | |
| borderWidth: 1 | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| display: false | |
| } | |
| }, | |
| scales: { | |
| y: { | |
| beginAtZero: true, | |
| grid: { | |
| color: 'rgba(0, 0, 0, 0.05)' | |
| } | |
| }, | |
| x: { | |
| grid: { | |
| display: false | |
| } | |
| } | |
| } | |
| } | |
| }); | |
| // Update charts on dark mode toggle | |
| darkModeToggle.addEventListener('click', () => { | |
| setTimeout(() => { | |
| revenueChart.update(); | |
| userChart.update(); | |
| }, 100); | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> | |