CallmeGodsent commited on
Commit
7ca783b
Β·
verified Β·
1 Parent(s): 65a41f2

Sleek dashboard with sidebar, header, management like users, settings, one file and bootstrap. make hash based urls. EG index.html#report. Should be responsive as well. Light and dark mode with toggle.

Browse files
Files changed (4) hide show
  1. README.md +8 -5
  2. index.html +2 -19
  3. script.js +172 -0
  4. style.css +368 -17
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Adminflow Dashboard
3
- emoji: πŸ’»
4
- colorFrom: yellow
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: AdminFlow Dashboard πŸš€
3
+ colorFrom: red
4
+ colorTo: red
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
index.html CHANGED
@@ -1,19 +1,2 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
1
+
2
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
script.js ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Theme management
2
+ function initTheme() {
3
+ const savedTheme = localStorage.getItem('theme') || 'light';
4
+ document.documentElement.setAttribute('data-theme', savedTheme);
5
+ updateThemeToggle(savedTheme);
6
+ }
7
+
8
+ function toggleTheme() {
9
+ const currentTheme = document.documentElement.getAttribute('data-theme');
10
+ const newTheme = currentTheme === 'light' ? 'dark' : 'light';
11
+
12
+ document.documentElement.setAttribute('data-theme', newTheme);
13
+ localStorage.setItem('theme', newTheme);
14
+ updateThemeToggle(newTheme);
15
+ }
16
+
17
+ function updateThemeToggle(theme) {
18
+ const toggle = document.querySelector('.theme-toggle');
19
+ if (toggle) {
20
+ toggle.innerHTML = theme === 'light' ?
21
+ '<i class="fas fa-moon"></i>' :
22
+ '<i class="fas fa-sun"></i>';
23
+ }
24
+
25
+ // Navigation and routing
26
+ function initNavigation() {
27
+ // Show page based on hash
28
+ function showPage() {
29
+ const hash = window.location.hash.substring(1) || 'dashboard';
30
+ const pages = document.querySelectorAll('.page');
31
+
32
+ pages.forEach(page => {
33
+ page.classList.remove('active');
34
+ if (page.id === hash + '-page') {
35
+ page.classList.add('active');
36
+ }
37
+ });
38
+
39
+ // Update active nav item
40
+ const navItems = document.querySelectorAll('.nav-item');
41
+ navItems.forEach(item => {
42
+ item.classList.remove('active');
43
+ if (item.getAttribute('href') === `#${hash}`) {
44
+ item.classList.add('active');
45
+ }
46
+ });
47
+
48
+ // Update header title
49
+ updateHeaderTitle(hash);
50
+ }
51
+
52
+ // Update header title based on current page
53
+ function updateHeaderTitle(page) {
54
+ const headerTitle = document.querySelector('.header-left h1');
55
+ if (headerTitle) {
56
+ const titles = {
57
+ 'dashboard': 'Dashboard Overview',
58
+ 'users': 'User Management',
59
+ 'settings': 'System Settings',
60
+ 'reports': 'Analytics Reports'
61
+ };
62
+ headerTitle.textContent = titles[page] || 'Dashboard';
63
+ }
64
+ }
65
+
66
+ // Set initial page
67
+ showPage();
68
+
69
+ // Listen for hash changes
70
+ window.addEventListener('hashchange', showPage);
71
+
72
+ // Handle nav item clicks
73
+ document.addEventListener('click', (e) => {
74
+ if (e.target.closest('.nav-item')) {
75
+ const navItem = e.target.closest('.nav-item');
76
+ const href = navItem.getAttribute('href');
77
+ if (href && href.startsWith('#')) {
78
+ window.location.hash = href;
79
+ }
80
+ }
81
+ });
82
+ }
83
+
84
+ // Sample data for users
85
+ function getUsers() {
86
+ return [
87
+ { id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin', status: 'Active', joinDate: '2024-01-15' },
88
+ { id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'User', status: 'Active', joinDate: '2024-02-20' },
89
+ { id: 3, name: 'Mike Johnson', email: 'mike@example.com', role: 'User', status: 'Inactive', joinDate: '2024-01-10' },
90
+ { id: 4, name: 'Sarah Wilson', email: 'sarah@example.com', role: 'Moderator', status: 'Active', joinDate: '2024-03-05' },
91
+ { id: 5, name: 'Tom Brown', email: 'tom@example.com', role: 'User', status: 'Active', joinDate: '2024-02-28' }
92
+ ];
93
+ }
94
+
95
+ // Populate users table
96
+ function populateUsersTable() {
97
+ const users = getUsers();
98
+ const tableBody = document.querySelector('#users-table tbody');
99
+
100
+ if (tableBody) {
101
+ tableBody.innerHTML = users.map(user => `
102
+ <tr>
103
+ <td>${user.name}</td>
104
+ <td>${user.email}</td>
105
+ <td><span class="badge">${user.role}</span></td>
106
+ <td><span class="status ${user.status.toLowerCase()}">${user.status}</span></td>
107
+ <td>${user.joinDate}</td>
108
+ <td>
109
+ <button class="btn btn-sm" onclick="editUser(${user.id})">Edit</button>
110
+ <button class="btn btn-sm btn-danger" onclick="deleteUser(${user.id})">Delete</button>
111
+ </td>
112
+ </tr>
113
+ `).join('');
114
+ }
115
+ }
116
+
117
+ // User management functions
118
+ function editUser(userId) {
119
+ alert(`Editing user with ID: ${userId}`);
120
+ // In a real app, you would show a modal or navigate to an edit form
121
+ }
122
+
123
+ function deleteUser(userId) {
124
+ if (confirm('Are you sure you want to delete this user?')) {
125
+ alert(`User ${userId} deleted`);
126
+ // In a real app, you would make an API call here
127
+ populateUsersTable(); // Refresh the table
128
+ updateStats(); // Update dashboard stats
129
+ }
130
+ }
131
+
132
+ // Update dashboard stats
133
+ function updateStats() {
134
+ const users = getUsers();
135
+ const activeUsers = users.filter(u => u.status === 'Active').length;
136
+
137
+ // Update stats cards
138
+ document.querySelector('#total-users').textContent = users.length;
139
+ document.querySelector('#active-users').textContent = activeUsers;
140
+ document.querySelector('#new-users').textContent = Math.floor(Math.random() * 10) + 1;
141
+ document.querySelector('#revenue').textContent = `$${(Math.random() * 10000).toFixed(2)}`;
142
+ }
143
+
144
+ // Initialize everything when DOM is loaded
145
+ document.addEventListener('DOMContentLoaded', function() {
146
+ initTheme();
147
+ initNavigation();
148
+ populateUsersTable();
149
+ updateStats();
150
+
151
+ // Add event listener for theme toggle
152
+ document.addEventListener('click', (e) => {
153
+ if (e.target.closest('.theme-toggle')) {
154
+ toggleTheme();
155
+ }
156
+ });
157
+
158
+ // Handle form submissions
159
+ const userForm = document.getElementById('user-form');
160
+ if (userForm) {
161
+ userForm.addEventListener('submit', function(e) {
162
+ e.preventDefault();
163
+ alert('User saved successfully!');
164
+ this.reset();
165
+ });
166
+ }
167
+ });
168
+
169
+ // Handle window resize for responsive sidebar
170
+ window.addEventListener('resize', function() {
171
+ // You can add responsive behavior here if needed
172
+ });
style.css CHANGED
@@ -1,28 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
 
 
 
 
 
 
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
 
 
28
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ --primary-color: #667eea;
3
+ --primary-dark: #5a6fd8;
4
+ --secondary-color: #764ba2;
5
+ --text-primary: #2d3748;
6
+ --text-secondary: #718096;
7
+ --bg-primary: #ffffff;
8
+ --bg-secondary: #f7fafc;
9
+ --bg-sidebar: #f8f9fa;
10
+ --border-color: #e2e8f0;
11
+ --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
12
+ }
13
+
14
+ [data-theme="dark"] {
15
+ --primary-color: #667eea;
16
+ --primary-dark: #5a6fd8;
17
+ --secondary-color: #764ba2;
18
+ --text-primary: #f7fafc;
19
+ --text-secondary: #cbd5e0;
20
+ --bg-primary: #1a202c;
21
+ --bg-secondary: #2d3748;
22
+ --bg-sidebar: #2d3748;
23
+ --border-color: #4a5568;
24
+ --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
25
+ }
26
+
27
+ * {
28
+ margin: 0;
29
+ padding: 0;
30
+ box-sizing: border-box;
31
+ }
32
+
33
  body {
34
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
35
+ background-color: var(--bg-primary);
36
+ color: var(--text-primary);
37
+ transition: all 0.3s ease;
38
+ }
39
+
40
+ .dashboard-container {
41
+ display: flex;
42
+ min-height: 100vh;
43
+ }
44
+
45
+ /* Sidebar Styles */
46
+ .sidebar {
47
+ width: 260px;
48
+ background: var(--bg-sidebar);
49
+ border-right: 1px solid var(--border-color);
50
+ transition: all 0.3s ease;
51
+ position: fixed;
52
+ height: 100vh;
53
+ z-index: 1000;
54
+ }
55
+
56
+ .sidebar-header {
57
+ padding: 1.5rem;
58
+ border-bottom: 1px solid var(--border-color);
59
+ }
60
+
61
+ .sidebar-header h2 {
62
+ color: var(--primary-color);
63
+ font-size: 1.5rem;
64
+ font-weight: 700;
65
+ }
66
+
67
+ .sidebar-nav {
68
+ padding: 1rem 0;
69
+ }
70
+
71
+ .nav-item {
72
+ display: flex;
73
+ align-items: center;
74
+ padding: 0.75rem 1.5rem;
75
+ color: var(--text-secondary);
76
+ text-decoration: none;
77
+ transition: all 0.2s ease;
78
+ border-left: 3px solid transparent;
79
+ }
80
+
81
+ .nav-item:hover {
82
+ background: var(--bg-secondary);
83
+ color: var(--text-primary);
84
+ }
85
+
86
+ .nav-item.active {
87
+ background: var(--bg-secondary);
88
+ color: var(--primary-color);
89
+ border-left-color: var(--primary-color);
90
+ }
91
+
92
+ .nav-item i {
93
+ margin-right: 0.75rem;
94
+ width: 20px;
95
+ text-align: center;
96
+ }
97
+
98
+ /* Main Content */
99
+ .main-content {
100
+ flex: 1;
101
+ margin-left: 260px;
102
+ transition: all 0.3s ease;
103
+ }
104
+
105
+ /* Header Styles */
106
+ .header {
107
+ background: var(--bg-primary);
108
+ border-bottom: 1px solid var(--border-color);
109
+ padding: 1rem 2rem;
110
+ display: flex;
111
+ justify-content: space-between;
112
+ align-items: center;
113
+ box-shadow: var(--shadow);
114
+ }
115
+
116
+ .header-left h1 {
117
+ font-size: 1.5rem;
118
+ font-weight: 600;
119
+ color: var(--text-primary);
120
+ }
121
+
122
+ .header-right {
123
+ display: flex;
124
+ align-items: center;
125
+ gap: 1rem;
126
  }
127
 
128
+ /* Theme Toggle */
129
+ .theme-toggle {
130
+ background: none;
131
+ border: 1px solid var(--border-color);
132
+ color: var(--text-secondary);
133
+ padding: 0.5rem;
134
+ border-radius: 0.375rem;
135
+ cursor: pointer;
136
+ transition: all 0.2s ease;
137
  }
138
 
139
+ .theme-toggle:hover {
140
+ background: var(--bg-secondary);
141
+ color: var(--text-primary);
 
 
142
  }
143
 
144
+ /* Content Area */
145
+ .content {
146
+ padding: 2rem;
147
+ }
148
+
149
+ .page {
150
+ display: none;
151
+ }
152
+
153
+ .page.active {
154
+ display: block;
155
+ animation: fadeIn 0.3s ease;
156
+ }
157
+
158
+ @keyframes fadeIn {
159
+ from { opacity: 0; transform: translateY(10px); }
160
+ to { opacity: 1; transform: translateY(0); }
161
+ }
162
+
163
+ /* Card Styles */
164
  .card {
165
+ background: var(--bg-primary);
166
+ border: 1px solid var(--border-color);
167
+ border-radius: 0.5rem;
168
+ padding: 1.5rem;
169
+ box-shadow: var(--shadow);
170
+ margin-bottom: 1.5rem;
171
+ }
172
+
173
+ .card-header {
174
+ display: flex;
175
+ justify-content: space-between;
176
+ align-items: center;
177
+ margin-bottom: 1rem;
178
+ }
179
+
180
+ .card-title {
181
+ font-size: 1.25rem;
182
+ font-weight: 600;
183
+ color: var(--text-primary);
184
+ }
185
+
186
+ /* Table Styles */
187
+ .table {
188
+ width: 100%;
189
+ border-collapse: collapse;
190
+ background: var(--bg-primary);
191
  }
192
 
193
+ .table th,
194
+ .table td {
195
+ padding: 0.75rem 1rem;
196
+ text-align: left;
197
+ border-bottom: 1px solid var(--border-color);
198
  }
199
+
200
+ .table th {
201
+ background: var(--bg-secondary);
202
+ font-weight: 600;
203
+ color: var(--text-primary);
204
+ }
205
+
206
+ .table tr:hover {
207
+ background: var(--bg-secondary);
208
+ }
209
+
210
+ /* Responsive */
211
+ @media (max-width: 768px) {
212
+ .sidebar {
213
+ width: 70px;
214
+ }
215
+
216
+ .sidebar-header h2,
217
+ .nav-item span {
218
+ display: none;
219
+ }
220
+
221
+ .main-content {
222
+ margin-left: 70px;
223
+ }
224
+
225
+ .nav-item {
226
+ padding: 0.75rem;
227
+ justify-content: center;
228
+ }
229
+
230
+ .nav-item i {
231
+ margin-right: 0;
232
+ }
233
+
234
+ .header {
235
+ padding: 1rem;
236
+ }
237
+
238
+ .content {
239
+ padding: 1rem;
240
+ }
241
+ }
242
+
243
+ /* Stats Grid */
244
+ .stats-grid {
245
+ display: grid;
246
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
247
+ gap: 1.5rem;
248
+ margin-bottom: 2rem;
249
+ }
250
+
251
+ .stat-card {
252
+ background: var(--bg-primary);
253
+ border: 1px solid var(--border-color);
254
+ border-radius: 0.5rem;
255
+ padding: 1.5rem;
256
+ box-shadow: var(--shadow);
257
+ }
258
+
259
+ .stat-value {
260
+ font-size: 2rem;
261
+ font-weight: 700;
262
+ color: var(--primary-color);
263
+ margin-bottom: 0.5rem;
264
+ }
265
+
266
+ .stat-label {
267
+ color: var(--text-secondary);
268
+ font-size: 0.875rem;
269
+ }
270
+
271
+ /* Form Styles */
272
+ .form-group {
273
+ margin-bottom: 1rem;
274
+ }
275
+
276
+ .form-label {
277
+ display: block;
278
+ margin-bottom: 0.5rem;
279
+ color: var(--text-primary);
280
+ font-weight: 500;
281
+ }
282
+
283
+ .form-control {
284
+ width: 100%;
285
+ padding: 0.75rem;
286
+ border: 1px solid var(--border-color);
287
+ border-radius: 0.375rem;
288
+ background: var(--bg-primary);
289
+ color: var(--text-primary);
290
+ transition: all 0.2s ease;
291
+ }
292
+
293
+ .form-control:focus {
294
+ outline: none;
295
+ border-color: var(--primary-color);
296
+ box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
297
+ }
298
+
299
+ .btn {
300
+ padding: 0.75rem 1.5rem;
301
+ border: none;
302
+ border-radius: 0.375rem;
303
+ font-weight: 500;
304
+ cursor: pointer;
305
+ transition: all 0.2s ease;
306
+ }
307
+
308
+ .btn-primary {
309
+ background: var(--primary-color);
310
+ color: white;
311
+ }
312
+
313
+ .btn-primary:hover {
314
+ background: var(--primary-dark);
315
+ }
316
+
317
+ /* Settings Grid */
318
+ .settings-grid {
319
+ display: grid;
320
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
321
+ gap: 1.5rem;
322
+ }
323
+
324
+ .setting-item {
325
+ display: flex;
326
+ justify-content: space-between;
327
+ align-items: center;
328
+ padding: 1rem 0;
329
+ border-bottom: 1px solid var(--border-color);
330
+ }
331
+
332
+ .setting-item:last-child {
333
+ border-bottom: none;
334
+ }
335
+
336
+ .toggle-switch {
337
+ position: relative;
338
+ display: inline-block;
339
+ width: 50px;
340
+ height: 24px;
341
+ }
342
+
343
+ .toggle-switch input {
344
+ opacity: 0;
345
+ width: 0;
346
+ height: 0;
347
+ }
348
+
349
+ .toggle-slider {
350
+ position: absolute;
351
+ cursor: pointer;
352
+ top: 0;
353
+ left: 0;
354
+ right: 0;
355
+ bottom: 0;
356
+ background-color: var(--border-color);
357
+ transition: .4s;
358
+ border-radius: 24px;
359
+ }
360
+
361
+ .toggle-slider:before {
362
+ position: absolute;
363
+ content: "";
364
+ height: 16px;
365
+ width: 16px;
366
+ left: 4px;
367
+ bottom: 4px;
368
+ background-color: white;
369
+ transition: .4s;
370
+ border-radius: 50%;
371
+ }
372
+
373
+ input:checked + .toggle-slider {
374
+ background-color: var(--primary-color);
375
+ }
376
+
377
+ input:checked + .toggle-slider:before {
378
+ transform: translateX(26px);
379
+ }