prithivMLmods commited on
Commit
55083f0
·
verified ·
1 Parent(s): 5ae1ab8

Upload 5 files

Browse files
Files changed (5) hide show
  1. Dockerfile +20 -0
  2. index.html +1386 -0
  3. package.json +22 -0
  4. tsconfig.json +29 -0
  5. vite.config.ts +16 -0
Dockerfile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:22-alpine
2
+
3
+ WORKDIR /app
4
+
5
+ COPY package.json ./
6
+ RUN npm install
7
+
8
+ COPY index.html ./
9
+ #COPY index.tsx ./
10
+ #COPY index.css ./
11
+ #COPY metadata.json ./
12
+ COPY tsconfig.json ./
13
+ COPY vite.config.ts ./
14
+
15
+ # Debug: show what scripts are available
16
+ RUN cat package.json | head -20
17
+ RUN npx vite build
18
+
19
+ EXPOSE 7860
20
+ CMD ["npx", "serve", "-s", "dist", "-l", "7860"]
index.html ADDED
@@ -0,0 +1,1386 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>HF User Stats — HuggingFace User Statistics</title>
7
+ <meta name="description" content="View detailed statistics for any HuggingFace user — models, datasets, spaces, lifetime downloads, and likes.">
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');
11
+
12
+ :root {
13
+ --bg: #ffffff;
14
+ --text: #1a1a2e;
15
+ --text-secondary: #64748b;
16
+ --header-bg: #f8fafc;
17
+ --border: #e2e8f0;
18
+ --accent: #ff9d00;
19
+ --accent-hover: #e68a00;
20
+ --accent-light: rgba(255, 157, 0, 0.08);
21
+ --accent-border: rgba(255, 157, 0, 0.25);
22
+ --panel-bg: #ffffff;
23
+ --line-num: #cbd5e1;
24
+ --tree-line: #94a3b8;
25
+ --btn-bg: #f1f5f9;
26
+ --btn-border: #e2e8f0;
27
+ --btn-hover: #e2e8f0;
28
+ --shadow: rgba(0, 0, 0, 0.06);
29
+ --shadow-lg: rgba(0, 0, 0, 0.1);
30
+ --model-color: #f59e0b;
31
+ --dataset-color: #10b981;
32
+ --space-color: #6366f1;
33
+ --monthly-color: #8b5cf6;
34
+ --tag-model: rgba(245, 158, 11, 0.1);
35
+ --tag-dataset: rgba(16, 185, 129, 0.1);
36
+ --tag-space: rgba(99, 102, 241, 0.1);
37
+ --mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
38
+ --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
39
+ --radius: 10px;
40
+ --radius-sm: 6px;
41
+ }
42
+
43
+ [data-theme="dark"] {
44
+ --bg: #0f172a;
45
+ --text: #e2e8f0;
46
+ --text-secondary: #94a3b8;
47
+ --header-bg: #1e293b;
48
+ --border: #334155;
49
+ --accent: #fbbf24;
50
+ --accent-hover: #f59e0b;
51
+ --accent-light: rgba(251, 191, 36, 0.08);
52
+ --accent-border: rgba(251, 191, 36, 0.2);
53
+ --panel-bg: #1e293b;
54
+ --line-num: #475569;
55
+ --tree-line: #475569;
56
+ --btn-bg: #1e293b;
57
+ --btn-border: #334155;
58
+ --btn-hover: #334155;
59
+ --shadow: rgba(0, 0, 0, 0.3);
60
+ --shadow-lg: rgba(0, 0, 0, 0.5);
61
+ --tag-model: rgba(251, 191, 36, 0.1);
62
+ --tag-dataset: rgba(16, 185, 129, 0.1);
63
+ --tag-space: rgba(99, 102, 241, 0.12);
64
+ --monthly-color: #a78bfa;
65
+ }
66
+
67
+ * { box-sizing: border-box; margin: 0; padding: 0; }
68
+
69
+ body {
70
+ font-family: var(--sans);
71
+ background: var(--bg);
72
+ color: var(--text);
73
+ transition: background 0.3s, color 0.3s;
74
+ -webkit-font-smoothing: antialiased;
75
+ }
76
+
77
+ button, input { font-family: inherit; }
78
+ a { text-decoration: none; color: inherit; }
79
+
80
+ .app-container {
81
+ max-width: 1060px;
82
+ margin: 0 auto;
83
+ padding: 24px 20px 40px;
84
+ min-height: 100vh;
85
+ display: flex;
86
+ flex-direction: column;
87
+ }
88
+
89
+ header {
90
+ display: flex;
91
+ justify-content: space-between;
92
+ align-items: center;
93
+ margin-bottom: 32px;
94
+ padding-top: 8px;
95
+ }
96
+
97
+ .brand a {
98
+ display: flex; align-items: center; gap: 12px;
99
+ font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em;
100
+ }
101
+
102
+ .brand-icon {
103
+ width: 38px; height: 38px;
104
+ background: linear-gradient(135deg, #ff9d00 0%, #ffb340 100%);
105
+ border-radius: var(--radius);
106
+ display: flex; align-items: center; justify-content: center;
107
+ color: white; font-size: 1.1rem;
108
+ box-shadow: 0 2px 8px rgba(255, 157, 0, 0.3);
109
+ }
110
+
111
+ .header-actions { display: flex; gap: 12px; align-items: center; }
112
+
113
+ .icon-btn {
114
+ background: var(--btn-bg); border: 1px solid var(--btn-border);
115
+ font-size: 1.1rem; color: var(--text);
116
+ width: 38px; height: 38px; cursor: pointer;
117
+ border-radius: var(--radius); transition: all 0.2s;
118
+ display: flex; align-items: center; justify-content: center;
119
+ }
120
+ .icon-btn:hover { background: var(--btn-hover); border-color: var(--accent); }
121
+
122
+ .text-btn {
123
+ background: var(--btn-bg); border: 1px solid var(--btn-border);
124
+ font-size: 0.82rem; color: var(--text); cursor: pointer;
125
+ font-weight: 600; display: flex; align-items: center; gap: 6px;
126
+ padding: 8px 14px; border-radius: var(--radius); transition: all 0.2s;
127
+ }
128
+ .text-btn:hover { border-color: var(--accent); color: var(--accent); }
129
+
130
+ .sun-icon { display: none !important; }
131
+ [data-theme="dark"] .sun-icon { display: inline-block !important; color: #fbbf24; }
132
+ [data-theme="dark"] .moon-icon { display: none !important; }
133
+ [data-theme="light"] .moon-icon { display: inline-block !important; color: #64748b; }
134
+
135
+ .token-panel {
136
+ background: var(--header-bg); border: 1px solid var(--border);
137
+ padding: 16px; border-radius: var(--radius);
138
+ margin-bottom: 20px; animation: slideDown 0.25s ease-out;
139
+ }
140
+
141
+ @keyframes slideDown {
142
+ from { opacity: 0; transform: translateY(-8px); }
143
+ to { opacity: 1; transform: translateY(0); }
144
+ }
145
+
146
+ .token-inner { display: flex; gap: 10px; align-items: center; }
147
+ .token-inner i { color: var(--accent); font-size: 0.9rem; }
148
+
149
+ .token-inner input {
150
+ background: var(--bg); border: 1px solid var(--border);
151
+ padding: 9px 14px; border-radius: var(--radius-sm);
152
+ flex: 1; color: var(--text);
153
+ font-family: var(--mono); font-size: 0.82rem;
154
+ }
155
+ .token-inner input:focus {
156
+ outline: none; border-color: var(--accent);
157
+ box-shadow: 0 0 0 3px var(--accent-border);
158
+ }
159
+
160
+ .token-inner button {
161
+ background: var(--accent); color: white; border: none;
162
+ padding: 9px 18px; border-radius: var(--radius-sm);
163
+ cursor: pointer; font-weight: 600; font-size: 0.82rem;
164
+ transition: background 0.2s;
165
+ }
166
+ .token-inner button:hover { background: var(--accent-hover); }
167
+
168
+ .token-warning {
169
+ font-size: 0.75rem; color: var(--text-secondary);
170
+ margin: 10px 0 0 0; display: flex; align-items: center; gap: 6px;
171
+ }
172
+ .token-warning i { color: #f59e0b; font-size: 0.75rem; }
173
+
174
+ .search-section {
175
+ display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
176
+ }
177
+
178
+ .input-group {
179
+ background: var(--header-bg); border: 1px solid var(--border);
180
+ border-radius: var(--radius); display: flex; align-items: center;
181
+ padding: 0 14px; height: 44px; flex: 1;
182
+ transition: border-color 0.2s, box-shadow 0.2s;
183
+ }
184
+ .input-group:focus-within {
185
+ border-color: var(--accent);
186
+ box-shadow: 0 0 0 3px var(--accent-border);
187
+ }
188
+
189
+ .prefix {
190
+ color: var(--text-secondary); font-size: 0.8rem;
191
+ margin-right: 4px; white-space: nowrap;
192
+ font-family: var(--mono); font-weight: 500;
193
+ }
194
+
195
+ input {
196
+ background: transparent; border: none; color: var(--text);
197
+ width: 100%; outline: none; font-size: 0.88rem;
198
+ font-family: var(--mono); font-weight: 500;
199
+ }
200
+
201
+ .primary-btn {
202
+ background: var(--accent); color: white; border: none;
203
+ padding: 0 28px; border-radius: var(--radius);
204
+ font-weight: 700; cursor: pointer; height: 44px;
205
+ display: flex; align-items: center; gap: 10px;
206
+ font-size: 0.85rem; transition: all 0.2s;
207
+ box-shadow: 0 2px 6px rgba(255, 157, 0, 0.2);
208
+ white-space: nowrap;
209
+ }
210
+ .primary-btn:hover {
211
+ background: var(--accent-hover);
212
+ box-shadow: 0 4px 12px rgba(255, 157, 0, 0.3);
213
+ transform: translateY(-1px);
214
+ }
215
+ .primary-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
216
+
217
+ #statusMsg {
218
+ padding: 12px 16px; margin-bottom: 16px;
219
+ font-size: 0.85rem; text-align: center;
220
+ font-weight: 500; border-radius: var(--radius); display: none;
221
+ }
222
+ .error { color: #ef4444; background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.15); }
223
+ .loading { color: var(--accent); background: var(--accent-light); border: 1px solid var(--accent-border); }
224
+
225
+ .empty-state { text-align: center; }
226
+ .empty-state h3 { font-weight: 600; margin-top: 16px; letter-spacing: -0.02em; }
227
+ .empty-state p { color: var(--text-secondary); margin-bottom: 24px; font-size: 0.92rem; }
228
+
229
+ .homepage-section { margin-bottom: 36px; }
230
+ .homepage-section h3 {
231
+ font-size: 0.85rem; color: var(--text-secondary);
232
+ text-transform: uppercase; letter-spacing: 1.5px;
233
+ font-weight: 600; margin-bottom: 16px;
234
+ }
235
+
236
+ .tag-cloud {
237
+ display: flex; justify-content: center; gap: 10px;
238
+ flex-wrap: wrap; max-width: 850px; margin: 0 auto;
239
+ }
240
+
241
+ .user-tag {
242
+ background: var(--btn-bg); border: 1px solid var(--border);
243
+ color: var(--text); padding: 8px 18px; border-radius: 24px;
244
+ cursor: pointer; font-size: 0.82rem; font-family: var(--mono);
245
+ font-weight: 500; transition: all 0.2s;
246
+ display: flex; align-items: center; gap: 8px;
247
+ }
248
+ .user-tag:hover {
249
+ border-color: var(--accent); transform: translateY(-2px);
250
+ box-shadow: 0 4px 12px var(--shadow);
251
+ }
252
+ .user-tag i { color: var(--accent); }
253
+
254
+ .profile-card {
255
+ background: var(--header-bg); border: 1px solid var(--border);
256
+ border-radius: var(--radius); padding: 24px;
257
+ margin-bottom: 20px; animation: slideDown 0.3s ease-out;
258
+ }
259
+
260
+ .profile-top {
261
+ display: flex; align-items: center; gap: 20px;
262
+ }
263
+
264
+ .profile-avatar {
265
+ width: 72px; height: 72px; border-radius: 50%;
266
+ border: 3px solid var(--accent);
267
+ display: flex; align-items: center; justify-content: center;
268
+ overflow: hidden; flex-shrink: 0;
269
+ background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
270
+ }
271
+ .profile-avatar img {
272
+ width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
273
+ }
274
+ .profile-avatar .avatar-letter {
275
+ font-size: 1.8rem; font-weight: 700; color: white;
276
+ }
277
+
278
+ .profile-info { flex: 1; }
279
+
280
+ .profile-name {
281
+ font-size: 1.3rem; font-weight: 700;
282
+ letter-spacing: -0.02em; margin-bottom: 4px;
283
+ display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
284
+ }
285
+ .profile-name a { color: var(--accent); }
286
+ .profile-name a:hover { text-decoration: underline; }
287
+
288
+ .profile-fullname {
289
+ font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 4px;
290
+ }
291
+
292
+ .profile-overview {
293
+ display: grid; grid-template-columns: repeat(3, 1fr);
294
+ gap: 12px; margin-top: 20px; padding-top: 20px;
295
+ border-top: 1px solid var(--border);
296
+ }
297
+
298
+ .overview-card {
299
+ background: var(--bg); border: 1px solid var(--border);
300
+ border-radius: var(--radius-sm); padding: 16px;
301
+ text-align: center; transition: all 0.2s; cursor: pointer;
302
+ }
303
+ .overview-card:hover {
304
+ border-color: var(--accent); transform: translateY(-2px);
305
+ box-shadow: 0 4px 12px var(--shadow);
306
+ }
307
+ .overview-card.active-card {
308
+ border-color: var(--accent); background: var(--accent-light);
309
+ }
310
+
311
+ .overview-num {
312
+ font-size: 1.6rem; font-weight: 700;
313
+ font-family: var(--mono); letter-spacing: -0.02em;
314
+ }
315
+ .overview-num.model-num { color: var(--model-color); }
316
+ .overview-num.dataset-num { color: var(--dataset-color); }
317
+ .overview-num.space-num { color: var(--space-color); }
318
+
319
+ .overview-label {
320
+ font-size: 0.78rem; color: var(--text-secondary);
321
+ font-weight: 600; text-transform: uppercase;
322
+ letter-spacing: 1px; margin-top: 4px;
323
+ }
324
+
325
+ .tab-bar {
326
+ display: flex; border: 1px solid var(--border);
327
+ border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
328
+ }
329
+
330
+ .tab-btn {
331
+ flex: 1; background: var(--btn-bg); border: none;
332
+ border-right: 1px solid var(--border); padding: 12px 16px;
333
+ cursor: pointer; font-size: 0.85rem; font-weight: 600;
334
+ color: var(--text-secondary);
335
+ display: flex; align-items: center; justify-content: center;
336
+ gap: 8px; transition: all 0.2s;
337
+ }
338
+ .tab-btn:last-child { border-right: none; }
339
+ .tab-btn:hover { background: var(--btn-hover); color: var(--text); }
340
+ .tab-btn.active-model { background: var(--tag-model); color: var(--model-color); }
341
+ .tab-btn.active-dataset { background: var(--tag-dataset); color: var(--dataset-color); }
342
+ .tab-btn.active-space { background: var(--tag-space); color: var(--space-color); }
343
+
344
+ .tab-count {
345
+ background: var(--border); padding: 2px 8px; border-radius: 10px;
346
+ font-size: 0.72rem; font-weight: 700; font-family: var(--mono);
347
+ }
348
+ .tab-btn.active-model .tab-count { background: rgba(245, 158, 11, 0.2); }
349
+ .tab-btn.active-dataset .tab-count { background: rgba(16, 185, 129, 0.2); }
350
+ .tab-btn.active-space .tab-count { background: rgba(99, 102, 241, 0.2); }
351
+
352
+ .stats-row {
353
+ display: grid;
354
+ grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
355
+ gap: 12px; margin-bottom: 16px;
356
+ }
357
+
358
+ .stat-card {
359
+ background: var(--header-bg); border: 1px solid var(--border);
360
+ border-radius: var(--radius); padding: 16px 18px;
361
+ display: flex; align-items: center; gap: 12px;
362
+ }
363
+
364
+ .stat-icon {
365
+ width: 42px; height: 42px; border-radius: var(--radius-sm);
366
+ display: flex; align-items: center; justify-content: center;
367
+ font-size: 1rem; flex-shrink: 0;
368
+ }
369
+ .stat-icon.dl-icon { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
370
+ .stat-icon.monthly-icon { background: rgba(139, 92, 246, 0.1); color: var(--monthly-color); }
371
+ .stat-icon.like-icon { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
372
+ .stat-icon.count-icon { background: var(--accent-light); color: var(--accent); }
373
+
374
+ .stat-value {
375
+ font-size: 1.25rem; font-weight: 700;
376
+ font-family: var(--mono); letter-spacing: -0.02em;
377
+ }
378
+
379
+ .stat-label {
380
+ font-size: 0.7rem; color: var(--text-secondary);
381
+ font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
382
+ }
383
+
384
+ .filter-bar {
385
+ display: flex; gap: 8px; margin-bottom: 12px;
386
+ flex-wrap: wrap; align-items: center;
387
+ }
388
+
389
+ .filter-label {
390
+ font-size: 0.78rem; color: var(--text-secondary);
391
+ font-weight: 600; margin-right: 4px;
392
+ }
393
+
394
+ .filter-pill {
395
+ background: var(--btn-bg); border: 1px solid var(--btn-border);
396
+ color: var(--text-secondary); padding: 6px 14px;
397
+ border-radius: 20px; cursor: pointer; font-size: 0.78rem;
398
+ font-weight: 600; transition: all 0.2s; white-space: nowrap;
399
+ }
400
+ .filter-pill:hover { border-color: var(--accent); color: var(--text); }
401
+ .filter-pill.active { background: var(--accent); color: white; border-color: var(--accent); }
402
+
403
+ .filter-search {
404
+ margin-left: auto; background: var(--header-bg);
405
+ border: 1px solid var(--border); border-radius: 20px;
406
+ padding: 6px 14px; display: flex; align-items: center; gap: 6px;
407
+ transition: border-color 0.2s;
408
+ }
409
+ .filter-search:focus-within { border-color: var(--accent); }
410
+ .filter-search i { color: var(--text-secondary); font-size: 0.78rem; }
411
+ .filter-search input { font-size: 0.78rem; width: 160px; font-family: var(--mono); }
412
+
413
+ .tree-wrapper {
414
+ border: 1px solid var(--border); border-radius: var(--radius);
415
+ display: flex; flex-direction: column; background: var(--panel-bg);
416
+ box-shadow: 0 4px 16px var(--shadow); overflow: hidden;
417
+ }
418
+
419
+ .tree-header {
420
+ background: var(--header-bg); padding: 10px 16px;
421
+ border-bottom: 1px solid var(--border);
422
+ display: flex; justify-content: space-between;
423
+ align-items: center; flex-wrap: wrap; gap: 8px;
424
+ }
425
+
426
+ .tree-title {
427
+ font-size: 0.82rem; font-weight: 600;
428
+ color: var(--text-secondary); font-family: var(--mono);
429
+ }
430
+
431
+ .tool-btn {
432
+ background: var(--btn-bg); border: 1px solid var(--btn-border);
433
+ color: var(--text); padding: 7px 14px; border-radius: var(--radius-sm);
434
+ font-size: 0.8rem; font-weight: 600; cursor: pointer;
435
+ display: flex; align-items: center; gap: 7px; transition: all 0.2s;
436
+ }
437
+ .tool-btn:hover { background: var(--btn-hover); border-color: var(--tree-line); }
438
+ .action-btn { color: #fff; background: var(--accent); border-color: var(--accent); }
439
+ .action-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
440
+
441
+ .terminal-window {
442
+ background: var(--panel-bg); display: flex; overflow: auto;
443
+ font-family: var(--mono); font-size: 13px;
444
+ line-height: 1.7; max-height: 70vh;
445
+ }
446
+
447
+ .line-col {
448
+ padding: 16px 12px; text-align: right; color: var(--line-num);
449
+ border-right: 1px solid var(--border); min-width: 48px;
450
+ user-select: none; font-size: 0.75rem; font-weight: 500;
451
+ }
452
+ .line-col div {
453
+ height: 32px; display: flex; align-items: center; justify-content: flex-end;
454
+ }
455
+
456
+ .code-col { padding: 16px; flex: 1; white-space: pre; min-width: 0; }
457
+
458
+ .tree-line {
459
+ display: flex; align-items: center; height: 32px;
460
+ border-radius: 4px; padding: 0 6px; gap: 2px;
461
+ }
462
+ .tree-line:hover { background: var(--accent-light); }
463
+
464
+ .t-prefix {
465
+ color: var(--tree-line); white-space: pre;
466
+ margin-right: 4px; flex-shrink: 0;
467
+ }
468
+
469
+ .t-icon {
470
+ width: 22px; text-align: center;
471
+ display: inline-flex; align-items: center; justify-content: center;
472
+ margin-right: 8px; font-size: 0.85rem; flex-shrink: 0;
473
+ }
474
+
475
+ .t-name {
476
+ color: var(--text); font-weight: 600;
477
+ white-space: nowrap; overflow: hidden;
478
+ text-overflow: ellipsis; min-width: 0;
479
+ }
480
+ .t-name a { color: var(--text); transition: color 0.15s; }
481
+ .t-name a:hover { color: var(--accent); }
482
+
483
+ .t-meta {
484
+ margin-left: auto; display: flex; align-items: center;
485
+ gap: 12px; flex-shrink: 0; padding-left: 12px;
486
+ }
487
+
488
+ .t-stat {
489
+ font-size: 0.7rem; color: var(--text-secondary);
490
+ display: flex; align-items: center; gap: 4px;
491
+ font-weight: 500; white-space: nowrap;
492
+ }
493
+ .t-stat i { font-size: 0.65rem; }
494
+ .t-stat.dl-stat i { color: #3b82f6; }
495
+ .t-stat.monthly-stat i { color: var(--monthly-color); }
496
+ .t-stat.like-stat i { color: #ef4444; }
497
+ .t-stat.date-stat i { color: var(--text-secondary); }
498
+
499
+ .t-copy {
500
+ opacity: 0; background: none; border: none;
501
+ color: var(--text-secondary); cursor: pointer;
502
+ padding: 3px; font-size: 0.78rem; transition: all 0.2s;
503
+ display: flex; align-items: center; flex-shrink: 0;
504
+ }
505
+ .tree-line:hover .t-copy { opacity: 1; }
506
+ .t-copy:hover { color: var(--accent); transform: scale(1.15); }
507
+
508
+ .no-data {
509
+ padding: 48px 20px; text-align: center;
510
+ color: var(--text-secondary); font-size: 0.9rem;
511
+ }
512
+ .no-data i { font-size: 2rem; margin-bottom: 12px; display: block; opacity: 0.4; }
513
+
514
+ .footer {
515
+ padding: 40px 20px; text-align: center;
516
+ font-family: var(--mono); font-weight: 500;
517
+ font-size: 0.75rem; color: var(--text-secondary); margin-top: auto;
518
+ }
519
+ .footer a { color: var(--accent); font-weight: 600; }
520
+ .footer a:hover { text-decoration: underline; }
521
+
522
+ .spinner {
523
+ display: inline-block; width: 14px; height: 14px;
524
+ border: 2px solid var(--accent-border);
525
+ border-top-color: var(--accent); border-radius: 50%;
526
+ animation: spin 0.6s linear infinite;
527
+ margin-right: 8px; vertical-align: middle;
528
+ }
529
+
530
+ @keyframes spin { to { transform: rotate(360deg); } }
531
+ @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
532
+
533
+ @media (max-width: 640px) {
534
+ .search-section { flex-direction: column; }
535
+ .primary-btn { width: 100%; justify-content: center; }
536
+ .profile-top { flex-direction: column; text-align: center; }
537
+ .profile-name { justify-content: center; }
538
+ .profile-overview { grid-template-columns: repeat(3, 1fr); }
539
+ .stats-row { grid-template-columns: 1fr 1fr; }
540
+ .filter-bar { flex-direction: column; align-items: stretch; }
541
+ .filter-search { margin-left: 0; }
542
+ .filter-search input { width: 100%; }
543
+ .tab-btn { padding: 10px 8px; font-size: 0.78rem; }
544
+ .t-meta { gap: 6px; }
545
+ .tree-header { flex-direction: column; align-items: stretch; }
546
+ .overview-card { padding: 12px 8px; }
547
+ .overview-num { font-size: 1.2rem; }
548
+ .stat-card { padding: 12px 14px; gap: 10px; }
549
+ .stat-value { font-size: 1.1rem; }
550
+ .stat-icon { width: 36px; height: 36px; font-size: 0.9rem; }
551
+ }
552
+
553
+ ::-webkit-scrollbar { width: 8px; height: 8px; }
554
+ ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
555
+ ::-webkit-scrollbar-thumb:hover { background: var(--tree-line); }
556
+ ::-webkit-scrollbar-track { background: transparent; }
557
+ ::selection { background: var(--accent); color: white; }
558
+ .hidden { display: none !important; }
559
+ </style>
560
+ </head>
561
+ <body>
562
+ <div class="app-container">
563
+ <header>
564
+ <div class="brand">
565
+ <a href="#">
566
+ <div class="brand-icon"><i class="fas fa-chart-bar"></i></div>
567
+ <span>hf user stats🤗</span>
568
+ </a>
569
+ </div>
570
+ <div class="header-actions">
571
+ <button id="privateRepoBtn" class="text-btn" title="Access Private Repos">
572
+ <i class="fas fa-lock"></i> Token
573
+ </button>
574
+ <button id="themeToggle" class="icon-btn" aria-label="Toggle Theme">
575
+ <i class="fas fa-sun sun-icon"></i>
576
+ <i class="fas fa-moon moon-icon"></i>
577
+ </button>
578
+ </div>
579
+ </header>
580
+
581
+ <div id="tokenSection" class="token-panel hidden">
582
+ <div class="token-inner">
583
+ <i class="fas fa-key"></i>
584
+ <input type="password" id="hfToken" placeholder="Paste HuggingFace Access Token (hf_...)">
585
+ <button id="saveTokenBtn">Save</button>
586
+ <button id="clearTokenBtn" class="hidden">Clear</button>
587
+ </div>
588
+ <p class="token-warning">
589
+ <i class="fas fa-exclamation-triangle"></i> Token is saved to <b>LocalStorage</b>. Required for private repos & accurate lifetime stats.
590
+ </p>
591
+ </div>
592
+
593
+ <div class="search-section">
594
+ <div class="input-group" style="flex:2;">
595
+ <span class="prefix"><i class="fas fa-user" style="margin-right:6px;color:var(--accent);"></i> hf.co/</span>
596
+ <input type="text" id="usernameInput" placeholder="username (e.g. prithivMLmods)" autocomplete="off">
597
+ </div>
598
+ <button id="fetchBtn" class="primary-btn">
599
+ <i class="fas fa-search"></i> Fetch Stats
600
+ </button>
601
+ </div>
602
+
603
+ <div id="statusMsg"></div>
604
+
605
+ <div id="emptyState" class="empty-state">
606
+ <div class="homepage-section">
607
+ <h3 style="font-size:1.3rem;text-transform:none;letter-spacing:-0.02em;color:var(--text);">
608
+ Hugging-face User Statistics
609
+ </h3>
610
+ <p>View models, datasets, spaces, lifetime downloads, monthly downloads, and likes for any Hugging-face user.</p>
611
+ </div>
612
+ <div class="homepage-section">
613
+ <h3>Featured Users</h3>
614
+ <div id="featuredUsers" class="tag-cloud"></div>
615
+ </div>
616
+ </div>
617
+
618
+ <div id="resultsSection" class="hidden">
619
+ <div id="profileCard" class="profile-card">
620
+ <div class="profile-top">
621
+ <div class="profile-avatar" id="profileAvatar">
622
+ <span class="avatar-letter" id="avatarLetter"></span>
623
+ </div>
624
+ <div class="profile-info">
625
+ <div class="profile-name">
626
+ <a id="profileLink" href="#" target="_blank" rel="noopener">
627
+ <span id="profileUsername"></span>
628
+ </a>
629
+ </div>
630
+ <div class="profile-fullname" id="profileFullname"></div>
631
+ </div>
632
+ </div>
633
+ <div class="profile-overview">
634
+ <div class="overview-card" id="overviewModels" data-tab="models">
635
+ <div class="overview-num model-num" id="totalModelsNum">0</div>
636
+ <div class="overview-label"><i class="fas fa-cube"></i> Models</div>
637
+ </div>
638
+ <div class="overview-card" id="overviewDatasets" data-tab="datasets">
639
+ <div class="overview-num dataset-num" id="totalDatasetsNum">0</div>
640
+ <div class="overview-label"><i class="fas fa-database"></i> Datasets</div>
641
+ </div>
642
+ <div class="overview-card" id="overviewSpaces" data-tab="spaces">
643
+ <div class="overview-num space-num" id="totalSpacesNum">0</div>
644
+ <div class="overview-label"><i class="fas fa-rocket"></i> Spaces</div>
645
+ </div>
646
+ </div>
647
+ </div>
648
+
649
+ <div class="tab-bar" id="tabBar">
650
+ <button class="tab-btn active-model" data-tab="models">
651
+ <i class="fas fa-cube"></i> Models <span class="tab-count" id="tabModelCount">0</span>
652
+ </button>
653
+ <button class="tab-btn" data-tab="datasets">
654
+ <i class="fas fa-database"></i> Datasets <span class="tab-count" id="tabDatasetCount">0</span>
655
+ </button>
656
+ <button class="tab-btn" data-tab="spaces">
657
+ <i class="fas fa-rocket"></i> Spaces <span class="tab-count" id="tabSpaceCount">0</span>
658
+ </button>
659
+ </div>
660
+
661
+ <div class="stats-row" id="statsRow"></div>
662
+ <div class="filter-bar" id="filterBar"></div>
663
+
664
+ <div class="tree-wrapper" id="treeWrapper">
665
+ <div class="tree-header">
666
+ <span class="tree-title" id="treeTitle"></span>
667
+ <div style="display:flex;gap:8px;">
668
+ <button class="tool-btn action-btn" id="copyTreeBtn">
669
+ <i class="far fa-copy"></i> Copy Tree
670
+ </button>
671
+ </div>
672
+ </div>
673
+ <div class="terminal-window">
674
+ <div class="line-col" id="lineNumbers"></div>
675
+ <div class="code-col" id="treeContent"></div>
676
+ </div>
677
+ </div>
678
+ </div>
679
+
680
+ <div class="footer">
681
+ Built by <a href="https://hf.co/prithivMLmods" target="_blank" rel="noopener">prithivMLmods</a>
682
+ </div>
683
+ </div>
684
+
685
+ <script>
686
+ const HF_API = 'https://huggingface.co/api';
687
+
688
+ let state = {
689
+ username: '',
690
+ profile: null,
691
+ models: [],
692
+ datasets: [],
693
+ spaces: [],
694
+ activeTab: 'models',
695
+ activeFilter: 'downloads-alltime',
696
+ filterText: '',
697
+ };
698
+
699
+ const $ = id => document.getElementById(id);
700
+
701
+ const els = {
702
+ usernameInput: $('usernameInput'),
703
+ fetchBtn: $('fetchBtn'),
704
+ statusMsg: $('statusMsg'),
705
+ emptyState: $('emptyState'),
706
+ resultsSection: $('resultsSection'),
707
+ profileAvatar: $('profileAvatar'),
708
+ avatarLetter: $('avatarLetter'),
709
+ profileLink: $('profileLink'),
710
+ profileUsername: $('profileUsername'),
711
+ profileFullname: $('profileFullname'),
712
+ totalModelsNum: $('totalModelsNum'),
713
+ totalDatasetsNum: $('totalDatasetsNum'),
714
+ totalSpacesNum: $('totalSpacesNum'),
715
+ tabModelCount: $('tabModelCount'),
716
+ tabDatasetCount: $('tabDatasetCount'),
717
+ tabSpaceCount: $('tabSpaceCount'),
718
+ tabBar: $('tabBar'),
719
+ statsRow: $('statsRow'),
720
+ filterBar: $('filterBar'),
721
+ treeTitle: $('treeTitle'),
722
+ lineNumbers: $('lineNumbers'),
723
+ treeContent: $('treeContent'),
724
+ copyTreeBtn: $('copyTreeBtn'),
725
+ tokenSection: $('tokenSection'),
726
+ hfToken: $('hfToken'),
727
+ saveTokenBtn: $('saveTokenBtn'),
728
+ clearTokenBtn: $('clearTokenBtn'),
729
+ privateRepoBtn: $('privateRepoBtn'),
730
+ overviewModels: $('overviewModels'),
731
+ overviewDatasets: $('overviewDatasets'),
732
+ overviewSpaces: $('overviewSpaces'),
733
+ };
734
+
735
+ const FEATURED_USERS = [
736
+ 'prithivMLmods', 'TheBloke', 'merve', 'MaziyarPanahi', 'multimodalart',
737
+ 'thomwolf', 'julien-c', 'lysandre', 'osanseviero',
738
+ 'pcuenq', 'clem', 'lhoestq', 'sayakpaul', 'mlabonne', 'mradermacher',
739
+ ];
740
+
741
+ function getHeaders() {
742
+ const t = localStorage.getItem('hf_token');
743
+ const h = { Accept: 'application/json' };
744
+ if (t) h['Authorization'] = `Bearer ${t}`;
745
+ return h;
746
+ }
747
+
748
+ function formatNum(n) {
749
+ if (n == null) return '—';
750
+ if (n >= 1e9) return (n / 1e9).toFixed(1) + 'B';
751
+ if (n >= 1e6) return (n / 1e6).toFixed(1) + 'M';
752
+ if (n >= 1e3) return (n / 1e3).toFixed(1) + 'K';
753
+ return n.toLocaleString();
754
+ }
755
+
756
+ function formatNumFull(n) {
757
+ if (n == null) return '—';
758
+ return n.toLocaleString();
759
+ }
760
+
761
+ function relativeTime(d) {
762
+ if (!d) return '';
763
+ const diff = Date.now() - new Date(d).getTime();
764
+ const m = Math.floor(diff / 60000);
765
+ if (m < 1) return 'just now';
766
+ if (m < 60) return m + 'm ago';
767
+ const h = Math.floor(m / 60);
768
+ if (h < 24) return h + 'h ago';
769
+ const dy = Math.floor(h / 24);
770
+ if (dy < 7) return dy + 'd ago';
771
+ const w = Math.floor(dy / 7);
772
+ if (w < 5) return w + 'w ago';
773
+ const mo = Math.floor(dy / 30);
774
+ if (mo < 12) return mo + 'mo ago';
775
+ return Math.floor(dy / 365) + 'y ago';
776
+ }
777
+
778
+ function escapeHtml(s) {
779
+ const d = document.createElement('div');
780
+ d.textContent = s;
781
+ return d.innerHTML;
782
+ }
783
+
784
+ function showMsg(text, type) {
785
+ els.statusMsg.style.display = text ? 'block' : 'none';
786
+ els.statusMsg.innerHTML = text;
787
+ els.statusMsg.className = type || '';
788
+ }
789
+
790
+ /* downloads field = last 30 days (shown on model/dataset page as "Downloads last month") */
791
+ function getMonthlyDownloads(item) {
792
+ return item.downloads || 0;
793
+ }
794
+
795
+ /* downloadsAllTime = lifetime total (shown on settings page as "Total downloads (all time)") */
796
+ function getLifetimeDownloads(item) {
797
+ if (item.downloadsAllTime != null && item.downloadsAllTime > 0) return item.downloadsAllTime;
798
+ if (item.downloads_all_time != null && item.downloads_all_time > 0) return item.downloads_all_time;
799
+ return item.downloads || 0;
800
+ }
801
+
802
+ function getItemLikes(item) {
803
+ if (item.likes != null && typeof item.likes === 'number') return item.likes;
804
+ return 0;
805
+ }
806
+
807
+ function initTheme() {
808
+ const s = localStorage.getItem('hfstat_theme') || 'light';
809
+ document.documentElement.setAttribute('data-theme', s);
810
+ $('themeToggle').addEventListener('click', () => {
811
+ const n = document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark';
812
+ document.documentElement.setAttribute('data-theme', n);
813
+ localStorage.setItem('hfstat_theme', n);
814
+ });
815
+ }
816
+
817
+ function checkToken() {
818
+ const t = localStorage.getItem('hf_token');
819
+ if (t) {
820
+ els.hfToken.value = t;
821
+ els.privateRepoBtn.innerHTML = '<i class="fas fa-lock-open"></i> Active';
822
+ els.privateRepoBtn.style.color = 'var(--accent)';
823
+ els.saveTokenBtn.classList.add('hidden');
824
+ els.clearTokenBtn.classList.remove('hidden');
825
+ } else {
826
+ els.privateRepoBtn.innerHTML = '<i class="fas fa-lock"></i> Token';
827
+ els.privateRepoBtn.style.color = '';
828
+ els.saveTokenBtn.classList.remove('hidden');
829
+ els.clearTokenBtn.classList.add('hidden');
830
+ }
831
+ }
832
+
833
+ async function fetchAllPages(url) {
834
+ let all = [], nextUrl = url;
835
+ const headers = getHeaders();
836
+ while (nextUrl) {
837
+ const resp = await fetch(nextUrl, { headers });
838
+ if (!resp.ok) {
839
+ if (all.length > 0) break;
840
+ throw new Error(`HTTP ${resp.status}`);
841
+ }
842
+ const items = await resp.json();
843
+ if (!Array.isArray(items) || items.length === 0) break;
844
+ all = all.concat(items);
845
+ nextUrl = null;
846
+ const link = resp.headers.get('Link');
847
+ if (link) {
848
+ const m = link.match(/<([^>]+)>;\s*rel="next"/);
849
+ if (m) nextUrl = m[1];
850
+ }
851
+ }
852
+ return all;
853
+ }
854
+
855
+ async function fetchProfile(username) {
856
+ const headers = getHeaders();
857
+ try {
858
+ const resp = await fetch(`${HF_API}/users/${encodeURIComponent(username)}/overview`, { headers });
859
+ if (resp.ok) return await resp.json();
860
+ } catch (e) {}
861
+ return null;
862
+ }
863
+
864
+ async function fetchItemDetail(itemId, type) {
865
+ const headers = getHeaders();
866
+ try {
867
+ let url;
868
+ if (type === 'models') {
869
+ url = `${HF_API}/models/${encodeURIComponent(itemId)}`;
870
+ } else {
871
+ url = `${HF_API}/datasets/${encodeURIComponent(itemId)}`;
872
+ }
873
+ const resp = await fetch(url, { headers });
874
+ if (resp.ok) {
875
+ return await resp.json();
876
+ }
877
+ } catch (e) {}
878
+ return null;
879
+ }
880
+
881
+ async function fetchUserStats() {
882
+ const username = els.usernameInput.value.trim().replace(/^@/, '').replace(/\/$/, '');
883
+ if (!username) return showMsg("Please enter a username.", "error");
884
+
885
+ state.username = username;
886
+ state.filterText = '';
887
+ els.emptyState.classList.add('hidden');
888
+ els.resultsSection.classList.add('hidden');
889
+ els.fetchBtn.disabled = true;
890
+ showMsg(`<span class="spinner"></span> Fetching stats for <b>${escapeHtml(username)}</b>…`, 'loading');
891
+
892
+ try {
893
+ const uEnc = encodeURIComponent(username);
894
+
895
+ const expandParams = 'expand[]=downloadsAllTime&expand[]=downloads&expand[]=likes&expand[]=lastModified&expand[]=createdAt';
896
+
897
+ const [profileData, models, datasets, spaces] = await Promise.allSettled([
898
+ fetchProfile(username),
899
+ fetchAllPages(`${HF_API}/models?author=${uEnc}&limit=1000&full=true&${expandParams}`),
900
+ fetchAllPages(`${HF_API}/datasets?author=${uEnc}&limit=1000&full=true&${expandParams}`),
901
+ fetchAllPages(`${HF_API}/spaces?author=${uEnc}&limit=1000&full=true&expand[]=likes`),
902
+ ]);
903
+
904
+ state.profile = profileData.status === 'fulfilled' ? profileData.value : null;
905
+ state.models = models.status === 'fulfilled' ? models.value : [];
906
+ state.datasets = datasets.status === 'fulfilled' ? datasets.value : [];
907
+ state.spaces = spaces.status === 'fulfilled' ? spaces.value : [];
908
+
909
+ if (state.models.length > 0) {
910
+ const sample = state.models[0];
911
+ console.log('[HF-Stats] Sample model:', {
912
+ id: sample.id,
913
+ likes: sample.likes,
914
+ downloads: sample.downloads,
915
+ downloadsAllTime: sample.downloadsAllTime,
916
+ keys: Object.keys(sample)
917
+ });
918
+ }
919
+ if (state.datasets.length > 0) {
920
+ const sample = state.datasets[0];
921
+ console.log('[HF-Stats] Sample dataset:', {
922
+ id: sample.id,
923
+ likes: sample.likes,
924
+ downloads: sample.downloads,
925
+ downloadsAllTime: sample.downloadsAllTime,
926
+ keys: Object.keys(sample)
927
+ });
928
+ }
929
+
930
+ if (!state.models.length && !state.datasets.length && !state.spaces.length && !state.profile) {
931
+ showMsg(`No data found for <b>${escapeHtml(username)}</b>. Check the name or add a token.`, 'error');
932
+ els.emptyState.classList.remove('hidden');
933
+ return;
934
+ }
935
+
936
+ /* Fallback: if likes are all zero, fetch individually */
937
+ const modelsNeedLikes = state.models.length > 0 && state.models.every(m => getItemLikes(m) === 0);
938
+ const datasetsNeedLikes = state.datasets.length > 0 && state.datasets.every(d => getItemLikes(d) === 0);
939
+
940
+ if (modelsNeedLikes || datasetsNeedLikes) {
941
+ showMsg(`<span class="spinner"></span> Fetching detailed stats for <b>${escapeHtml(username)}</b>���`, 'loading');
942
+
943
+ if (modelsNeedLikes) {
944
+ console.log('[HF-Stats] Likes missing from list API, fetching individually for models...');
945
+ const batchSize = 10;
946
+ for (let i = 0; i < state.models.length; i += batchSize) {
947
+ const batch = state.models.slice(i, i + batchSize);
948
+ const results = await Promise.allSettled(
949
+ batch.map(m => fetchItemDetail(m.id || m.modelId, 'models'))
950
+ );
951
+ results.forEach((r, j) => {
952
+ if (r.status === 'fulfilled' && r.value) {
953
+ const d = r.value;
954
+ state.models[i + j].likes = d.likes || 0;
955
+ if (d.downloads != null) state.models[i + j].downloads = d.downloads;
956
+ if (d.downloadsAllTime != null) state.models[i + j].downloadsAllTime = d.downloadsAllTime;
957
+ }
958
+ });
959
+ }
960
+ }
961
+
962
+ if (datasetsNeedLikes) {
963
+ console.log('[HF-Stats] Likes missing from list API, fetching individually for datasets...');
964
+ const batchSize = 10;
965
+ for (let i = 0; i < state.datasets.length; i += batchSize) {
966
+ const batch = state.datasets.slice(i, i + batchSize);
967
+ const results = await Promise.allSettled(
968
+ batch.map(d => fetchItemDetail(d.id, 'datasets'))
969
+ );
970
+ results.forEach((r, j) => {
971
+ if (r.status === 'fulfilled' && r.value) {
972
+ const d = r.value;
973
+ state.datasets[i + j].likes = d.likes || 0;
974
+ if (d.downloads != null) state.datasets[i + j].downloads = d.downloads;
975
+ if (d.downloadsAllTime != null) state.datasets[i + j].downloadsAllTime = d.downloadsAllTime;
976
+ }
977
+ });
978
+ }
979
+ }
980
+ }
981
+
982
+ showMsg('', '');
983
+ window.location.hash = username;
984
+ document.title = `${username} — HF User Stats`;
985
+
986
+ renderProfile();
987
+ renderOverview();
988
+ setActiveTab('models');
989
+ els.resultsSection.classList.remove('hidden');
990
+
991
+ } catch (err) {
992
+ console.error(err);
993
+ showMsg(`Error: ${err.message}`, 'error');
994
+ els.emptyState.classList.remove('hidden');
995
+ } finally {
996
+ els.fetchBtn.disabled = false;
997
+ }
998
+ }
999
+
1000
+ function renderProfile() {
1001
+ const u = state.username;
1002
+ const p = state.profile;
1003
+
1004
+ const avatarUrl = p?.avatarUrl;
1005
+ if (avatarUrl) {
1006
+ const full = avatarUrl.startsWith('http') ? avatarUrl : `https://huggingface.co${avatarUrl}`;
1007
+ els.profileAvatar.innerHTML = `<img src="${full}" alt="${escapeHtml(u)}" onerror="this.parentElement.innerHTML='<span class=\\'avatar-letter\\'>${u[0].toUpperCase()}</span>'">`;
1008
+ } else {
1009
+ els.profileAvatar.innerHTML = `<span class="avatar-letter">${u[0].toUpperCase()}</span>`;
1010
+ }
1011
+
1012
+ els.profileUsername.textContent = u;
1013
+ els.profileLink.href = `https://huggingface.co/${u}`;
1014
+
1015
+ const fullname = p?.fullname || p?.name || '';
1016
+ els.profileFullname.textContent = fullname;
1017
+ els.profileFullname.style.display = fullname ? 'block' : 'none';
1018
+ }
1019
+
1020
+ function renderOverview() {
1021
+ els.totalModelsNum.textContent = state.models.length;
1022
+ els.totalDatasetsNum.textContent = state.datasets.length;
1023
+ els.totalSpacesNum.textContent = state.spaces.length;
1024
+ els.tabModelCount.textContent = state.models.length;
1025
+ els.tabDatasetCount.textContent = state.datasets.length;
1026
+ els.tabSpaceCount.textContent = state.spaces.length;
1027
+ }
1028
+
1029
+ function setActiveTab(tab) {
1030
+ state.activeTab = tab;
1031
+ state.activeFilter = (tab === 'spaces') ? 'likes' : 'downloads-alltime';
1032
+ state.filterText = '';
1033
+
1034
+ els.tabBar.querySelectorAll('.tab-btn').forEach(btn => {
1035
+ btn.className = 'tab-btn';
1036
+ if (btn.dataset.tab === tab) {
1037
+ if (tab === 'models') btn.classList.add('active-model');
1038
+ else if (tab === 'datasets') btn.classList.add('active-dataset');
1039
+ else btn.classList.add('active-space');
1040
+ }
1041
+ });
1042
+
1043
+ [els.overviewModels, els.overviewDatasets, els.overviewSpaces].forEach(c => c.classList.remove('active-card'));
1044
+ if (tab === 'models') els.overviewModels.classList.add('active-card');
1045
+ else if (tab === 'datasets') els.overviewDatasets.classList.add('active-card');
1046
+ else els.overviewSpaces.classList.add('active-card');
1047
+
1048
+ renderStats();
1049
+ renderFilters();
1050
+ renderTree();
1051
+ }
1052
+
1053
+ function renderStats() {
1054
+ const tab = state.activeTab;
1055
+ const items = tab === 'models' ? state.models : tab === 'datasets' ? state.datasets : state.spaces;
1056
+ const totalDlAllTime = items.reduce((s, i) => s + getLifetimeDownloads(i), 0);
1057
+ const totalDlMonthly = items.reduce((s, i) => s + getMonthlyDownloads(i), 0);
1058
+ const totalLk = items.reduce((s, i) => s + getItemLikes(i), 0);
1059
+ const icon = tab === 'models' ? 'fa-cube' : tab === 'datasets' ? 'fa-database' : 'fa-rocket';
1060
+
1061
+ let html = `
1062
+ <div class="stat-card">
1063
+ <div class="stat-icon count-icon"><i class="fas ${icon}"></i></div>
1064
+ <div>
1065
+ <div class="stat-value">${formatNum(items.length)}</div>
1066
+ <div class="stat-label">Total ${tab}</div>
1067
+ </div>
1068
+ </div>`;
1069
+
1070
+ if (tab !== 'spaces') {
1071
+ html += `
1072
+ <div class="stat-card">
1073
+ <div class="stat-icon dl-icon"><i class="fas fa-download"></i></div>
1074
+ <div>
1075
+ <div class="stat-value" title="${formatNumFull(totalDlAllTime)} all-time downloads">${formatNum(totalDlAllTime)}</div>
1076
+ <div class="stat-label">Downloads (All Time)</div>
1077
+ </div>
1078
+ </div>
1079
+ <div class="stat-card">
1080
+ <div class="stat-icon monthly-icon"><i class="fas fa-calendar-alt"></i></div>
1081
+ <div>
1082
+ <div class="stat-value" title="${formatNumFull(totalDlMonthly)} downloads last month">${formatNum(totalDlMonthly)}</div>
1083
+ <div class="stat-label">Downloads (Last Month)</div>
1084
+ </div>
1085
+ </div>`;
1086
+ }
1087
+
1088
+ html += `
1089
+ <div class="stat-card">
1090
+ <div class="stat-icon like-icon"><i class="fas fa-heart"></i></div>
1091
+ <div>
1092
+ <div class="stat-value" title="${formatNumFull(totalLk)} total likes">${formatNum(totalLk)}</div>
1093
+ <div class="stat-label">Total Likes</div>
1094
+ </div>
1095
+ </div>`;
1096
+
1097
+ els.statsRow.innerHTML = html;
1098
+ }
1099
+
1100
+ function renderFilters() {
1101
+ const tab = state.activeTab;
1102
+ let filters;
1103
+
1104
+ if (tab === 'models' || tab === 'datasets') {
1105
+ filters = [
1106
+ { key: 'downloads-alltime', label: 'Downloads (All Time)', icon: 'fa-download' },
1107
+ { key: 'downloads-monthly', label: 'Downloads (Last Month)', icon: 'fa-calendar-alt' },
1108
+ { key: 'likes', label: 'Most Liked', icon: 'fa-heart' },
1109
+ { key: 'recent', label: 'Most Recent', icon: 'fa-clock' },
1110
+ ];
1111
+ } else {
1112
+ filters = [
1113
+ { key: 'likes', label: 'Most Liked', icon: 'fa-heart' },
1114
+ { key: 'least-likes', label: 'Least Liked', icon: 'fa-heart-crack' },
1115
+ ];
1116
+ }
1117
+
1118
+ let html = '<span class="filter-label"><i class="fas fa-filter"></i> Sort:</span>';
1119
+ for (const f of filters) {
1120
+ html += `<button class="filter-pill ${state.activeFilter === f.key ? 'active' : ''}" data-filter="${f.key}">
1121
+ <i class="fas ${f.icon}"></i> ${f.label}
1122
+ </button>`;
1123
+ }
1124
+ html += `
1125
+ <div class="filter-search">
1126
+ <i class="fas fa-search"></i>
1127
+ <input type="text" id="treeFilter" placeholder="Filter by name…" value="${escapeHtml(state.filterText)}">
1128
+ </div>`;
1129
+
1130
+ els.filterBar.innerHTML = html;
1131
+
1132
+ els.filterBar.querySelectorAll('.filter-pill').forEach(btn => {
1133
+ btn.addEventListener('click', () => {
1134
+ state.activeFilter = btn.dataset.filter;
1135
+ renderFilters();
1136
+ renderTree();
1137
+ });
1138
+ });
1139
+
1140
+ const fi = $('treeFilter');
1141
+ if (fi) fi.addEventListener('input', e => { state.filterText = e.target.value.trim().toLowerCase(); renderTree(); });
1142
+ }
1143
+
1144
+ function getSortedItems() {
1145
+ const tab = state.activeTab;
1146
+ let items = [...(tab === 'models' ? state.models : tab === 'datasets' ? state.datasets : state.spaces)];
1147
+
1148
+ if (state.filterText) {
1149
+ items = items.filter(i => (i.id || i.modelId || '').toLowerCase().includes(state.filterText));
1150
+ }
1151
+
1152
+ items.sort((a, b) => {
1153
+ switch (state.activeFilter) {
1154
+ case 'downloads-alltime': return getLifetimeDownloads(b) - getLifetimeDownloads(a);
1155
+ case 'downloads-monthly': return getMonthlyDownloads(b) - getMonthlyDownloads(a);
1156
+ case 'likes': return getItemLikes(b) - getItemLikes(a);
1157
+ case 'least-likes': return getItemLikes(a) - getItemLikes(b);
1158
+ case 'recent': return new Date(b.lastModified || b.createdAt || 0) - new Date(a.lastModified || a.createdAt || 0);
1159
+ default: return 0;
1160
+ }
1161
+ });
1162
+ return items;
1163
+ }
1164
+
1165
+ function getItemIcon(item, tab) {
1166
+ if (tab === 'models') {
1167
+ const p = item.pipeline_tag || '';
1168
+ const m = {
1169
+ 'text-generation':'fa-solid fa-message','text2text-generation':'fa-solid fa-language',
1170
+ 'text-classification':'fa-solid fa-tags','token-classification':'fa-solid fa-font',
1171
+ 'question-answering':'fa-solid fa-circle-question','fill-mask':'fa-solid fa-mask',
1172
+ 'summarization':'fa-solid fa-compress','translation':'fa-solid fa-globe',
1173
+ 'conversational':'fa-solid fa-comments','image-classification':'fa-solid fa-image',
1174
+ 'object-detection':'fa-solid fa-vector-square','image-segmentation':'fa-solid fa-puzzle-piece',
1175
+ 'text-to-image':'fa-solid fa-wand-magic-sparkles','image-to-text':'fa-solid fa-file-lines',
1176
+ 'automatic-speech-recognition':'fa-solid fa-microphone','text-to-speech':'fa-solid fa-volume-high',
1177
+ 'audio-classification':'fa-solid fa-music','feature-extraction':'fa-solid fa-layer-group',
1178
+ 'sentence-similarity':'fa-solid fa-arrows-left-right','reinforcement-learning':'fa-solid fa-gamepad',
1179
+ 'image-to-image':'fa-solid fa-images','video-classification':'fa-solid fa-film',
1180
+ 'depth-estimation':'fa-solid fa-mountain','zero-shot-classification':'fa-solid fa-bullseye',
1181
+ };
1182
+ return m[p] || 'fa-solid fa-cube';
1183
+ }
1184
+ if (tab === 'datasets') return 'fa-solid fa-database';
1185
+ return 'fa-solid fa-rocket';
1186
+ }
1187
+
1188
+ function getItemName(item) {
1189
+ const id = item.id || item.modelId || '';
1190
+ const parts = id.split('/');
1191
+ return parts.length > 1 ? parts.slice(1).join('/') : id;
1192
+ }
1193
+
1194
+ function getItemUrl(item, tab) {
1195
+ const id = item.id || item.modelId || '';
1196
+ if (tab === 'datasets') return `https://huggingface.co/datasets/${id}`;
1197
+ if (tab === 'spaces') return `https://huggingface.co/spaces/${id}`;
1198
+ return `https://huggingface.co/${id}`;
1199
+ }
1200
+
1201
+ function getItemColor(tab) {
1202
+ if (tab === 'models') return 'var(--model-color)';
1203
+ if (tab === 'datasets') return 'var(--dataset-color)';
1204
+ return 'var(--space-color)';
1205
+ }
1206
+
1207
+ function renderTree() {
1208
+ const tab = state.activeTab;
1209
+ const items = getSortedItems();
1210
+ const tabLabel = tab.charAt(0).toUpperCase() + tab.slice(1);
1211
+
1212
+ els.treeTitle.textContent = `${state.username} / ${tabLabel} (${items.length})`;
1213
+ els.lineNumbers.innerHTML = '';
1214
+ els.treeContent.innerHTML = '';
1215
+
1216
+ if (items.length === 0) {
1217
+ els.treeContent.innerHTML = `<div class="no-data"><i class="fas fa-inbox"></i>No ${tab} found.</div>`;
1218
+ return;
1219
+ }
1220
+
1221
+ const fragL = document.createDocumentFragment();
1222
+ const fragT = document.createDocumentFragment();
1223
+
1224
+ const rL = document.createElement('div'); rL.textContent = '1'; fragL.appendChild(rL);
1225
+ const rR = document.createElement('div');
1226
+ rR.className = 'tree-line'; rR.style.fontWeight = '700';
1227
+ const ri = tab === 'models' ? 'fa-cube' : tab === 'datasets' ? 'fa-database' : 'fa-rocket';
1228
+ rR.innerHTML = `<span class="t-icon" style="color:${getItemColor(tab)};"><i class="fas ${ri}"></i></span><span class="t-name" style="color:${getItemColor(tab)};">${escapeHtml(state.username)} — ${items.length} ${tabLabel}</span>`;
1229
+ fragT.appendChild(rR);
1230
+
1231
+ items.forEach((item, idx) => {
1232
+ const lN = document.createElement('div'); lN.textContent = idx + 2; fragL.appendChild(lN);
1233
+
1234
+ const row = document.createElement('div');
1235
+ row.className = 'tree-line';
1236
+ row.style.animation = `fadeIn 0.12s forwards ${Math.min(idx * 6, 600)}ms`;
1237
+ row.style.opacity = '0';
1238
+
1239
+ const isLast = idx === items.length - 1;
1240
+ const conn = isLast ? '└── ' : '├── ';
1241
+ const icon = getItemIcon(item, tab);
1242
+ const name = getItemName(item);
1243
+ const url = getItemUrl(item, tab);
1244
+ const fullId = item.id || item.modelId || '';
1245
+
1246
+ let nameHtml = escapeHtml(name);
1247
+ if (state.filterText && name.toLowerCase().includes(state.filterText)) {
1248
+ const rx = new RegExp(`(${state.filterText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`, 'gi');
1249
+ nameHtml = name.replace(rx, '<mark style="background:var(--accent-light);color:var(--accent);padding:0 2px;border-radius:2px;">$1</mark>');
1250
+ }
1251
+
1252
+ let meta = '';
1253
+ if (tab !== 'spaces') {
1254
+ const dlAll = getLifetimeDownloads(item);
1255
+ const dlMonth = getMonthlyDownloads(item);
1256
+ meta += `<span class="t-stat dl-stat" title="${formatNumFull(dlAll)} downloads (all time)"><i class="fas fa-download"></i> ${formatNum(dlAll)}</span>`;
1257
+ meta += `<span class="t-stat monthly-stat" title="${formatNumFull(dlMonth)} downloads (last month)"><i class="fas fa-calendar-alt"></i> ${formatNum(dlMonth)}</span>`;
1258
+ }
1259
+ const likes = getItemLikes(item);
1260
+ meta += `<span class="t-stat like-stat" title="${formatNumFull(likes)} likes"><i class="fas fa-heart"></i> ${formatNum(likes)}</span>`;
1261
+ if (item.lastModified) {
1262
+ meta += `<span class="t-stat date-stat" title="${new Date(item.lastModified).toLocaleDateString()}"><i class="far fa-clock"></i> ${relativeTime(item.lastModified)}</span>`;
1263
+ }
1264
+
1265
+ row.innerHTML = `
1266
+ <span class="t-prefix">${conn}</span>
1267
+ <span class="t-icon" style="color:${getItemColor(tab)};"><i class="${icon}"></i></span>
1268
+ <span class="t-name"><a href="${url}" target="_blank" rel="noopener" title="${escapeHtml(fullId)}">${nameHtml}</a></span>
1269
+ <span class="t-meta">
1270
+ ${meta}
1271
+ <button class="t-copy" data-id="${escapeHtml(fullId)}" title="Copy ID"><i class="far fa-copy"></i></button>
1272
+ </span>`;
1273
+ fragT.appendChild(row);
1274
+ });
1275
+
1276
+ els.lineNumbers.appendChild(fragL);
1277
+ els.treeContent.appendChild(fragT);
1278
+
1279
+ els.treeContent.onclick = function(e) {
1280
+ const btn = e.target.closest('.t-copy');
1281
+ if (!btn) return;
1282
+ navigator.clipboard.writeText(btn.dataset.id).then(() => {
1283
+ const ic = btn.querySelector('i');
1284
+ const orig = ic.className;
1285
+ ic.className = 'fas fa-check'; ic.style.color = '#22c55e';
1286
+ setTimeout(() => { ic.className = orig; ic.style.color = ''; }, 1500);
1287
+ });
1288
+ };
1289
+ }
1290
+
1291
+ function copyFullTree() {
1292
+ const tab = state.activeTab;
1293
+ const items = getSortedItems();
1294
+ const tabLabel = tab.charAt(0).toUpperCase() + tab.slice(1);
1295
+ const lines = [`${state.username} — ${items.length} ${tabLabel}`];
1296
+
1297
+ items.forEach((item, idx) => {
1298
+ const conn = idx === items.length - 1 ? '└── ' : '├── ';
1299
+ const name = getItemName(item);
1300
+ let meta = '';
1301
+ if (tab !== 'spaces') {
1302
+ meta += ` ↓${formatNum(getLifetimeDownloads(item))} all`;
1303
+ meta += ` ↓${formatNum(getMonthlyDownloads(item))} /mo`;
1304
+ }
1305
+ meta += ` ♥${formatNum(getItemLikes(item))}`;
1306
+ lines.push(`${conn}${name} (${meta.trim()})`);
1307
+ });
1308
+
1309
+ const totalDlAll = items.reduce((s, i) => s + getLifetimeDownloads(i), 0);
1310
+ const totalDlMonth = items.reduce((s, i) => s + getMonthlyDownloads(i), 0);
1311
+ const totalLk = items.reduce((s, i) => s + getItemLikes(i), 0);
1312
+ lines.push('');
1313
+ if (tab !== 'spaces') {
1314
+ lines.push(`Total Downloads (All Time): ${formatNumFull(totalDlAll)}`);
1315
+ lines.push(`Total Downloads (Last Month): ${formatNumFull(totalDlMonth)}`);
1316
+ }
1317
+ lines.push(`Total Likes: ${formatNumFull(totalLk)}`);
1318
+
1319
+ navigator.clipboard.writeText(lines.join('\n')).then(() => {
1320
+ const orig = els.copyTreeBtn.innerHTML;
1321
+ els.copyTreeBtn.innerHTML = '<i class="fas fa-check"></i> Copied!';
1322
+ setTimeout(() => { els.copyTreeBtn.innerHTML = orig; }, 1800);
1323
+ });
1324
+ }
1325
+
1326
+ function buildHomepage() {
1327
+ const c = $('featuredUsers');
1328
+ FEATURED_USERS.forEach(u => {
1329
+ const btn = document.createElement('button');
1330
+ btn.className = 'user-tag';
1331
+ btn.innerHTML = `<i class="fas fa-user"></i> ${u}`;
1332
+ btn.addEventListener('click', () => { els.usernameInput.value = u; fetchUserStats(); });
1333
+ c.appendChild(btn);
1334
+ });
1335
+ }
1336
+
1337
+ function parseHash() {
1338
+ const h = window.location.hash;
1339
+ if (h && h.length > 1) {
1340
+ const u = decodeURIComponent(h.substring(1));
1341
+ if (u) { els.usernameInput.value = u; fetchUserStats(); }
1342
+ }
1343
+ }
1344
+
1345
+ document.addEventListener('DOMContentLoaded', () => {
1346
+ initTheme();
1347
+ checkToken();
1348
+ buildHomepage();
1349
+
1350
+ els.privateRepoBtn.addEventListener('click', () => els.tokenSection.classList.toggle('hidden'));
1351
+
1352
+ els.saveTokenBtn.addEventListener('click', () => {
1353
+ const t = els.hfToken.value.trim();
1354
+ if (!t) return;
1355
+ localStorage.setItem('hf_token', t);
1356
+ checkToken();
1357
+ showMsg('Token saved.', 'loading');
1358
+ setTimeout(() => showMsg('', ''), 1500);
1359
+ });
1360
+
1361
+ els.clearTokenBtn.addEventListener('click', () => {
1362
+ localStorage.removeItem('hf_token');
1363
+ els.hfToken.value = '';
1364
+ checkToken();
1365
+ showMsg('Token cleared.', 'loading');
1366
+ setTimeout(() => showMsg('', ''), 1500);
1367
+ });
1368
+
1369
+ els.hfToken.addEventListener('keypress', e => { if (e.key === 'Enter') els.saveTokenBtn.click(); });
1370
+ els.fetchBtn.addEventListener('click', fetchUserStats);
1371
+ els.usernameInput.addEventListener('keypress', e => { if (e.key === 'Enter') fetchUserStats(); });
1372
+
1373
+ els.tabBar.querySelectorAll('.tab-btn').forEach(btn =>
1374
+ btn.addEventListener('click', () => setActiveTab(btn.dataset.tab))
1375
+ );
1376
+
1377
+ [els.overviewModels, els.overviewDatasets, els.overviewSpaces].forEach(card =>
1378
+ card.addEventListener('click', () => setActiveTab(card.dataset.tab))
1379
+ );
1380
+
1381
+ els.copyTreeBtn.addEventListener('click', copyFullTree);
1382
+ parseHash();
1383
+ });
1384
+ </script>
1385
+ </body>
1386
+ </html>
package.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "hftree",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "react": "19.0.0",
13
+ "react-dom": "19.0.0",
14
+ "lucide-react": "0.474.0"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^22.14.0",
18
+ "@vitejs/plugin-react": "^5.0.0",
19
+ "typescript": "~5.8.2",
20
+ "vite": "^6.2.0"
21
+ }
22
+ }
tsconfig.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "experimentalDecorators": true,
5
+ "useDefineForClassFields": false,
6
+ "module": "ESNext",
7
+ "lib": [
8
+ "ES2022",
9
+ "DOM",
10
+ "DOM.Iterable"
11
+ ],
12
+ "skipLibCheck": true,
13
+ "types": [
14
+ "node"
15
+ ],
16
+ "moduleResolution": "bundler",
17
+ "isolatedModules": true,
18
+ "moduleDetection": "force",
19
+ "allowJs": true,
20
+ "jsx": "react-jsx",
21
+ "paths": {
22
+ "@/*": [
23
+ "./*"
24
+ ]
25
+ },
26
+ "allowImportingTsExtensions": true,
27
+ "noEmit": true
28
+ }
29
+ }
vite.config.ts ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import path from 'path';
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+
5
+ export default defineConfig({
6
+ server: {
7
+ port: 7860,
8
+ host: '0.0.0.0',
9
+ },
10
+ plugins: [react()],
11
+ resolve: {
12
+ alias: {
13
+ '@': path.resolve(__dirname, '.'),
14
+ }
15
+ }
16
+ });