Spaces:
Running
Running
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Computer Components Visualization</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet"> | |
| <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <script src="https://unpkg.com/feather-icons"></script> | |
| <style> | |
| .chart-container { | |
| position: relative; | |
| height: 400px; | |
| width: 100%; | |
| } | |
| .grid-item:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50"> | |
| <header class="bg-indigo-600 text-white shadow-lg"> | |
| <div class="container mx-auto px-4 py-6"> | |
| <div class="flex justify-between items-center"> | |
| <h1 class="text-3xl font-bold flex items-center"> | |
| <i data-feather="cpu" class="mr-2"></i> PC Components Dashboard | |
| </h1> | |
| <nav> | |
| <ul class="flex space-x-6"> | |
| <li><a href="index.html" class="hover:text-indigo-200 transition font-bold">Components</a></li> | |
| <li><a href="sales.html" class="hover:text-indigo-200 transition">Sales</a></li> | |
| <li><a href="customers.html" class="hover:text-indigo-200 transition">Customers</a></li> | |
| </ul> | |
| </nav> | |
| </div> | |
| </div> | |
| </header> | |
| <main class="container mx-auto px-4 py-8"> | |
| <section class="mb-12" data-aos="fade-up"> | |
| <h2 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2">Component Distribution</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-8"> | |
| <div class="bg-white rounded-xl shadow-md p-6"> | |
| <h3 class="text-lg font-medium mb-4 text-gray-700">By Category</h3> | |
| <div class="chart-container"> | |
| <canvas id="categoryChart"></canvas> | |
| </div> | |
| </div> | |
| <div class="bg-white rounded-xl shadow-md p-6"> | |
| <h3 class="text-lg font-medium mb-4 text-gray-700">Stock Levels</h3> | |
| <div class="chart-container"> | |
| <canvas id="stockChart"></canvas> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <section class="mb-12" data-aos="fade-up"> | |
| <h2 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2">Performance Metrics</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-3 gap-6"> | |
| <div class="bg-white rounded-xl shadow-md p-6 text-center"> | |
| <div class="text-indigo-500 mb-3"> | |
| <i data-feather="trending-up" class="w-12 h-12 mx-auto"></i> | |
| </div> | |
| <h3 class="text-xl font-semibold mb-2">Highest Margin</h3> | |
| <p class="text-3xl font-bold text-gray-800">$444</p> | |
| <p class="text-gray-500">AMD Radeon RX 580</p> | |
| </div> | |
| <div class="bg-white rounded-xl shadow-md p-6 text-center"> | |
| <div class="text-green-500 mb-3"> | |
| <i data-feather="dollar-sign" class="w-12 h-12 mx-auto"></i> | |
| </div> | |
| <h3 class="text-xl font-semibold mb-2">Highest Price</h3> | |
| <p class="text-3xl font-bold text-gray-800">$702</p> | |
| <p class="text-gray-500">Intel Core i5-9600K</p> | |
| </div> | |
| <div class="bg-white rounded-xl shadow-md p-6 text-center"> | |
| <div class="text-red-500 mb-3"> | |
| <i data-feather="alert-circle" class="w-12 h-12 mx-auto"></i> | |
| </div> | |
| <h3 class="text-xl font-semibold mb-2">Low Stock</h3> | |
| <p class="text-3xl font-bold text-gray-800">5</p> | |
| <p class="text-gray-500">NVIDIA GTX 16GB</p> | |
| </div> | |
| </div> | |
| </section> | |
| <section data-aos="fade-up"> | |
| <h2 class="text-2xl font-semibold mb-6 text-gray-800 border-b pb-2">Component Details</h2> | |
| <div class="bg-white rounded-xl shadow-md overflow-hidden"> | |
| <div class="overflow-x-auto"> | |
| <table class="min-w-full divide-y divide-gray-200"> | |
| <thead class="bg-gray-50"> | |
| <tr> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Brand</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Specs</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Price</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Cost</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Margin</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Stock</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Warranty</th> | |
| </tr> | |
| </thead> | |
| <tbody class="bg-white divide-y divide-gray-200"> | |
| <!-- Data rows will be inserted here by JavaScript --> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </section> | |
| </main> | |
| <footer class="bg-gray-800 text-white py-8"> | |
| <div class="container mx-auto px-4"> | |
| <div class="flex flex-col md:flex-row justify-between items-center"> | |
| <div class="mb-4 md:mb-0"> | |
| <h2 class="text-xl font-bold flex items-center"> | |
| <i data-feather="database" class="mr-2"></i> PC Components Dashboard | |
| </h2> | |
| <p class="text-gray-400 mt-2">Visualizing computer hardware data</p> | |
| </div> | |
| <div class="flex space-x-4"> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i data-feather="github"></i> | |
| </a> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i data-feather="twitter"></i> | |
| </a> | |
| <a href="#" class="text-gray-400 hover:text-white transition"> | |
| <i data-feather="linkedin"></i> | |
| </a> | |
| </div> | |
| </div> | |
| <div class="border-t border-gray-700 mt-6 pt-6 text-center text-gray-400 text-sm"> | |
| <p>© 2023 PC Components Dashboard. All rights reserved.</p> | |
| </div> | |
| </div> | |
| </footer> | |
| <script> | |
| // Initialize AOS and Feather Icons | |
| AOS.init(); | |
| feather.replace(); | |
| // Data for visualization | |
| const components = [ | |
| {id: "P56494", category: "Graphic Cards", brand: "NVIDIA GTX", specs: "16 GB", price: 555, cost: 208, margin: 347, stock: 5, warranty: "No"}, | |
| {id: "P56495", category: "Processors", brand: "Core i7", specs: "10th Gen", price: 702, cost: 261, margin: 441, stock: 52, warranty: "No"}, | |
| {id: "P56496", category: "Processors", brand: "Core i7", specs: "10th Gen", price: 507, cost: 274, margin: 233, stock: 50, warranty: "No"}, | |
| {id: "P56497", category: "Processors", brand: "Core i7", specs: "11th Gen", price: 525, cost: 338, margin: 187, stock: 50, warranty: "No"}, | |
| {id: "P56498", category: "Memory Chips", brand: "DDR4", specs: "4GB", price: 505, cost: 334, margin: 171, stock: 50, warranty: "No"}, | |
| {id: "P56499", category: "Processors", brand: "Core i7", specs: "10th Gen", price: 469, cost: 204, margin: 265, stock: 50, warranty: "No"}, | |
| {id: "P56500", category: "Memory Chips", brand: "DDR5", specs: "8GB", price: 382, cost: 302, margin: 80, stock: 50, warranty: "No"}, | |
| {id: "P56501", category: "Memory Chips", brand: "DDR5", specs: "16GB", price: 512, cost: 319, margin: 193, stock: 50, warranty: "No"}, | |
| {id: "P56502", category: "Graphic Cards", brand: "NVIDIA GTX", specs: "4GB", price: 333, cost: 270, margin: 63, stock: 50, warranty: "No"}, | |
| {id: "P56503", category: "Graphic Cards", brand: "NVIDIA GTX", specs: "8GB", price: 429, cost: 383, margin: 46, stock: 50, warranty: "Yes"}, | |
| {id: "P56504", category: "Graphic Cards", brand: "AMD RADEON RX", specs: "8GB", price: 705, cost: 261, margin: 444, stock: 50, warranty: "No"}, | |
| {id: "P56505", category: "Graphic Cards", brand: "Core i7", specs: "10th Gen", price: 368, cost: 319, margin: 49, stock: 50, warranty: "Yes"}, | |
| {id: "P56506", category: "Motherboards", brand: "ASUS ROG", specs: "ATX", price: 508, cost: 298, margin: 210, stock: 50, warranty: "No"}, | |
| {id: "P56507", category: "Motherboards", brand: "ASUS ROG", specs: "Micro ATX", price: 404, cost: 257, margin: 147, stock: 50, warranty: "No"}, | |
| {id: "P56508", category: "Motherboards", brand: "ASUS PRIME", specs: "ATX", price: 514, cost: 282, margin: 232, stock: 50, warranty: "No"}, | |
| {id: "P56509", category: "Motherboards", brand: "ASUS PRIME", specs: "Micro ATX", price: 456, cost: 288, margin: 168, stock: 50, warranty: "No"} | |
| ]; | |
| // Populate table | |
| const tableBody = document.querySelector('tbody'); | |
| components.forEach(comp => { | |
| const row = document.createElement('tr'); | |
| row.className = 'hover:bg-gray-50 transition'; | |
| row.innerHTML = ` | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${comp.id}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${comp.category}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${comp.brand}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${comp.specs}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${comp.price}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${comp.cost}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${comp.margin}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${comp.stock}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${comp.warranty}</td> | |
| `; | |
| tableBody.appendChild(row); | |
| }); | |
| // Category Distribution Chart | |
| const categoryCounts = components.reduce((acc, comp) => { | |
| acc[comp.category] = (acc[comp.category] || 0) + 1; | |
| return acc; | |
| }, {}); | |
| const categoryCtx = document.getElementById('categoryChart').getContext('2d'); | |
| new Chart(categoryCtx, { | |
| type: 'doughnut', | |
| data: { | |
| labels: Object.keys(categoryCounts), | |
| datasets: [{ | |
| data: Object.values(categoryCounts), | |
| backgroundColor: [ | |
| '#6366F1', | |
| '#10B981', | |
| '#F59E0B', | |
| '#EF4444', | |
| '#8B5CF6' | |
| ], | |
| borderWidth: 0 | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| position: 'right', | |
| } | |
| } | |
| } | |
| }); | |
| // Stock Levels Chart | |
| const stockCtx = document.getElementById('stockChart').getContext('2d'); | |
| new Chart(stockCtx, { | |
| type: 'bar', | |
| data: { | |
| labels: components.map(comp => comp.id), | |
| datasets: [{ | |
| label: 'Stock Levels', | |
| data: components.map(comp => comp.stock), | |
| backgroundColor: '#6366F1', | |
| borderWidth: 0, | |
| borderRadius: 4 | |
| }] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| scales: { | |
| y: { | |
| beginAtZero: true | |
| } | |
| }, | |
| plugins: { | |
| legend: { | |
| display: false | |
| } | |
| } | |
| } | |
| }); | |
| </script> | |
| </body> | |
| </html> | |