create admin dashboard which controls everything add update delete and add manager and there controls and user also and add more features in it and most important enhance home page and add compare and My Bag (same function like favorite) in very selection websites, books and production. add these features in website cards (Name, category, description, url, discount or pricing) also add categories and there pages. add these features in product cards (Name, description, price, category, stock, discount) also add categories and there pages. add these features in book cards (Title, author, description, price, category, stock, discount) and add categories and there pages make it fully professional way and enhance UI of complete website
d8b1d97 verified Download admin.html from zeeleo007/undefined: direct link, hf CLI and curl.
- Browser
- Download file 68.1 kB
-
https://huggingface.co/spaces/zeeleo007/undefined/resolve/main/admin.html
- Command line
-
hf download hf://spaces/zeeleo007/undefined/admin.html
-
curl -L -o admin.html https://huggingface.co/spaces/zeeleo007/undefined/resolve/main/admin.html
68.1 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Admin Dashboard - WebWizard</title> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script src="https://unpkg.com/react@18/umd/react.development.js"></script> | |
| <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script> | |
| <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> | |
| <style> | |
| .sidebar { | |
| transition: all 0.3s; | |
| } | |
| .dashboard-card:hover { | |
| transform: translateY(-3px); | |
| box-shadow: 0 10px 20px rgba(0,0,0,0.1); | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-100"> | |
| <div id="root"></div> | |
| <script type="text/babel"> | |
| const { useState, useEffect } = React; | |
| function AdminDashboard() { | |
| const [activeTab, setActiveTab] = useState('dashboard'); | |
| const [sidebarOpen, setSidebarOpen] = useState(true); | |
| const [users, setUsers] = useState([]); | |
| const [products, setProducts] = useState([]); | |
| const [books, setBooks] = useState([]); | |
| const [websites, setWebsites] = useState([]); | |
| const [managers, setManagers] = useState([]); | |
| // Simulate data fetching | |
| useEffect(() => { | |
| // Fake data | |
| setUsers([ | |
| { id: 1, name: 'John Doe', email: 'john@example.com', role: 'user', joined: '2023-01-15' }, | |
| { id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'user', joined: '2023-02-20' }, | |
| { id: 3, name: 'Bob Johnson', email: 'bob@example.com', role: 'user', joined: '2023-03-10' } | |
| ]); | |
| setManagers([ | |
| { id: 1, name: 'Admin User', email: 'admin@example.com', role: 'admin', permissions: 'full' }, | |
| { id: 2, name: 'Content Manager', email: 'content@example.com', role: 'manager', permissions: 'content' } | |
| ]); | |
| setProducts([ | |
| { id: 1, name: 'Wireless Headphones', price: 199.99, category: 'Electronics', stock: 45, discount: 15 }, | |
| { id: 2, name: 'Mechanical Keyboard', price: 89.99, category: 'Accessories', stock: 32, discount: 0 } | |
| ]); | |
| setBooks([ | |
| { id: 1, title: 'Clean Code', author: 'Robert Martin', price: 29.99, category: 'Programming', stock: 20, discount: 10 }, | |
| { id: 2, title: 'Design Patterns', author: 'Erich Gamma', price: 39.99, category: 'Programming', stock: 15, discount: 0 } | |
| ]); | |
| setWebsites([ | |
| { id: 1, name: 'React Docs', url: 'https://reactjs.org', category: 'Development', description: 'Official React documentation' }, | |
| { id: 2, name: 'Tailwind CSS', url: 'https://tailwindcss.com', category: 'Development', description: 'Utility-first CSS framework' } | |
| ]); | |
| }, []); | |
| const deleteItem = (type, id) => { | |
| // In a real app, you would make an API call here | |
| switch(type) { | |
| case 'user': | |
| setUsers(users.filter(u => u.id !== id)); | |
| break; | |
| case 'manager': | |
| setManagers(managers.filter(m => m.id !== id)); | |
| break; | |
| case 'product': | |
| setProducts(products.filter(p => p.id !== id)); | |
| break; | |
| case 'book': | |
| setBooks(books.filter(b => b.id !== id)); | |
| break; | |
| case 'website': | |
| setWebsites(websites.filter(w => w.id !== id)); | |
| break; | |
| } | |
| }; | |
| return ( | |
| <div className="flex h-screen overflow-hidden"> | |
| {/* Sidebar */} | |
| <div className={`sidebar bg-blue-800 text-white ${sidebarOpen ? 'w-64' : 'w-20'} transition-all duration-300`}> | |
| <div className="flex items-center justify-between p-4 border-b border-blue-700"> | |
| {sidebarOpen ? ( | |
| <h1 className="text-xl font-bold">WebWizard Admin</h1> | |
| ) : ( | |
| <i className="fas fa-hat-wizard text-2xl ml-1"></i> | |
| )} | |
| <button onClick={() => setSidebarOpen(!sidebarOpen)} className="text-white"> | |
| <i className={`fas ${sidebarOpen ? 'fa-times' : 'fa-bars'}`}></i> | |
| </button> | |
| </div> | |
| <nav className="p-4"> | |
| <ul className="space-y-2"> | |
| <li> | |
| <button | |
| onClick={() => setActiveTab('dashboard')} | |
| className={`w-full text-left flex items-center p-3 rounded-lg ${activeTab === 'dashboard' ? 'bg-blue-700' : 'hover:bg-blue-700'}`} | |
| > | |
| <i className="fas fa-tachometer-alt mr-3"></i> | |
| {sidebarOpen && <span>Dashboard</span>} | |
| </button> | |
| </li> | |
| <li> | |
| <button | |
| onClick={() => setActiveTab('users')} | |
| className={`w-full text-left flex items-center p-3 rounded-lg ${activeTab === 'users' ? 'bg-blue-700' : 'hover:bg-blue-700'}`} | |
| > | |
| <i className="fas fa-users mr-3"></i> | |
| {sidebarOpen && <span>Users</span>} | |
| </button> | |
| </li> | |
| <li> | |
| <button | |
| onClick={() => setActiveTab('managers')} | |
| className={`w-full text-left flex items-center p-3 rounded-lg ${activeTab === 'managers' ? 'bg-blue-700' : 'hover:bg-blue-700'}`} | |
| > | |
| <i className="fas fa-user-shield mr-3"></i> | |
| {sidebarOpen && <span>Managers</span>} | |
| </button> | |
| </li> | |
| <li> | |
| <button | |
| onClick={() => setActiveTab('products')} | |
| className={`w-full text-left flex items-center p-3 rounded-lg ${activeTab === 'products' ? 'bg-blue-700' : 'hover:bg-blue-700'}`} | |
| > | |
| <i className="fas fa-shopping-bag mr-3"></i> | |
| {sidebarOpen && <span>Products</span>} | |
| </button> | |
| </li> | |
| <li> | |
| <button | |
| onClick={() => setActiveTab('books')} | |
| className={`w-full text-left flex items-center p-3 rounded-lg ${activeTab === 'books' ? 'bg-blue-700' : 'hover:bg-blue-700'}`} | |
| > | |
| <i className="fas fa-book mr-3"></i> | |
| {sidebarOpen && <span>Books</span>} | |
| </button> | |
| </li> | |
| <li> | |
| <button | |
| onClick={() => setActiveTab('websites')} | |
| className={`w-full text-left flex items-center p-3 rounded-lg ${activeTab === 'websites' ? 'bg-blue-700' : 'hover:bg-blue-700'}`} | |
| > | |
| <i className="fas fa-globe mr-3"></i> | |
| {sidebarOpen && <span>Websites</span>} | |
| </button> | |
| </li> | |
| <li> | |
| <button | |
| onClick={() => setActiveTab('settings')} | |
| className={`w-full text-left flex items-center p-3 rounded-lg ${activeTab === 'settings' ? 'bg-blue-700' : 'hover:bg-blue-700'}`} | |
| > | |
| <i className="fas fa-cog mr-3"></i> | |
| {sidebarOpen && <span>Settings</span>} | |
| </button> | |
| </li> | |
| </ul> | |
| </nav> | |
| </div> | |
| {/* Main Content */} | |
| <div className="flex-1 overflow-y-auto"> | |
| {/* Top Navigation */} | |
| <header className="bg-white shadow-sm py-4 px-6 flex items-center justify-between sticky top-0 z-10"> | |
| <div className="flex items-center"> | |
| <h2 className="text-xl font-semibold text-gray-800 capitalize"> | |
| {activeTab === 'dashboard' ? 'Admin Dashboard' : activeTab} | |
| </h2> | |
| </div> | |
| <div className="flex items-center space-x-4"> | |
| <div className="relative"> | |
| <input | |
| type="text" | |
| placeholder="Search..." | |
| className="py-2 px-4 rounded-full border border-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-300" | |
| /> | |
| </div> | |
| <div className="flex items-center space-x-2"> | |
| <div className="w-10 h-10 rounded-full bg-blue-500 flex items-center justify-center text-white"> | |
| <i className="fas fa-user"></i> | |
| </div> | |
| <span className="hidden md:inline">Admin</span> | |
| </div> | |
| </div> | |
| </header> | |
| {/* Dashboard Content */} | |
| <main className="p-6"> | |
| {activeTab === 'dashboard' && ( | |
| <div> | |
| <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8"> | |
| <div className="dashboard-card bg-white rounded-xl p-6 shadow-md border border-gray-100 transition-all duration-300"> | |
| <div className="flex justify-between items-center"> | |
| <div> | |
| <p className="text-gray-500 text-sm">Total Users</p> | |
| <h3 className="text-2xl font-bold text-gray-800">1,248</h3> | |
| <p className="text-green-500 text-sm mt-1">+12% from last month</p> | |
| </div> | |
| <div className="bg-blue-100 p-3 rounded-full"> | |
| <i className="fas fa-users text-blue-500 text-xl"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <div className="dashboard-card bg-white rounded-xl p-6 shadow-md border border-gray-100 transition-all duration-300"> | |
| <div className="flex justify-between items-center"> | |
| <div> | |
| <p className="text-gray-500 text-sm">Total Products</p> | |
| <h3 className="text-2xl font-bold text-gray-800">356</h3> | |
| <p className="text-green-500 text-sm mt-1">+8% from last month</p> | |
| </div> | |
| <div className="bg-purple-100 p-3 rounded-full"> | |
| <i className="fas fa-shopping-bag text-purple-500 text-xl"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <div className="dashboard-card bg-white rounded-xl p-6 shadow-md border border-gray-100 transition-all duration-300"> | |
| <div className="flex justify-between items-center"> | |
| <div> | |
| <p className="text-gray-500 text-sm">Total Books</p> | |
| <h3 className="text-2xl font-bold text-gray-800">189</h3> | |
| <p className="text-green-500 text-sm mt-1">+5% from last month</p> | |
| </div> | |
| <div className="bg-green-100 p-3 rounded-full"> | |
| <i className="fas fa-book text-green-500 text-xl"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <div className="dashboard-card bg-white rounded-xl p-6 shadow-md border border-gray-100 transition-all duration-300"> | |
| <div className="flex justify-between items-center"> | |
| <div> | |
| <p className="text-gray-500 text-sm">Total Websites</p> | |
| <h3 className="text-2xl font-bold text-gray-800">872</h3> | |
| <p className="text-green-500 text-sm mt-1">+22% from last month</p> | |
| </div> | |
| <div className="bg-yellow-100 p-3 rounded-full"> | |
| <i className="fas fa-globe text-yellow-500 text-xl"></i> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div className="bg-white rounded-xl p-6 shadow-md border border-gray-100 mb-6"> | |
| <div className="flex justify-between items-center mb-6"> | |
| <h3 className="text-lg font-semibold text-gray-800">Recent Activity</h3> | |
| <button className="text-blue-500 text-sm">View All</button> | |
| </div> | |
| <div className="space-y-4"> | |
| <div className="flex items-start"> | |
| <div className="bg-blue-100 p-2 rounded-full mr-3"> | |
| <i className="fas fa-user-plus text-blue-500 text-sm"></i> | |
| </div> | |
| <div> | |
| <p className="text-sm text-gray-700"><span className="font-medium">New user</span> registered - johndoe@example.com</p> | |
| <p className="text-xs text-gray-500 mt-1">10 minutes ago</p> | |
| </div> | |
| </div> | |
| <div className="flex items-start"> | |
| <div className="bg-purple-100 p-2 rounded-full mr-3"> | |
| <i className="fas fa-shopping-cart text-purple-500 text-sm"></i> | |
| </div> | |
| <div> | |
| <p className="text-sm text-gray-700"><span className="font-medium">New product</span> added - Wireless Earbuds</p> | |
| <p className="text-xs text-gray-500 mt-1">1 hour ago</p> | |
| </div> | |
| </div> | |
| <div className="flex items-start"> | |
| <div className="bg-green-100 p-2 rounded-full mr-3"> | |
| <i className="fas fa-book text-green-500 text-sm"></i> | |
| </div> | |
| <div> | |
| <p className="text-sm text-gray-700"><span className="font-medium">New book</span> added - Clean Architecture</p> | |
| <p className="text-xs text-gray-500 mt-1">2 hours ago</p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div className="grid grid-cols-1 lg:grid-cols-2 gap-6"> | |
| <div className="bg-white rounded-xl p-6 shadow-md border border-gray-100"> | |
| <h3 className="text-lg font-semibold text-gray-800 mb-4">Quick Actions</h3> | |
| <div className="grid grid-cols-2 gap-4"> | |
| <button className="bg-blue-50 hover:bg-blue-100 text-blue-600 p-4 rounded-lg flex flex-col items-center justify-center"> | |
| <i className="fas fa-plus-circle text-xl mb-2"></i> | |
| <span className="text-sm">Add User</span> | |
| </button> | |
| <button className="bg-purple-50 hover:bg-purple-100 text-purple-600 p-4 rounded-lg flex flex-col items-center justify-center"> | |
| <i className="fas fa-shopping-bag text-xl mb-2"></i> | |
| <span className="text-sm">Add Product</span> | |
| </button> | |
| <button className="bg-green-50 hover:bg-green-100 text-green-600 p-4 rounded-lg flex flex-col items-center justify-center"> | |
| <i className="fas fa-book text-xl mb-2"></i> | |
| <span className="text-sm">Add Book</span> | |
| </button> | |
| <button className="bg-yellow-50 hover:bg-yellow-100 text-yellow-600 p-4 rounded-lg flex flex-col items-center justify-center"> | |
| <i className="fas fa-globe text-xl mb-2"></i> | |
| <span className="text-sm">Add Website</span> | |
| </button> | |
| </div> | |
| </div> | |
| <div className="bg-white rounded-xl p-6 shadow-md border border-gray-100"> | |
| <h3 className="text-lg font-semibold text-gray-800 mb-4">System Status</h3> | |
| <div className="space-y-3"> | |
| <div> | |
| <div className="flex justify-between mb-1"> | |
| <span className="text-sm font-medium text-gray-700">Storage</span> | |
| <span className="text-sm text-gray-500">45% used</span> | |
| </div> | |
| <div className="w-full bg-gray-200 rounded-full h-2.5"> | |
| <div className="bg-blue-600 h-2.5 rounded-full" style={{width: '45%'}}></div> | |
| </div> | |
| </div> | |
| <div> | |
| <div className="flex justify-between mb-1"> | |
| <span className="text-sm font-medium text-gray-700">Memory</span> | |
| <span className="text-sm text-gray-500">78% used</span> | |
| </div> | |
| <div className="w-full bg-gray-200 rounded-full h-2.5"> | |
| <div className="bg-purple-600 h-2.5 rounded-full" style={{width: '78%'}}></div> | |
| </div> | |
| </div> | |
| <div> | |
| <div className="flex justify-between mb-1"> | |
| <span className="text-sm font-medium text-gray-700">CPU</span> | |
| <span className="text-sm text-gray-500">32% used</span> | |
| </div> | |
| <div className="w-full bg-gray-200 rounded-full h-2.5"> | |
| <div className="bg-green-600 h-2.5 rounded-full" style={{width: '32%'}}></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| {activeTab === 'users' && ( | |
| <div className="bg-white rounded-xl shadow-md border border-gray-100 overflow-hidden"> | |
| <div className="p-6 flex justify-between items-center border-b border-gray-200"> | |
| <h3 className="text-lg font-semibold text-gray-800">User Management</h3> | |
| <button className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium"> | |
| <i className="fas fa-plus mr-2"></i> Add User | |
| </button> | |
| </div> | |
| <div className="overflow-x-auto"> | |
| <table className="min-w-full divide-y divide-gray-200"> | |
| <thead className="bg-gray-50"> | |
| <tr> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Role</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Joined</th> | |
| <th scope="col" className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody className="bg-white divide-y divide-gray-200"> | |
| {users.map((user) => ( | |
| <tr key={user.id}> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| <div className="flex items-center"> | |
| <div className="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-500"> | |
| <i className="fas fa-user"></i> | |
| </div> | |
| <div className="ml-4"> | |
| <div className="text-sm font-medium text-gray-900">{user.name}</div> | |
| </div> | |
| </div> | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{user.email}</td> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| <span className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">{user.role}</span> | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{user.joined}</td> | |
| <td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> | |
| <button className="text-blue-500 hover:text-blue-700 mr-3"> | |
| <i className="fas fa-edit"></i> | |
| </button> | |
| <button | |
| onClick={() => deleteItem('user', user.id)} | |
| className="text-red-500 hover:text-red-700" | |
| > | |
| <i className="fas fa-trash"></i> | |
| </button> | |
| </td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| <div className="px-6 py-4 border-t border-gray-200 flex items-center justify-between"> | |
| <div className="text-sm text-gray-500"> | |
| Showing <span className="font-medium">1</span> to <span className="font-medium">10</span> of <span className="font-medium">20</span> results | |
| </div> | |
| <div className="flex space-x-2"> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Previous</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-white bg-blue-500 hover:bg-blue-600">1</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">2</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">3</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Next</button> | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| {activeTab === 'managers' && ( | |
| <div className="bg-white rounded-xl shadow-md border border-gray-100 overflow-hidden"> | |
| <div className="p-6 flex justify-between items-center border-b border-gray-200"> | |
| <h3 className="text-lg font-semibold text-gray-800">Manager Management</h3> | |
| <button className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium"> | |
| <i className="fas fa-plus mr-2"></i> Add Manager | |
| </button> | |
| </div> | |
| <div className="overflow-x-auto"> | |
| <table className="min-w-full divide-y divide-gray-200"> | |
| <thead className="bg-gray-50"> | |
| <tr> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Role</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Permissions</th> | |
| <th scope="col" className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody className="bg-white divide-y divide-gray-200"> | |
| {managers.map((manager) => ( | |
| <tr key={manager.id}> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| <div className="flex items-center"> | |
| <div className="flex-shrink-0 h-10 w-10 rounded-full bg-purple-100 flex items-center justify-center text-purple-500"> | |
| <i className="fas fa-user-shield"></i> | |
| </div> | |
| <div className="ml-4"> | |
| <div className="text-sm font-medium text-gray-900">{manager.name}</div> | |
| </div> | |
| </div> | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{manager.email}</td> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| <span className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-purple-100 text-purple-800">{manager.role}</span> | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 capitalize">{manager.permissions}</td> | |
| <td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> | |
| <button className="text-blue-500 hover:text-blue-700 mr-3"> | |
| <i className="fas fa-edit"></i> | |
| </button> | |
| <button | |
| onClick={() => deleteItem('manager', manager.id)} | |
| className="text-red-500 hover:text-red-700" | |
| > | |
| <i className="fas fa-trash"></i> | |
| </button> | |
| </td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| <div className="px-6 py-4 border-t border-gray-200 flex items-center justify-between"> | |
| <div className="text-sm text-gray-500"> | |
| Showing <span className="font-medium">1</span> to <span className="font-medium">10</span> of <span className="font-medium">20</span> results | |
| </div> | |
| <div className="flex space-x-2"> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Previous</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-white bg-blue-500 hover:bg-blue-600">1</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">2</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">3</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Next</button> | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| {activeTab === 'products' && ( | |
| <div className="bg-white rounded-xl shadow-md border border-gray-100 overflow-hidden"> | |
| <div className="p-6 flex justify-between items-center border-b border-gray-200"> | |
| <h3 className="text-lg font-semibold text-gray-800">Product Management</h3> | |
| <button className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium"> | |
| <i className="fas fa-plus mr-2"></i> Add Product | |
| </button> | |
| </div> | |
| <div className="overflow-x-auto"> | |
| <table className="min-w-full divide-y divide-gray-200"> | |
| <thead className="bg-gray-50"> | |
| <tr> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Product</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Price</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Stock</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Discount</th> | |
| <th scope="col" className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody className="bg-white divide-y divide-gray-200"> | |
| {products.map((product) => ( | |
| <tr key={product.id}> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| <div className="flex items-center"> | |
| <div className="flex-shrink-0 h-10 w-10"> | |
| <img className="h-10 w-10 rounded-full" src={`http://static.photos/products/200x200/${product.id}`} alt="" /> | |
| </div> | |
| <div className="ml-4"> | |
| <div className="text-sm font-medium text-gray-900">{product.name}</div> | |
| </div> | |
| </div> | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${product.price.toFixed(2)}</td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 capitalize">{product.category}</td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{product.stock}</td> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| {product.discount > 0 ? ( | |
| <span className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">{product.discount}% off</span> | |
| ) : ( | |
| <span className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">None</span> | |
| )} | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> | |
| <button className="text-blue-500 hover:text-blue-700 mr-3"> | |
| <i className="fas fa-edit"></i> | |
| </button> | |
| <button | |
| onClick={() => deleteItem('product', product.id)} | |
| className="text-red-500 hover:text-red-700" | |
| > | |
| <i className="fas fa-trash"></i> | |
| </button> | |
| </td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| <div className="px-6 py-4 border-t border-gray-200 flex items-center justify-between"> | |
| <div className="text-sm text-gray-500"> | |
| Showing <span className="font-medium">1</span> to <span className="font-medium">10</span> of <span className="font-medium">20</span> results | |
| </div> | |
| <div className="flex space-x-2"> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Previous</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-white bg-blue-500 hover:bg-blue-600">1</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">2</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">3</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Next</button> | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| {activeTab === 'books' && ( | |
| <div className="bg-white rounded-xl shadow-md border border-gray-100 overflow-hidden"> | |
| <div className="p-6 flex justify-between items-center border-b border-gray-200"> | |
| <h3 className="text-lg font-semibold text-gray-800">Book Management</h3> | |
| <button className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium"> | |
| <i className="fas fa-plus mr-2"></i> Add Book | |
| </button> | |
| </div> | |
| <div className="overflow-x-auto"> | |
| <table className="min-w-full divide-y divide-gray-200"> | |
| <thead className="bg-gray-50"> | |
| <tr> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Book</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Author</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Price</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Stock</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Discount</th> | |
| <th scope="col" className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody className="bg-white divide-y divide-gray-200"> | |
| {books.map((book) => ( | |
| <tr key={book.id}> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| <div className="flex items-center"> | |
| <div className="flex-shrink-0 h-10 w-10"> | |
| <img className="h-10 w-10 rounded" src={`http://static.photos/books/200x200/${book.id}`} alt="" /> | |
| </div> | |
| <div className="ml-4"> | |
| <div className="text-sm font-medium text-gray-900">{book.title}</div> | |
| </div> | |
| </div> | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{book.author}</td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${book.price.toFixed(2)}</td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 capitalize">{book.category}</td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500">{book.stock}</td> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| {book.discount > 0 ? ( | |
| <span className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">{book.discount}% off</span> | |
| ) : ( | |
| <span className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800">None</span> | |
| )} | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> | |
| <button className="text-blue-500 hover:text-blue-700 mr-3"> | |
| <i className="fas fa-edit"></i> | |
| </button> | |
| <button | |
| onClick={() => deleteItem('book', book.id)} | |
| className="text-red-500 hover:text-red-700" | |
| > | |
| <i className="fas fa-trash"></i> | |
| </button> | |
| </td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| <div className="px-6 py-4 border-t border-gray-200 flex items-center justify-between"> | |
| <div className="text-sm text-gray-500"> | |
| Showing <span className="font-medium">1</span> to <span className="font-medium">10</span> of <span className="font-medium">20</span> results | |
| </div> | |
| <div className="flex space-x-2"> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Previous</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-white bg-blue-500 hover:bg-blue-600">1</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">2</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">3</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Next</button> | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| {activeTab === 'websites' && ( | |
| <div className="bg-white rounded-xl shadow-md border border-gray-100 overflow-hidden"> | |
| <div className="p-6 flex justify-between items-center border-b border-gray-200"> | |
| <h3 className="text-lg font-semibold text-gray-800">Website Management</h3> | |
| <button className="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-lg text-sm font-medium"> | |
| <i className="fas fa-plus mr-2"></i> Add Website | |
| </button> | |
| </div> | |
| <div className="overflow-x-auto"> | |
| <table className="min-w-full divide-y divide-gray-200"> | |
| <thead className="bg-gray-50"> | |
| <tr> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">URL</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th> | |
| <th scope="col" className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Description</th> | |
| <th scope="col" className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th> | |
| </tr> | |
| </thead> | |
| <tbody className="bg-white divide-y divide-gray-200"> | |
| {websites.map((website) => ( | |
| <tr key={website.id}> | |
| <td className="px-6 py-4 whitespace-nowrap"> | |
| <div className="flex items-center"> | |
| <div className="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-500"> | |
| <i className="fas fa-globe"></i> | |
| </div> | |
| <div className="ml-4"> | |
| <div className="text-sm font-medium text-gray-900">{website.name}</div> | |
| </div> | |
| </div> | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-blue-500"> | |
| <a href={website.url} target="_blank" rel="noopener noreferrer">{website.url}</a> | |
| </td> | |
| <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-500 capitalize">{website.category}</td> | |
| <td className="px-6 py-4 text-sm text-gray-500">{website.description}</td> | |
| <td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"> | |
| <button className="text-blue-500 hover:text-blue-700 mr-3"> | |
| <i className="fas fa-edit"></i> | |
| </button> | |
| <button | |
| onClick={() => deleteItem('website', website.id)} | |
| className="text-red-500 hover:text-red-700" | |
| > | |
| <i className="fas fa-trash"></i> | |
| </button> | |
| </td> | |
| </tr> | |
| ))} | |
| </tbody> | |
| </table> | |
| </div> | |
| <div className="px-6 py-4 border-t border-gray-200 flex items-center justify-between"> | |
| <div className="text-sm text-gray-500"> | |
| Showing <span className="font-medium">1</span> to <span className="font-medium">10</span> of <span className="font-medium">20</span> results | |
| </div> | |
| <div className="flex space-x-2"> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Previous</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-white bg-blue-500 hover:bg-blue-600">1</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">2</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">3</button> | |
| <button className="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Next</button> | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| {activeTab === 'settings' && ( | |
| <div className="bg-white rounded-xl shadow-md border border-gray-100 p-6"> | |
| <h3 className="text-lg font-semibold text-gray-800 mb-6">Settings</h3> | |
| <div className="space-y-8"> | |
| <div> | |
| <h4 className="text-md font-medium text-gray-800 mb-4">General Settings</h4> | |
| <div className="space-y-4"> | |
| <div className="flex items-center justify-between"> | |
| <div> | |
| <label htmlFor="site-name" className="block text-sm font-medium text-gray-700 mb-1">Site Name</label> | |
| <p className="text-xs text-gray-500">The name of your application</p> | |
| </div> | |
| <input | |
| type="text" | |
| id="site-name" | |
| defaultValue="WebWizard" | |
| className="w-64 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-300" | |
| /> | |
| </div> | |
| <div className="flex items-center justify-between"> | |
| <div> | |
| <label htmlFor="site-url" className="block text-sm font-medium text-gray-700 mb-1">Site URL</label> | |
| <p className="text-xs text-gray-500">The base URL of your application</p> | |
| </div> | |
| <input | |
| type="text" | |
| id="site-url" | |
| defaultValue="https://webwizard.app" | |
| className="w-64 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-300" | |
| /> | |
| </div> | |
| <div className="flex items-center justify-between"> | |
| <div> | |
| <label htmlFor="timezone" className="block text-sm font-medium text-gray-700 mb-1">Timezone</label> | |
| <p className="text-xs text-gray-500">The default timezone for your application</p> | |
| </div> | |
| <select | |
| id="timezone" | |
| className="w-64 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-300" | |
| > | |
| <option>(UTC-12:00) International Date Line West</option> | |
| <option>(UTC-08:00) Pacific Time (US & Canada)</option> | |
| <option selected>(UTC+00:00) Coordinated Universal Time</option> | |
| </select> | |
| </div> | |
| </div> | |
| </div> | |
| <div> | |
| <h4 className="text-md font-medium text-gray-800 mb-4">Security Settings</h4> | |
| <div className="space-y-4"> | |
| <div className="flex items-center justify-between"> | |
| <div> | |
| <label htmlFor="password-policy" className="block text-sm font-medium text-gray-700 mb-1">Password Policy</label> | |
| <p className="text-xs text-gray-500">Minimum requirements for user passwords</p> | |
| </div> | |
| <select | |
| id="password-policy" | |
| className="w-64 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-300" | |
| > | |
| <option>Low (6 characters minimum)</option> | |
| <option selected>Medium (8 characters, 1 number)</option> | |
| <option>Strong (10 characters, 1 number, 1 special)</option> | |
| </select> | |
| </div> | |
| <div className="flex items-center justify-between"> | |
| <div> | |
| <label htmlFor="login-attempts" className="block text-sm font-medium text-gray-700 mb-1">Failed Login Attempts</label> | |
| <p className="text-xs text-gray-500">Number of attempts before lockout</p> | |
| </div> | |
| <select | |
| id="login-attempts" | |
| className="w-64 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-300" | |
| > | |
| <option>3 attempts</option> | |
| <option selected>5 attempts</option> | |
| <option>10 attempts</option> | |
| </select> | |
| </div> | |
| <div className="flex items-center justify-between"> | |
| <div> | |
| <label htmlFor="lockout-duration" className="block text-sm font-medium text-gray-700 mb-1">Lockout Duration</label> | |
| <p className="text-xs text-gray-500">How long to lock accounts after failed attempts</p> | |
| </div> | |
| <select | |
| id="lockout-duration" | |
| className="w-64 px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-300" | |
| > | |
| <option>5 minutes</option> | |
| <option selected>15 minutes</option> | |
| <option>30 minutes</option> | |
| <option>1 hour</option> | |
| </select> | |
| </div> | |
| </div> | |
| </div> | |
| <div className="flex justify-end"> | |
| <button className="bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded-lg"> | |
| Save Settings | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| )} | |
| </main> | |
| </div> | |
| </div> | |
| ); | |
| } | |
| ReactDOM.render(<AdminDashboard />, document.getElementById('root')); | |
| </script> | |
| </body> | |
| </html> |