GummyBall commited on
Commit
2175e6d
·
verified ·
1 Parent(s): d9aa0de

make me a frontend system for my pc

Browse files
Files changed (5) hide show
  1. components/navbar.js +2 -2
  2. dashboard.html +138 -0
  3. dashboard.js +181 -0
  4. index.html +0 -2
  5. style.css +11 -2
components/navbar.js CHANGED
@@ -34,11 +34,11 @@ class CustomNavbar extends HTMLElement {
34
  <div class="logo">Backend Bananza 🎪</div>
35
  <div class="nav-links">
36
  <a href="/">Home</a>
 
37
  <a href="#">API Docs</a>
38
- <a href="#">Dashboard</a>
39
  <a href="#">Login</a>
40
  </div>
41
- </nav>
42
  `;
43
  }
44
  }
 
34
  <div class="logo">Backend Bananza 🎪</div>
35
  <div class="nav-links">
36
  <a href="/">Home</a>
37
+ <a href="/dashboard.html">Dashboard</a>
38
  <a href="#">API Docs</a>
 
39
  <a href="#">Login</a>
40
  </div>
41
+ </nav>
42
  `;
43
  }
44
  }
dashboard.html ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>PC Dashboard</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
10
+ </head>
11
+ <body>
12
+ <custom-navbar></custom-navbar>
13
+ <main class="container mx-auto p-4">
14
+ <h1 class="text-3xl font-bold mb-6">PC System Dashboard</h1>
15
+
16
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
17
+ <!-- CPU Usage -->
18
+ <div class="bg-white rounded-lg shadow p-6">
19
+ <h2 class="text-xl font-semibold mb-4">CPU Usage</h2>
20
+ <div class="h-64">
21
+ <canvas id="cpuChart"></canvas>
22
+ </div>
23
+ <div class="mt-4 grid grid-cols-2 gap-4">
24
+ <div class="bg-gray-100 p-3 rounded">
25
+ <p class="text-sm text-gray-600">Cores</p>
26
+ <p class="text-xl font-bold" id="cpuCores">Loading...</p>
27
+ </div>
28
+ <div class="bg-gray-100 p-3 rounded">
29
+ <p class="text-sm text-gray-600">Speed</p>
30
+ <p class="text-xl font-bold" id="cpuSpeed">Loading...</p>
31
+ </div>
32
+ </div>
33
+ </div>
34
+
35
+ <!-- Memory Usage -->
36
+ <div class="bg-white rounded-lg shadow p-6">
37
+ <h2 class="text-xl font-semibold mb-4">Memory Usage</h2>
38
+ <div class="h-64">
39
+ <canvas id="memoryChart"></canvas>
40
+ </div>
41
+ <div class="mt-4 grid grid-cols-2 gap-4">
42
+ <div class="bg-gray-100 p-3 rounded">
43
+ <p class="text-sm text-gray-600">Total</p>
44
+ <p class="text-xl font-bold" id="memTotal">Loading...</p>
45
+ </div>
46
+ <div class="bg-gray-100 p-3 rounded">
47
+ <p class="text-sm text-gray-600">Used</p>
48
+ <p class="text-xl font-bold" id="memUsed">Loading...</p>
49
+ </div>
50
+ </div>
51
+ </div>
52
+
53
+ <!-- Disk Usage -->
54
+ <div class="bg-white rounded-lg shadow p-6">
55
+ <h2 class="text-xl font-semibold mb-4">Disk Usage</h2>
56
+ <div class="h-64">
57
+ <canvas id="diskChart"></canvas>
58
+ </div>
59
+ <div class="mt-4 grid grid-cols-2 gap-4">
60
+ <div class="bg-gray-100 p-3 rounded">
61
+ <p class="text-sm text-gray-600">Total</p>
62
+ <p class="text-xl font-bold" id="diskTotal">Loading...</p>
63
+ </div>
64
+ <div class="bg-gray-100 p-3 rounded">
65
+ <p class="text-sm text-gray-600">Free</p>
66
+ <p class="text-xl font-bold" id="diskFree">Loading...</p>
67
+ </div>
68
+ </div>
69
+ </div>
70
+
71
+ <!-- Network -->
72
+ <div class="bg-white rounded-lg shadow p-6">
73
+ <h2 class="text-xl font-semibold mb-4">Network</h2>
74
+ <div class="h-64">
75
+ <canvas id="networkChart"></canvas>
76
+ </div>
77
+ <div class="mt-4 grid grid-cols-2 gap-4">
78
+ <div class="bg-gray-100 p-3 rounded">
79
+ <p class="text-sm text-gray-600">Upload</p>
80
+ <p class="text-xl font-bold" id="networkUp">Loading...</p>
81
+ </div>
82
+ <div class="bg-gray-100 p-3 rounded">
83
+ <p class="text-sm text-gray-600">Download</p>
84
+ <p class="text-xl font-bold" id="networkDown">Loading...</p>
85
+ </div>
86
+ </div>
87
+ </div>
88
+
89
+ <!-- System Info -->
90
+ <div class="bg-white rounded-lg shadow p-6">
91
+ <h2 class="text-xl font-semibold mb-4">System Information</h2>
92
+ <div class="space-y-3">
93
+ <div>
94
+ <p class="text-sm text-gray-600">OS</p>
95
+ <p class="text-lg" id="osInfo">Loading...</p>
96
+ </div>
97
+ <div>
98
+ <p class="text-sm text-gray-600">Browser</p>
99
+ <p class="text-lg" id="browserInfo">Loading...</p>
100
+ </div>
101
+ <div>
102
+ <p class="text-sm text-gray-600">Resolution</p>
103
+ <p class="text-lg" id="resolutionInfo">Loading...</p>
104
+ </div>
105
+ <div>
106
+ <p class="text-sm text-gray-600">Uptime</p>
107
+ <p class="text-lg" id="uptimeInfo">Loading...</p>
108
+ </div>
109
+ </div>
110
+ </div>
111
+
112
+ <!-- Processes -->
113
+ <div class="bg-white rounded-lg shadow p-6">
114
+ <h2 class="text-xl font-semibold mb-4">Running Processes</h2>
115
+ <div class="h-64 overflow-y-auto">
116
+ <table class="w-full">
117
+ <thead>
118
+ <tr class="border-b">
119
+ <th class="text-left py-2">Process</th>
120
+ <th class="text-right py-2">CPU %</th>
121
+ <th class="text-right py-2">Memory</th>
122
+ </tr>
123
+ </thead>
124
+ <tbody id="processList">
125
+ <tr><td colspan="3" class="py-4 text-center">Loading...</td></tr>
126
+ </tbody>
127
+ </table>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ </main>
132
+ <custom-footer></custom-footer>
133
+
134
+ <script src="components/navbar.js"></script>
135
+ <script src="components/footer.js"></script>
136
+ <script src="dashboard.js"></script>
137
+ </body>
138
+ </html>
dashboard.js ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', () => {
2
+ // Initialize charts
3
+ const cpuCtx = document.getElementById('cpuChart').getContext('2d');
4
+ const memoryCtx = document.getElementById('memoryChart').getContext('2d');
5
+ const diskCtx = document.getElementById('diskChart').getContext('2d');
6
+ const networkCtx = document.getElementById('networkChart').getContext('2d');
7
+
8
+ const cpuChart = new Chart(cpuCtx, {
9
+ type: 'line',
10
+ data: {
11
+ labels: Array(30).fill(''),
12
+ datasets: [{
13
+ label: 'CPU Usage %',
14
+ data: [],
15
+ borderColor: 'rgb(75, 192, 192)',
16
+ tension: 0.1,
17
+ fill: true
18
+ }]
19
+ },
20
+ options: {
21
+ responsive: true,
22
+ maintainAspectRatio: false,
23
+ scales: {
24
+ y: {
25
+ beginAtZero: true,
26
+ max: 100
27
+ }
28
+ }
29
+ }
30
+ });
31
+
32
+ const memoryChart = new Chart(memoryCtx, {
33
+ type: 'doughnut',
34
+ data: {
35
+ labels: ['Used', 'Free'],
36
+ datasets: [{
37
+ data: [0, 100],
38
+ backgroundColor: [
39
+ 'rgb(255, 99, 132)',
40
+ 'rgb(54, 162, 235)'
41
+ ]
42
+ }]
43
+ },
44
+ options: {
45
+ responsive: true,
46
+ maintainAspectRatio: false
47
+ }
48
+ });
49
+
50
+ const diskChart = new Chart(diskCtx, {
51
+ type: 'doughnut',
52
+ data: {
53
+ labels: ['Used', 'Free'],
54
+ datasets: [{
55
+ data: [0, 100],
56
+ backgroundColor: [
57
+ 'rgb(255, 159, 64)',
58
+ 'rgb(75, 192, 192)'
59
+ ]
60
+ }]
61
+ },
62
+ options: {
63
+ responsive: true,
64
+ maintainAspectRatio: false
65
+ }
66
+ });
67
+
68
+ const networkChart = new Chart(networkCtx, {
69
+ type: 'line',
70
+ data: {
71
+ labels: Array(30).fill(''),
72
+ datasets: [
73
+ {
74
+ label: 'Download (KB/s)',
75
+ data: [],
76
+ borderColor: 'rgb(54, 162, 235)',
77
+ tension: 0.1
78
+ },
79
+ {
80
+ label: 'Upload (KB/s)',
81
+ data: [],
82
+ borderColor: 'rgb(255, 99, 132)',
83
+ tension: 0.1
84
+ }
85
+ ]
86
+ },
87
+ options: {
88
+ responsive: true,
89
+ maintainAspectRatio: false
90
+ }
91
+ });
92
+
93
+ // System information
94
+ document.getElementById('osInfo').textContent = `${navigator.platform}`;
95
+ document.getElementById('browserInfo').textContent = `${navigator.userAgent.split(') ')[0].split('(')[1]}`;
96
+ document.getElementById('resolutionInfo').textContent = `${window.screen.width}x${window.screen.height}`;
97
+
98
+ // Simulate data updates (in a real app, you'd use WebSocket or API)
99
+ function updateSystemData() {
100
+ // CPU
101
+ const cpuUsage = Math.min(100, Math.max(0, Math.random() * 30 + 50));
102
+ updateChartData(cpuChart, cpuUsage);
103
+ document.getElementById('cpuCores').textContent = navigator.hardwareConcurrency || 'N/A';
104
+ document.getElementById('cpuSpeed').textContent = `${(Math.random() * 2 + 2).toFixed(2)} GHz`;
105
+
106
+ // Memory
107
+ const memUsed = Math.random() * 8 + 4;
108
+ const memTotal = 16;
109
+ const memFree = memTotal - memUsed;
110
+ memoryChart.data.datasets[0].data = [memUsed, memFree];
111
+ memoryChart.update();
112
+ document.getElementById('memTotal').textContent = `${memTotal} GB`;
113
+ document.getElementById('memUsed').textContent = `${memUsed.toFixed(2)} GB`;
114
+
115
+ // Disk
116
+ const diskUsed = Math.random() * 200 + 100;
117
+ const diskTotal = 500;
118
+ const diskFree = diskTotal - diskUsed;
119
+ diskChart.data.datasets[0].data = [diskUsed, diskFree];
120
+ diskChart.update();
121
+ document.getElementById('diskTotal').textContent = `${diskTotal} GB`;
122
+ document.getElementById('diskFree').textContent = `${diskFree.toFixed(2)} GB`;
123
+
124
+ // Network
125
+ const download = Math.random() * 500 + 100;
126
+ const upload = Math.random() * 200 + 50;
127
+ updateChartData(networkChart, download, upload);
128
+ document.getElementById('networkDown').textContent = `${download.toFixed(2)} KB/s`;
129
+ document.getElementById('networkUp').textContent = `${upload.toFixed(2)} KB/s`;
130
+
131
+ // Processes
132
+ updateProcessList();
133
+
134
+ // Uptime
135
+ const uptime = Math.floor(Math.random() * 86400) + 3600;
136
+ document.getElementById('uptimeInfo').textContent = formatUptime(uptime);
137
+ }
138
+
139
+ function updateChartData(chart, ...newData) {
140
+ newData.forEach((data, i) => {
141
+ if (chart.data.datasets[i]) {
142
+ chart.data.datasets[i].data.push(data);
143
+ if (chart.data.datasets[i].data.length > 30) {
144
+ chart.data.datasets[i].data.shift();
145
+ }
146
+ }
147
+ });
148
+ chart.update();
149
+ }
150
+
151
+ function updateProcessList() {
152
+ const processes = [
153
+ { name: 'chrome.exe', cpu: (Math.random() * 20).toFixed(1), memory: (Math.random() * 500 + 100).toFixed(1) },
154
+ { name: 'node.exe', cpu: (Math.random() * 15).toFixed(1), memory: (Math.random() * 300 + 50).toFixed(1) },
155
+ { name: 'explorer.exe', cpu: (Math.random() * 5).toFixed(1), memory: (Math.random() * 200 + 30).toFixed(1) },
156
+ { name: 'vscode.exe', cpu: (Math.random() * 10).toFixed(1), memory: (Math.random() * 400 + 100).toFixed(1) },
157
+ { name: 'spotify.exe', cpu: (Math.random() * 8).toFixed(1), memory: (Math.random() * 350 + 80).toFixed(1) }
158
+ ].sort((a, b) => b.cpu - a.cpu);
159
+
160
+ const processList = document.getElementById('processList');
161
+ processList.innerHTML = processes.map(proc => `
162
+ <tr class="border-b">
163
+ <td class="py-2">${proc.name}</td>
164
+ <td class="py-2 text-right">${proc.cpu}%</td>
165
+ <td class="py-2 text-right">${proc.memory} MB</td>
166
+ </tr>
167
+ `).join('');
168
+ }
169
+
170
+ function formatUptime(seconds) {
171
+ const hours = Math.floor(seconds / 3600);
172
+ const minutes = Math.floor((seconds % 3600) / 60);
173
+ return `${hours}h ${minutes}m`;
174
+ }
175
+
176
+ // Initial update
177
+ updateSystemData();
178
+
179
+ // Update every 2 seconds
180
+ setInterval(updateSystemData, 2000);
181
+ });
index.html CHANGED
@@ -1,2 +0,0 @@
1
-
2
- <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
 
 
 
style.css CHANGED
@@ -28,8 +28,17 @@ body {
28
  transform: translateY(-5px);
29
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
30
  }
31
-
32
  pre {
33
  white-space: pre-wrap;
34
  word-wrap: break-word;
35
- }
 
 
 
 
 
 
 
 
 
 
 
28
  transform: translateY(-5px);
29
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
30
  }
 
31
  pre {
32
  white-space: pre-wrap;
33
  word-wrap: break-word;
34
+ }
35
+
36
+ /* Dashboard specific styles */
37
+ #processList tr:hover {
38
+ background-color: #f8fafc;
39
+ }
40
+
41
+ canvas {
42
+ width: 100% !important;
43
+ height: 100% !important;
44
+ }