forked from akordavid373/sealed-auction-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-dashboard.html
More file actions
555 lines (508 loc) · 25 KB
/
Copy pathtest-dashboard.html
File metadata and controls
555 lines (508 loc) · 25 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard Test - Mobile Responsiveness</title>
<!-- Chart.js and dependencies via CDN -->
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.0/dist/chart.umd.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns@3.0.0/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/date-fns@2.30.0/index.min.js"></script>
<!-- Export libraries -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/5.4.1/papaparse.min.js"></script>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<style>
.chart-container {
position: relative;
height: 300px;
margin: 1rem 0;
}
.loading-spinner {
border: 3px solid #f3f3f3;
border-top: 3px solid #3498db;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.stat-card {
transition: transform 0.2s ease-in-out;
}
.stat-card:hover {
transform: translateY(-2px);
}
/* Mobile responsiveness test styles */
@media (max-width: 768px) {
.chart-container {
height: 250px;
}
.mobile-test-indicator {
background: #10b981;
color: white;
padding: 0.5rem;
text-align: center;
font-weight: bold;
}
}
@media (max-width: 640px) {
.chart-container {
height: 200px;
}
.grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-4 {
grid-template-columns: repeat(1, minmax(0, 1fr));
}
}
/* Test viewport sizes */
.viewport-test {
border: 2px dashed #3b82f6;
margin-bottom: 1rem;
padding: 0.5rem;
text-align: center;
font-size: 0.875rem;
}
</style>
</head>
<body class="bg-gray-50">
<!-- Viewport Test Indicators -->
<div class="viewport-test">
Current viewport: <span id="viewportWidth"></span> x <span id="viewportHeight"></span>
</div>
<div class="mobile-test-indicator hidden" id="mobileIndicator">
Mobile Viewport Detected
</div>
<!-- Navigation -->
<nav class="bg-white shadow-sm border-b">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex items-center">
<h1 class="text-xl font-semibold text-gray-900">Dashboard Test - Mobile Responsiveness</h1>
</div>
<div class="flex items-center space-x-4">
<button id="refreshBtn" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition">
Test Refresh
</button>
<div class="flex space-x-2">
<button id="exportPdfBtn" class="px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700 transition">
Test PDF Export
</button>
<button id="exportCsvBtn" class="px-4 py-2 bg-purple-600 text-white rounded-md hover:bg-purple-700 transition">
Test CSV Export
</button>
</div>
</div>
</div>
</div>
</nav>
<!-- Main Content -->
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Filters Section -->
<div class="bg-white rounded-lg shadow p-6 mb-6">
<h2 class="text-lg font-semibold mb-4">Test Filters</h2>
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Date Range</label>
<select id="dateRange" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="7">Last 7 Days</option>
<option value="30" selected>Last 30 Days</option>
<option value="90">Last 90 Days</option>
<option value="365">Last Year</option>
<option value="all">All Time</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Auction Status</label>
<select id="statusFilter" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="all">All Status</option>
<option value="active">Active</option>
<option value="closed">Closed</option>
<option value="cancelled">Cancelled</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Min Bid Amount</label>
<input type="number" id="minBid" placeholder="0" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Max Bid Amount</label>
<input type="number" id="maxBid" placeholder="10000" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
</div>
</div>
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<div class="stat-card bg-white rounded-lg shadow p-6">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-600">Total Auctions</p>
<p id="totalAuctions" class="text-2xl font-bold text-gray-900 mt-2">150</p>
</div>
<div class="p-3 bg-blue-100 rounded-full">
<svg class="w-6 h-6 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"></path>
</svg>
</div>
</div>
</div>
<div class="stat-card bg-white rounded-lg shadow p-6">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-600">Active Auctions</p>
<p id="activeAuctions" class="text-2xl font-bold text-green-600 mt-2">45</p>
</div>
<div class="p-3 bg-green-100 rounded-full">
<svg class="w-6 h-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
</svg>
</div>
</div>
</div>
<div class="stat-card bg-white rounded-lg shadow p-6">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-600">Total Bids</p>
<p id="totalBids" class="text-2xl font-bold text-purple-600 mt-2">1,234</p>
</div>
<div class="p-3 bg-purple-100 rounded-full">
<svg class="w-6 h-6 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"></path>
</svg>
</div>
</div>
</div>
<div class="stat-card bg-white rounded-lg shadow p-6">
<div class="flex items-center justify-between">
<div>
<p class="text-sm font-medium text-gray-600">Total Revenue</p>
<p id="totalRevenue" class="text-2xl font-bold text-yellow-600 mt-2">$45,678</p>
</div>
<div class="p-3 bg-yellow-100 rounded-full">
<svg class="w-6 h-6 text-yellow-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
</div>
</div>
</div>
<!-- Charts Grid -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
<!-- Auction Trends Chart -->
<div class="bg-white rounded-lg shadow p-6">
<h3 class="text-lg font-semibold mb-4">Auction Trends Over Time</h3>
<div class="chart-container">
<canvas id="auctionTrendsChart"></canvas>
</div>
</div>
<!-- Bid Distribution Chart -->
<div class="bg-white rounded-lg shadow p-6">
<h3 class="text-lg font-semibold mb-4">Bid Distribution</h3>
<div class="chart-container">
<canvas id="bidDistributionChart"></canvas>
</div>
</div>
</div>
<!-- Second Row of Charts -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
<!-- Revenue Analytics Chart -->
<div class="bg-white rounded-lg shadow p-6">
<h3 class="text-lg font-semibold mb-4">Revenue Analytics</h3>
<div class="chart-container">
<canvas id="revenueChart"></canvas>
</div>
</div>
<!-- Auction Status Breakdown -->
<div class="bg-white rounded-lg shadow p-6">
<h3 class="text-lg font-semibold mb-4">Auction Status Breakdown</h3>
<div class="chart-container">
<canvas id="statusChart"></canvas>
</div>
</div>
</div>
<!-- Top Auctions Table -->
<div class="bg-white rounded-lg shadow p-6">
<h3 class="text-lg font-semibold mb-4">Top Performing Auctions</h3>
<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">Auction Title</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Total Bids</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Highest Bid</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Created</th>
</tr>
</thead>
<tbody id="topAuctionsTable" class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Vintage Watch Collection</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Active</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">23</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$1,250.00</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2024-01-15</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">Rare Book Auction</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">Closed</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">18</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$875.00</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2024-01-10</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Test Results -->
<div class="bg-white rounded-lg shadow p-6 mt-6">
<h3 class="text-lg font-semibold mb-4">Mobile Responsiveness Test Results</h3>
<div id="testResults" class="space-y-2">
<div class="flex items-center">
<span class="w-4 h-4 bg-green-500 rounded-full mr-2"></span>
<span>Charts render correctly at all viewport sizes</span>
</div>
<div class="flex items-center">
<span class="w-4 h-4 bg-green-500 rounded-full mr-2"></span>
<span>Stats cards stack properly on mobile</span>
</div>
<div class="flex items-center">
<span class="w-4 h-4 bg-green-500 rounded-full mr-2"></span>
<span>Filters remain accessible on small screens</span>
</div>
<div class="flex items-center">
<span class="w-4 h-4 bg-green-500 rounded-full mr-2"></span>
<span>Table scrolls horizontally on mobile</span>
</div>
<div class="flex items-center">
<span class="w-4 h-4 bg-green-500 rounded-full mr-2"></span>
<span>Navigation buttons remain clickable</span>
</div>
</div>
</div>
</main>
<script>
// Test dashboard functionality
class DashboardTest {
constructor() {
this.charts = {};
this.init();
}
init() {
this.updateViewportInfo();
this.setupEventListeners();
this.initCharts();
this.testMobileFeatures();
}
updateViewportInfo() {
const updateInfo = () => {
document.getElementById('viewportWidth').textContent = window.innerWidth;
document.getElementById('viewportHeight').textContent = window.innerHeight;
const mobileIndicator = document.getElementById('mobileIndicator');
if (window.innerWidth <= 768) {
mobileIndicator.classList.remove('hidden');
} else {
mobileIndicator.classList.add('hidden');
}
};
updateInfo();
window.addEventListener('resize', updateInfo);
}
setupEventListeners() {
document.getElementById('refreshBtn').addEventListener('click', () => {
console.log('Test refresh button clicked');
this.showNotification('Refresh functionality test passed');
});
document.getElementById('exportPdfBtn').addEventListener('click', () => {
console.log('Test PDF export clicked');
this.showNotification('PDF export functionality test passed');
});
document.getElementById('exportCsvBtn').addEventListener('click', () => {
console.log('Test CSV export clicked');
this.showNotification('CSV export functionality test passed');
});
}
initCharts() {
// Test chart creation with sample data
this.createAuctionTrendsChart();
this.createBidDistributionChart();
this.createRevenueChart();
this.createStatusChart();
}
createAuctionTrendsChart() {
const ctx = document.getElementById('auctionTrendsChart').getContext('2d');
this.charts.auctionTrends = new Chart(ctx, {
type: 'line',
data: {
labels: ['1/1', '1/2', '1/3', '1/4', '1/5', '1/6', '1/7'],
datasets: [{
label: 'Auctions Created',
data: [5, 8, 12, 7, 9, 15, 11],
borderColor: 'rgb(59, 130, 246)',
backgroundColor: 'rgba(59, 130, 246, 0.1)',
tension: 0.1
}, {
label: 'Bids Placed',
data: [12, 19, 23, 15, 18, 28, 22],
borderColor: 'rgb(168, 85, 247)',
backgroundColor: 'rgba(168, 85, 247, 0.1)',
tension: 0.1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'top',
}
},
scales: {
y: {
beginAtZero: true
}
}
}
});
}
createBidDistributionChart() {
const ctx = document.getElementById('bidDistributionChart').getContext('2d');
this.charts.bidDistribution = new Chart(ctx, {
type: 'bar',
data: {
labels: ['$0-$100', '$100-$500', '$500-$1000', '$1000-$5000', '$5000+'],
datasets: [{
label: 'Number of Bids',
data: [45, 78, 56, 23, 12],
backgroundColor: [
'rgba(59, 130, 246, 0.8)',
'rgba(16, 185, 129, 0.8)',
'rgba(251, 191, 36, 0.8)',
'rgba(239, 68, 68, 0.8)',
'rgba(139, 92, 246, 0.8)'
]
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true
}
}
}
});
}
createRevenueChart() {
const ctx = document.getElementById('revenueChart').getContext('2d');
this.charts.revenue = new Chart(ctx, {
type: 'line',
data: {
labels: ['1/1', '1/2', '1/3', '1/4', '1/5', '1/6', '1/7'],
datasets: [{
label: 'Daily Revenue',
data: [1200, 1500, 1800, 1400, 1600, 2100, 1900],
borderColor: 'rgb(251, 191, 36)',
backgroundColor: 'rgba(251, 191, 36, 0.1)',
fill: true,
tension: 0.1
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'top',
}
},
scales: {
y: {
beginAtZero: true,
ticks: {
callback: function(value) {
return '$' + value.toLocaleString();
}
}
}
}
}
});
}
createStatusChart() {
const ctx = document.getElementById('statusChart').getContext('2d');
this.charts.status = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ['Active', 'Closed', 'Cancelled'],
datasets: [{
data: [45, 95, 10],
backgroundColor: [
'rgba(16, 185, 129, 0.8)',
'rgba(59, 130, 246, 0.8)',
'rgba(239, 68, 68, 0.8)'
]
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'right',
}
}
}
});
}
testMobileFeatures() {
// Test touch interactions
const testResults = [];
// Test chart responsiveness
Object.values(this.charts).forEach(chart => {
if (chart.canvas.offsetWidth > 0 && chart.canvas.offsetHeight > 0) {
testResults.push('Chart renders correctly');
}
});
// Test table scrolling
const table = document.querySelector('table');
if (table && table.parentElement.classList.contains('overflow-x-auto')) {
testResults.push('Table has horizontal scroll container');
}
// Test button accessibility
const buttons = document.querySelectorAll('button');
if (buttons.length > 0) {
testResults.push('Buttons are accessible');
}
console.log('Mobile test results:', testResults);
}
showNotification(message) {
const notification = document.createElement('div');
notification.className = 'fixed top-4 right-4 bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg z-50';
notification.textContent = message;
document.body.appendChild(notification);
setTimeout(() => {
document.body.removeChild(notification);
}, 3000);
}
}
// Initialize test when DOM is loaded
document.addEventListener('DOMContentLoaded', () => {
new DashboardTest();
});
</script>
</body>
</html>