File size: 11,495 Bytes
5a81b95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import {
  BarChart3,
  PieChart,
  LineChart,
  Activity,
  Table,
  Target,
  Map,
  TrendingUp,
  Grid3X3,
  LayoutDashboard,
  Filter,
  Share2
} from 'lucide-react';

const rand = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1)) + min;

export const MiniBarChart = () => (
  <div className="flex items-end justify-around h-full gap-1 pb-2">
    {[60, 80, 45, 90, 70, 55, 85].map((h, i) => (
      <div
        key={i}
        className="flex-1 bg-gradient-to-t from-primary to-primary/30 rounded-t animate-pulse"
        style={{ height: `${h}%`, animationDelay: `${i * 0.1}s` }}
      />
    ))}
  </div>
);

export const MiniPieChart = () => (
  <div className="h-full flex items-center justify-center">
    <div className="relative w-16 h-16">
      <svg viewBox="0 0 36 36" className="w-full h-full -rotate-90">
        <circle
          cx="18"
          cy="18"
          r="15.9"
          fill="none"
          stroke="hsl(var(--secondary))"
          strokeWidth="3"
        />
        <circle
          cx="18"
          cy="18"
          r="15.9"
          fill="none"
          stroke="hsl(var(--primary))"
          strokeWidth="3"
          strokeDasharray="75 25"
          className="animate-pulse"
        />
        <circle
          cx="18"
          cy="18"
          r="15.9"
          fill="none"
          stroke="hsl(var(--accent))"
          strokeWidth="3"
          strokeDasharray="25 75"
          strokeDashoffset="-75"
        />
      </svg>
      <div className="absolute inset-0 flex items-center justify-center text-[10px] font-mono text-primary">
        75%
      </div>
    </div>
  </div>
);

export const MiniLineChart = () => (
  <div className="h-full flex items-end p-2">
    <svg viewBox="0 0 100 40" className="w-full h-full">
      <path
        d="M0,35 L15,28 L30,32 L45,15 L60,20 L75,8 L100,12"
        fill="none"
        stroke="hsl(var(--primary))"
        strokeWidth="2"
        className="animate-pulse"
      />
      <path
        d="M0,35 L15,28 L30,32 L45,15 L60,20 L75,8 L100,12 L100,40 L0,40 Z"
        fill="url(#gradient)"
        opacity="0.3"
      />
      <defs>
        <linearGradient id="gradient" x1="0%" y1="0%" x2="0%" y2="100%">
          <stop offset="0%" stopColor="hsl(var(--primary))" />
          <stop offset="100%" stopColor="transparent" />
        </linearGradient>
      </defs>
    </svg>
  </div>
);

export const MiniActivity = () => (
  <div className="h-full flex items-center justify-center gap-0.5">
    {[...Array(20)].map((_, i) => (
      <div
        key={i}
        className="w-1 bg-primary rounded-full animate-pulse"
        style={{
          height: `${Math.random() * 60 + 20}%`,
          animationDelay: `${i * 0.05}s`,
        }}
      />
    ))}
  </div>
);

export const MiniTable = () => (
  <div className="h-full flex flex-col text-[7px] font-mono">
    <div className="flex border-b border-primary/30 pb-1 mb-1">
      <span className="flex-1 text-primary">ID</span>
      <span className="flex-1 text-primary">STATUS</span>
      <span className="flex-1 text-primary">VAL</span>
    </div>
    {[...Array(4)].map((_, i) => (
      <div key={i} className="flex py-0.5 text-muted-foreground">
        <span className="flex-1">#{String(i + 1).padStart(3, '0')}</span>
        <span className="flex-1 text-green-400"></span>
        <span className="flex-1">{Math.floor(Math.random() * 100)}</span>
      </div>
    ))}
  </div>
);

export const MiniGauge = () => (
  <div className="h-full flex items-center justify-center">
    <div className="relative w-16 h-10 overflow-hidden">
      <div className="absolute inset-0 border-4 border-b-0 border-primary/30 rounded-t-full" />
      <div
        className="absolute inset-0 border-4 border-b-0 border-primary rounded-t-full animate-pulse"
        style={{ clipPath: 'polygon(0 100%, 0 0, 75% 0, 75% 100%)' }}
      />
      <div className="absolute bottom-0 left-1/2 w-0.5 h-8 bg-accent origin-bottom -translate-x-1/2 rotate-[30deg]" />
      <div className="absolute bottom-0 left-1/2 text-[8px] font-mono text-primary -translate-x-1/2">
        75%
      </div>
    </div>
  </div>
);

