-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.tsx
More file actions
701 lines (639 loc) · 24.4 KB
/
Copy pathapp.tsx
File metadata and controls
701 lines (639 loc) · 24.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
import React, { useState, useRef, useEffect } from "react";
import { createRoot } from "react-dom/client";
import { GoogleGenAI, Type, Schema } from "@google/genai";
import { Camera, Upload, X, Check, RefreshCw, ChefHat, Home, Clock, Settings, Plus, TrendingUp, Target } from "lucide-react";
// --- Types ---
interface MacroNutrients {
protein: number;
carbs: number;
fat: number;
fiber: number;
}
interface AnalysisResult {
id: string;
timestamp: number;
foodName: string;
calories: number;
servingSize: string;
macros: MacroNutrients;
healthAnalysis: string;
rating: number;
image: string;
}
interface DailyStats {
totalCalories: number;
totalProtein: number;
totalCarbs: number;
totalFat: number;
mealCount: number;
}
// --- Gemini Configuration ---
const analyzeImage = async (base64Image: string): Promise<Omit<AnalysisResult, 'id' | 'timestamp' | 'image'>> => {
const ai = new GoogleGenAI({ apiKey: process.env.API_KEY });
const schema: Schema = {
type: Type.OBJECT,
properties: {
foodName: { type: Type.STRING, description: "Name of the identified food or dish" },
calories: { type: Type.INTEGER, description: "Estimated total calories" },
servingSize: { type: Type.STRING, description: "Estimated serving size (e.g. 1 bowl, 200g)" },
macros: {
type: Type.OBJECT,
properties: {
protein: { type: Type.INTEGER, description: "Protein in grams" },
carbs: { type: Type.INTEGER, description: "Carbohydrates in grams" },
fat: { type: Type.INTEGER, description: "Total fat in grams" },
fiber: { type: Type.INTEGER, description: "Fiber in grams" },
},
required: ["protein", "carbs", "fat", "fiber"],
},
healthAnalysis: { type: Type.STRING, description: "Brief analysis of nutritional value and healthiness" },
rating: { type: Type.INTEGER, description: "Health score from 1 (unhealthy) to 10 (very healthy)" },
},
required: ["foodName", "calories", "servingSize", "macros", "healthAnalysis", "rating"],
};
const response = await ai.models.generateContent({
model: "gemini-2.5-flash",
contents: {
parts: [
{
inlineData: {
mimeType: "image/jpeg",
data: base64Image,
},
},
{
text: "Analyze this food image. Estimate nutritional content for the entire portion shown. Be realistic but approximate.",
},
],
},
config: {
responseMimeType: "application/json",
responseSchema: schema,
systemInstruction: "You are an expert nutritionist and dietitian. Analyze food images to provide nutritional estimates.",
},
});
const text = response.text;
if (!text) throw new Error("No response from AI");
return JSON.parse(text);
};
// --- Local Storage ---
const STORAGE_KEY = 'capforeat_data';
const loadData = (): AnalysisResult[] => {
try {
const data = localStorage.getItem(STORAGE_KEY);
return data ? JSON.parse(data) : [];
} catch {
return [];
}
};
const saveData = (records: AnalysisResult[]) => {
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(records));
} catch (e) {
console.error('Failed to save data:', e);
}
};
const getTodayStats = (records: AnalysisResult[]): DailyStats => {
const today = new Date().toDateString();
const todayRecords = records.filter(r => new Date(r.timestamp).toDateString() === today);
return {
totalCalories: todayRecords.reduce((sum, r) => sum + r.calories, 0),
totalProtein: todayRecords.reduce((sum, r) => sum + r.macros.protein, 0),
totalCarbs: todayRecords.reduce((sum, r) => sum + r.macros.carbs, 0),
totalFat: todayRecords.reduce((sum, r) => sum + r.macros.fat, 0),
mealCount: todayRecords.length,
};
};
// --- Components ---
const CameraCapture = ({ onCapture, onClose }: { onCapture: (img: string) => void, onClose: () => void }) => {
const videoRef = useRef<HTMLVideoElement>(null);
const canvasRef = useRef<HTMLCanvasElement>(null);
const [stream, setStream] = useState<MediaStream | null>(null);
useEffect(() => {
const startCamera = async () => {
try {
const s = await navigator.mediaDevices.getUserMedia({
video: { facingMode: "environment" },
audio: false
});
setStream(s);
if (videoRef.current) {
videoRef.current.srcObject = s;
}
} catch (err) {
console.error("Camera error:", err);
alert("Could not access camera. Please allow permissions or use file upload.");
onClose();
}
};
startCamera();
return () => {
if (stream) {
stream.getTracks().forEach(t => t.stop());
}
};
}, []);
const handleCapture = () => {
if (videoRef.current && canvasRef.current) {
const video = videoRef.current;
const canvas = canvasRef.current;
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
const ctx = canvas.getContext("2d");
if (ctx) {
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
const dataUrl = canvas.toDataURL("image/jpeg", 0.8);
const base64 = dataUrl.split(",")[1];
if (stream) stream.getTracks().forEach(t => t.stop());
onCapture(base64);
}
}
};
return (
<div className="fixed inset-0 bg-black z-50 flex flex-col">
<div className="relative flex-1 bg-black">
<video
ref={videoRef}
autoPlay
playsInline
className="absolute inset-0 w-full h-full object-cover"
/>
<button
onClick={onClose}
className="absolute top-6 right-6 text-white bg-black/50 p-2 rounded-full backdrop-blur-md"
>
<X size={24} />
</button>
</div>
<div className="h-32 bg-black flex items-center justify-center pb-8">
<button
onClick={handleCapture}
className="w-20 h-20 rounded-full border-4 border-white flex items-center justify-center active:scale-95 transition-transform"
>
<div className="w-16 h-16 bg-white rounded-full" />
</button>
</div>
<canvas ref={canvasRef} className="hidden" />
</div>
);
};
const NutritionCard = ({ data, onView }: { data: AnalysisResult, onView: (data: AnalysisResult) => void }) => {
const getRatingColor = (r: number) => {
if (r >= 8) return "text-green-600 bg-green-50";
if (r >= 5) return "text-yellow-600 bg-yellow-50";
return "text-red-600 bg-red-50";
};
return (
<div
onClick={() => onView(data)}
className="bg-white rounded-2xl p-4 shadow-sm border border-gray-100 cursor-pointer hover:shadow-md transition-shadow"
>
<div className="flex gap-4">
<img
src={`data:image/jpeg;base64,${data.image}`}
alt={data.foodName}
className="w-20 h-20 rounded-xl object-cover"
/>
<div className="flex-1">
<div className="flex items-start justify-between">
<div>
<h3 className="font-bold text-gray-900">{data.foodName}</h3>
<p className="text-sm text-gray-500">{data.servingSize}</p>
</div>
<span className={`px-2 py-1 rounded-lg text-xs font-bold ${getRatingColor(data.rating)}`}>
{data.rating}
</span>
</div>
<div className="mt-3 flex items-center justify-between">
<div className="text-2xl font-bold text-gray-900">{data.calories}</div>
<div className="text-xs text-gray-500">
<span className="font-medium">{data.macros.protein}g</span> P •
<span className="font-medium">{data.macros.carbs}g</span> C •
<span className="font-medium">{data.macros.fat}g</span> F
</div>
</div>
</div>
</div>
</div>
);
};
const HomePage = ({ records, onAnalyzeNew }: { records: AnalysisResult[], onAnalyzeNew: () => void }) => {
const stats = getTodayStats(records);
const todayRecords = records.filter(r => new Date(r.timestamp).toDateString() === new Date().toDateString());
return (
<div className="flex-1 pb-20">
{/* Today's Summary */}
<div className="bg-gradient-to-br from-green-500 to-green-600 rounded-3xl p-6 text-white mb-6">
<div className="flex items-center justify-between mb-4">
<h2 className="text-xl font-bold">Today's Intake</h2>
<Target size={24} />
</div>
<div className="text-4xl font-bold mb-2">{stats.totalCalories}</div>
<div className="text-green-100 text-sm mb-4">calories • {stats.mealCount} meals</div>
<div className="grid grid-cols-3 gap-3">
<div className="bg-white/20 rounded-xl p-3 text-center">
<div className="text-lg font-bold">{stats.totalProtein}g</div>
<div className="text-xs text-green-100">Protein</div>
</div>
<div className="bg-white/20 rounded-xl p-3 text-center">
<div className="text-lg font-bold">{stats.totalCarbs}g</div>
<div className="text-xs text-green-100">Carbs</div>
</div>
<div className="bg-white/20 rounded-xl p-3 text-center">
<div className="text-lg font-bold">{stats.totalFat}g</div>
<div className="text-xs text-green-100">Fat</div>
</div>
</div>
</div>
{/* Quick Actions */}
<button
onClick={onAnalyzeNew}
className="w-full bg-black text-white rounded-2xl p-4 font-bold text-lg flex items-center justify-center gap-3 mb-6 hover:bg-gray-800 transition-colors"
>
<Plus size={24} />
Scan New Meal
</button>
{/* Today's Meals */}
<div>
<h3 className="font-bold text-gray-900 mb-3 flex items-center gap-2">
<Clock size={18} />
Today's Meals
</h3>
{todayRecords.length === 0 ? (
<div className="bg-gray-50 rounded-2xl p-8 text-center">
<div className="w-12 h-12 bg-gray-200 rounded-full flex items-center justify-center mx-auto mb-3">
<Camera size={20} className="text-gray-400" />
</div>
<p className="text-gray-500 text-sm">No meals recorded today</p>
</div>
) : (
<div className="space-y-3">
{todayRecords.slice().reverse().map(record => (
<NutritionCard key={record.id} data={record} onView={() => {}} />
))}
</div>
)}
</div>
</div>
);
};
const HistoryPage = ({ records }: { records: AnalysisResult[] }) => {
const groupedRecords = records.reduce((acc, record) => {
const date = new Date(record.timestamp).toDateString();
if (!acc[date]) acc[date] = [];
acc[date].push(record);
return acc;
}, {} as Record<string, AnalysisResult[]>);
return (
<div className="flex-1 pb-20">
<h2 className="text-2xl font-bold text-gray-900 mb-6 flex items-center gap-2">
<Clock size={24} />
History
</h2>
{Object.keys(groupedRecords).length === 0 ? (
<div className="bg-gray-50 rounded-2xl p-8 text-center">
<div className="w-12 h-12 bg-gray-200 rounded-full flex items-center justify-center mx-auto mb-3">
<Clock size={20} className="text-gray-400" />
</div>
<p className="text-gray-500">No meal history yet</p>
</div>
) : (
<div className="space-y-6">
{Object.entries(groupedRecords)
.sort(([a], [b]) => new Date(b).getTime() - new Date(a).getTime())
.map(([date, dayRecords]) => (
<div key={date}>
<h3 className="font-bold text-gray-700 mb-3">
{new Date(date).toLocaleDateString('en-US', { weekday: 'long', month: 'short', day: 'numeric' })}
</h3>
<div className="space-y-3">
{dayRecords.map(record => (
<NutritionCard key={record.id} data={record} onView={() => {}} />
))}
</div>
</div>
))}
</div>
)}
</div>
);
};
const SettingsPage = () => {
return (
<div className="flex-1 pb-20">
<h2 className="text-2xl font-bold text-gray-900 mb-6 flex items-center gap-2">
<Settings size={24} />
Settings
</h2>
<div className="space-y-4">
<div className="bg-white rounded-2xl p-4 border border-gray-100">
<h3 className="font-bold text-gray-900 mb-2">Daily Goals</h3>
<div className="space-y-3">
<div className="flex items-center justify-between">
<span className="text-gray-600">Calories</span>
<span className="font-bold">2000 kcal</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-600">Protein</span>
<span className="font-bold">50g</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-600">Carbs</span>
<span className="font-bold">250g</span>
</div>
<div className="flex items-center justify-between">
<span className="text-gray-600">Fat</span>
<span className="font-bold">65g</span>
</div>
</div>
</div>
<div className="bg-white rounded-2xl p-4 border border-gray-100">
<h3 className="font-bold text-gray-900 mb-2">About</h3>
<p className="text-gray-600 text-sm mb-2">CapForEat - Smart Nutrition Scanner</p>
<p className="text-gray-500 text-xs">Version 1.0.0</p>
</div>
<button className="w-full bg-red-50 text-red-600 rounded-2xl p-4 font-bold hover:bg-red-100 transition-colors">
Clear All Data
</button>
</div>
</div>
);
};
const AnalysisPage = ({ image, onBack, onSave }: {
image: string,
onBack: () => void,
onSave: (result: Omit<AnalysisResult, 'id' | 'timestamp' | 'image'>) => void
}) => {
const [loading, setLoading] = useState(false);
const [result, setResult] = useState<Omit<AnalysisResult, 'id' | 'timestamp' | 'image'> | null>(null);
const [error, setError] = useState<string | null>(null);
const handleAnalyze = async () => {
setLoading(true);
setError(null);
try {
const data = await analyzeImage(image);
setResult(data);
} catch (err: any) {
console.error(err);
setError("Failed to analyze image. Please try again.");
} finally {
setLoading(false);
}
};
const handleSave = () => {
if (result) {
onSave(result);
}
};
return (
<div className="flex-1 pb-20">
<div className="flex items-center gap-4 mb-6">
<button onClick={onBack} className="text-gray-600">
<X size={24} />
</button>
<h2 className="text-xl font-bold text-gray-900">Analyze Meal</h2>
</div>
{error && (
<div className="bg-red-50 border border-red-200 p-4 rounded-xl mb-6">
<p className="text-red-700 text-sm">{error}</p>
</div>
)}
<div className="space-y-6">
<div className="relative rounded-2xl overflow-hidden shadow-lg aspect-square">
<img
src={`data:image/jpeg;base64,${image}`}
alt="Meal"
className="w-full h-full object-cover"
/>
</div>
{!result ? (
<button
onClick={handleAnalyze}
disabled={loading}
className={`w-full py-4 rounded-xl font-bold text-lg flex items-center justify-center gap-2 transition-all ${
loading
? "bg-gray-100 text-gray-400 cursor-not-allowed"
: "bg-green-600 text-white hover:bg-green-700"
}`}
>
{loading ? (
<>
<RefreshCw className="animate-spin" />
Analyzing...
</>
) : (
<>
<Check />
Analyze Nutrition
</>
)}
</button>
) : (
<div className="space-y-6">
<div className="bg-white rounded-2xl p-6 border border-gray-100">
<div className="flex items-center justify-between mb-4">
<h3 className="text-xl font-bold text-gray-900">{result.foodName}</h3>
<span className={`px-3 py-1 rounded-full text-sm font-bold ${
result.rating >= 8 ? "bg-green-100 text-green-700" :
result.rating >= 5 ? "bg-yellow-100 text-yellow-700" :
"bg-red-100 text-red-700"
}`}>
{result.rating}/10
</span>
</div>
<div className="text-3xl font-black text-gray-900 mb-4">{result.calories} kcal</div>
<p className="text-gray-500 text-sm mb-4">{result.servingSize}</p>
<div className="grid grid-cols-3 gap-3 mb-4">
<div className="text-center p-3 bg-blue-50 rounded-xl">
<span className="block text-blue-800 font-bold text-lg">{result.macros.protein}g</span>
<span className="text-xs text-blue-600">Protein</span>
</div>
<div className="text-center p-3 bg-orange-50 rounded-xl">
<span className="block text-orange-800 font-bold text-lg">{result.macros.carbs}g</span>
<span className="text-xs text-orange-600">Carbs</span>
</div>
<div className="text-center p-3 bg-yellow-50 rounded-xl">
<span className="block text-yellow-800 font-bold text-lg">{result.macros.fat}g</span>
<span className="text-xs text-yellow-600">Fat</span>
</div>
</div>
<div className="bg-green-50 p-4 rounded-xl">
<div className="flex items-center gap-2 mb-2 text-green-800 font-bold">
<ChefHat size={16} />
<span className="text-sm">Dietitian's Note</span>
</div>
<p className="text-green-900 text-sm">{result.healthAnalysis}</p>
</div>
</div>
<button
onClick={handleSave}
className="w-full bg-black text-white rounded-xl p-4 font-bold hover:bg-gray-800 transition-colors"
>
Save to Today's Log
</button>
</div>
)}
</div>
</div>
);
};
const CapturePage = ({ onCapture, onClose }: { onCapture: (img: string) => void, onClose: () => void }) => {
const [cameraOpen, setCameraOpen] = useState(false);
const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0];
if (file) {
const reader = new FileReader();
reader.onloadend = () => {
const base64 = (reader.result as string).split(",")[1];
onCapture(base64);
};
reader.readAsDataURL(file);
}
};
return (
<div className="flex-1 pb-20">
<div className="flex items-center gap-4 mb-6">
<button onClick={onClose} className="text-gray-600">
<X size={24} />
</button>
<h2 className="text-xl font-bold text-gray-900">Add Meal</h2>
</div>
<div className="space-y-6">
<div className="bg-gray-50 rounded-2xl p-8 text-center">
<div className="w-20 h-20 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6 text-green-600">
<Camera size={40} />
</div>
<h3 className="text-xl font-bold mb-2">Snap your meal</h3>
<p className="text-gray-500 mb-8">
Take a photo or upload an image to instantly get calorie and macro breakdown.
</p>
<div className="space-y-3">
<button
onClick={() => setCameraOpen(true)}
className="w-full py-4 bg-black text-white rounded-xl font-bold text-lg hover:bg-gray-800 transition-colors flex items-center justify-center gap-2"
>
<Camera size={20} />
Take Photo
</button>
<div className="relative">
<input
type="file"
accept="image/*"
onChange={handleFileUpload}
className="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
/>
<button className="w-full py-4 bg-white border-2 border-gray-200 text-gray-700 rounded-xl font-bold text-lg hover:border-gray-300 transition-colors flex items-center justify-center gap-2">
<Upload size={20} />
Upload Image
</button>
</div>
</div>
</div>
</div>
{cameraOpen && <CameraCapture onCapture={onCapture} onClose={() => setCameraOpen(false)} />}
</div>
);
};
// --- Main App ---
const App = () => {
const [currentPage, setCurrentPage] = useState<'home' | 'history' | 'settings'>('home');
const [captureMode, setCaptureMode] = useState(false);
const [analysisImage, setAnalysisImage] = useState<string | null>(null);
const [records, setRecords] = useState<AnalysisResult[]>([]);
useEffect(() => {
setRecords(loadData());
}, []);
const handleSaveRecord = (result: Omit<AnalysisResult, 'id' | 'timestamp' | 'image'>) => {
if (!analysisImage) return;
const newRecord: AnalysisResult = {
...result,
id: Date.now().toString(),
timestamp: Date.now(),
image: analysisImage,
};
const updatedRecords = [...records, newRecord];
setRecords(updatedRecords);
saveData(updatedRecords);
setAnalysisImage(null);
setCurrentPage('home');
};
const renderContent = () => {
if (analysisImage) {
return (
<AnalysisPage
image={analysisImage}
onBack={() => setAnalysisImage(null)}
onSave={handleSaveRecord}
/>
);
}
if (captureMode) {
return (
<CapturePage
onCapture={setAnalysisImage}
onClose={() => setCaptureMode(false)}
/>
);
}
switch (currentPage) {
case 'home':
return <HomePage records={records} onAnalyzeNew={() => setCaptureMode(true)} />;
case 'history':
return <HistoryPage records={records} />;
case 'settings':
return <SettingsPage />;
default:
return <HomePage records={records} onAnalyzeNew={() => setCaptureMode(true)} />;
}
};
return (
<div className="min-h-screen bg-gray-50 text-gray-900 font-sans">
<div className="max-w-md mx-auto min-h-screen flex flex-col">
{/* Header */}
<header className="bg-white border-b border-gray-100 px-6 py-4">
<h1 className="text-2xl font-extrabold tracking-tight flex items-center gap-2">
<span className="text-green-600">Cap</span>ForEat
</h1>
</header>
{/* Main Content */}
{renderContent()}
{/* Bottom Navigation */}
{!captureMode && !analysisImage && (
<div className="fixed bottom-0 left-0 right-0 bg-white border-t border-gray-100">
<div className="max-w-md mx-auto flex items-center justify-around py-2">
<button
onClick={() => setCurrentPage('home')}
className={`flex flex-col items-center gap-1 px-6 py-2 rounded-lg transition-colors ${
currentPage === 'home' ? 'text-green-600' : 'text-gray-400'
}`}
>
<Home size={20} />
<span className="text-xs font-medium">Home</span>
</button>
<button
onClick={() => setCurrentPage('history')}
className={`flex flex-col items-center gap-1 px-6 py-2 rounded-lg transition-colors ${
currentPage === 'history' ? 'text-green-600' : 'text-gray-400'
}`}
>
<Clock size={20} />
<span className="text-xs font-medium">History</span>
</button>
<button
onClick={() => setCurrentPage('settings')}
className={`flex flex-col items-center gap-1 px-6 py-2 rounded-lg transition-colors ${
currentPage === 'settings' ? 'text-green-600' : 'text-gray-400'
}`}
>
<Settings size={20} />
<span className="text-xs font-medium">Settings</span>
</button>
</div>
</div>
)}
</div>
</div>
);
};
const root = createRoot(document.getElementById("root")!);
root.render(<App />);