export const MiniMap = () => (
  <div className="h-full bg-secondary/30 rounded relative overflow-hidden">
    <div className="absolute inset-0 grid grid-cols-4 grid-rows-4 gap-px opacity-30">
      {[...Array(16)].map((_, i) => (
        <div key={i} className="border border-primary/20" />
      ))}
    </div>
    <div className="absolute top-1/3 left-1/2 w-2 h-2 bg-accent rounded-full animate-ping" />
    <div className="absolute top-1/3 left-1/2 w-2 h-2 bg-accent rounded-full" />
    <div className="absolute top-1/2 left-1/4 w-1.5 h-1.5 bg-primary rounded-full" />
    <div className="absolute top-2/3 left-3/4 w-1.5 h-1.5 bg-primary rounded-full" />
  </div>
);

export const MiniProgress = () => (
  <div className="h-full flex flex-col justify-center gap-3">
    <div className="text-center">
      <div className="text-2xl font-mono text-primary animate-pulse">87%</div>
      <div className="text-[8px] text-muted-foreground">PROGRESS</div>
    </div>
    <div className="h-2 bg-secondary rounded-full overflow-hidden">
      <div className="h-full w-[87%] bg-gradient-to-r from-primary via-accent to-primary animate-pulse rounded-full" />
    </div>
  </div>
);

export const MiniHeatmap = () => (
  <div className="h-full grid grid-cols-7 gap-0.5 p-1">
    {[...Array(35)].map((_, i) => (
      <div
        key={i}
        className="rounded-sm"
        style={{
          backgroundColor: `hsl(var(--primary) / ${Math.random() * 0.8 + 0.1})`,
        }}
      />
    ))}
  </div>
);

export const MiniTreemap = () => (
  <div className="h-full grid grid-cols-3 grid-rows-2 gap-0.5">
    <div className="col-span-2 bg-primary/60 rounded flex items-center justify-center text-[8px]">
      45%
    </div>
    <div className="bg-primary/40 rounded flex items-center justify-center text-[7px]">20%</div>
    <div className="bg-primary/30 rounded flex items-center justify-center text-[7px]">15%</div>
    <div className="bg-primary/20 rounded flex items-center justify-center text-[6px]">12%</div>
    <div className="bg-primary/10 rounded flex items-center justify-center text-[6px]">8%</div>
  </div>
);

export const MiniRadar = () => (
  <div className="h-full flex items-center justify-center">
    <svg viewBox="0 0 100 100" className="w-16 h-16">
      <polygon
        points="50,10 90,30 80,80 20,80 10,30"
        fill="none"
        stroke="hsl(var(--secondary))"
        strokeWidth="1"
      />
      <polygon
        points="50,25 75,37 70,65 30,65 25,37"
        fill="none"
        stroke="hsl(var(--secondary))"
        strokeWidth="1"
      />
      <polygon
        points="50,40 60,45 57,55 43,55 40,45"
        fill="none"
        stroke="hsl(var(--secondary))"
        strokeWidth="1"
      />
      <polygon
        points="50,20 80,35 72,72 28,72 20,35"
        fill="hsl(var(--primary) / 0.3)"
        stroke="hsl(var(--primary))"
        strokeWidth="2"
        className="animate-pulse"
      />
    </svg>
  </div>
);

export const MiniFunnel = () => (
  <div className="h-full flex flex-col justify-center gap-1 px-2">
    {[
      { label: 'Visitors', width: '100%', value: '10K' },
      { label: 'Signups', width: '60%', value: '6K' },
      { label: 'Active', width: '35%', value: '3.5K' },
      { label: 'Paid', width: '15%', value: '1.5K' },
    ].map(({ label, width, value }) => (
      <div key={label} className="flex items-center gap-2">
        <div className="flex-1 h-3 bg-secondary/30 rounded overflow-hidden">
          <div className="h-full bg-gradient-to-r from-primary to-accent" style={{ width }} />
        </div>
        <span className="text-[6px] text-muted-foreground w-8">{value}</span>
      </div>
    ))}
  </div>
);

export const MiniSankey = () => (
  <div className="h-full flex items-center justify-center">
    <svg viewBox="0 0 100 60" className="w-full h-full">
      <path
        d="M10,10 Q30,10 50,20 T90,25"
        fill="none"
        stroke="hsl(var(--primary))"
        strokeWidth="8"
        opacity="0.6"
      />
      <path
        d="M10,30 Q30,30 50,30 T90,35"
        fill="none"
        stroke="hsl(var(--primary))"
        strokeWidth="6"
        opacity="0.4"
      />
      <path
        d="M10,50 Q30,50 50,40 T90,45"
        fill="none"
        stroke="hsl(var(--primary))"
        strokeWidth="4"
        opacity="0.2"
      />
    </svg>
  </div>
);

export const MiniScatter = () => (
  <div className="h-full relative bg-secondary/10 rounded">
    {[...Array(12)].map((_, i) => (
      <div
        key={i}
        className="absolute w-2 h-2 bg-primary rounded-full animate-pulse"
        style={{
          left: `${Math.random() * 80 + 10}%`,
          top: `${Math.random() * 80 + 10}%`,
          animationDelay: `${i * 0.1}s`,
          opacity: Math.random() * 0.5 + 0.5,
        }}
      />
    ))}
  </div>
);

export const MiniQRCode = () => (
  <div className="h-full flex items-center justify-center">
    <div className="w-14 h-14 grid grid-cols-7 gap-px">
      {[...Array(49)].map((_, i) => {
        const isCorner = (i < 21 && (i % 7 < 3 || i < 3)) || (i >= 28 && i < 49 && i % 7 < 3);
        const isRandom = !isCorner && Math.random() > 0.5;
        return (
          <div key={i} className={`${isCorner || isRandom ? 'bg-primary' : 'bg-secondary/30'}`} />
        );
      })}
    </div>
  </div>
);

export const MiniSpeedometer = () => (
  <div className="h-full flex items-center justify-center">
    <div className="relative w-16 h-8 overflow-hidden mt-2">
      <div className="absolute inset-0 border-4 border-b-0 border-primary/30 rounded-t-full" />
      <div 
        className="absolute inset-0 border-4 border-b-0 border-primary rounded-t-full animate-pulse"
        style={{ transform: 'rotate(-45deg)', transformOrigin: 'bottom center' }}
      />
      <div className="absolute bottom-0 left-1/2 w-0.5 h-7 bg-red-500 origin-bottom -translate-x-1/2 rotate-45" />
      <div className="absolute bottom-0 left-1/2 w-2 h-2 bg-primary rounded-full -translate-x-1/2 translate-y-1/2" />
    </div>
  </div>
);

export const MiniFlowchart = () => (
  <div className="h-full flex items-center justify-center">
    <svg viewBox="0 0 100 60" className="w-full h-full">
      <rect
        x="5"
        y="22"
        width="20"
        height="16"
        rx="2"
        fill="hsl(var(--primary) / 0.3)"
        stroke="hsl(var(--primary))"
      />
      <rect
        x="40"
        y="5"
        width="20"
        height="16"
        rx="8"
        fill="hsl(var(--primary) / 0.3)"
        stroke="hsl(var(--primary))"
      />
      <rect
        x="40"
        y="39"
        width="20"
        height="16"
        rx="8"
        fill="hsl(var(--primary) / 0.3)"
        stroke="hsl(var(--primary))"
      />
      <rect
        x="75"
        y="22"
        width="20"
        height="16"
        rx="2"
        fill="hsl(var(--primary) / 0.3)"
        stroke="hsl(var(--primary))"
      />
      <path d="M25,30 L40,13" fill="none" stroke="hsl(var(--primary))" strokeWidth="1" />
      <path d="M25,30 L40,47" fill="none" stroke="hsl(var(--primary))" strokeWidth="1" />
      <path d="M60,13 L75,30" fill="none" stroke="hsl(var(--primary))" strokeWidth="1" />
      <path d="M60,47 L75,30" fill="none" stroke="hsl(var(--primary))" strokeWidth="1" />
    </svg>
  </div>
);