From e3a3c3fccfe13cabdeccd41c5746962dfe4d7711 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 11 Mar 2026 08:22:48 +0100 Subject: [PATCH 01/11] redesign take 1 --- apps/admin/data/fitai.db | Bin 172032 -> 172032 bytes apps/mobile/src/app/(tabs)/attendance.tsx | 459 ++++++------ apps/mobile/src/app/(tabs)/goals.tsx | 436 ++++++------ apps/mobile/src/app/(tabs)/index.tsx | 532 +++++++++----- apps/mobile/src/app/(tabs)/profile.tsx | 660 ++++++++++-------- .../mobile/src/app/(tabs)/recommendations.tsx | 482 ++++++------- apps/mobile/src/app/_layout.tsx | 32 +- apps/mobile/src/components/Badge.tsx | 124 ++++ apps/mobile/src/components/CustomTabBar.tsx | 252 ++++--- apps/mobile/src/components/IconContainer.tsx | 85 +++ apps/mobile/src/components/ListItem.tsx | 95 +++ apps/mobile/src/components/MinimalButton.tsx | 152 ++++ apps/mobile/src/components/MinimalCard.tsx | 84 +++ apps/mobile/src/components/ProgressBar.tsx | 82 +++ apps/mobile/src/components/SectionHeader.tsx | 80 +++ apps/mobile/src/contexts/ThemeContext.tsx | 129 ++++ apps/mobile/src/styles/colors.ts | 139 ++++ apps/mobile/src/styles/theme.ts | 308 ++++---- apps/mobile/src/styles/typography.ts | 145 ++++ 19 files changed, 2783 insertions(+), 1493 deletions(-) create mode 100644 apps/mobile/src/components/Badge.tsx create mode 100644 apps/mobile/src/components/IconContainer.tsx create mode 100644 apps/mobile/src/components/ListItem.tsx create mode 100644 apps/mobile/src/components/MinimalButton.tsx create mode 100644 apps/mobile/src/components/MinimalCard.tsx create mode 100644 apps/mobile/src/components/ProgressBar.tsx create mode 100644 apps/mobile/src/components/SectionHeader.tsx create mode 100644 apps/mobile/src/contexts/ThemeContext.tsx create mode 100644 apps/mobile/src/styles/colors.ts create mode 100644 apps/mobile/src/styles/typography.ts diff --git a/apps/admin/data/fitai.db b/apps/admin/data/fitai.db index 0fc1c97010a7341c65e61e2816297efcb209ec6e..823a9751cbea5469abe50cef8187c1aa686cbfb1 100644 GIT binary patch delta 196 zcmZoTz}0YoYl1Xm@$1LpY%b?EBz{n`b z!oncQAzzTrC3XmHCVv!s}0b;RWq|XQf4&?w3aSr9PAt2cfv*q3&0k;Hj0k;o> LyYIKV?*T=y9-0-= diff --git a/apps/mobile/src/app/(tabs)/attendance.tsx b/apps/mobile/src/app/(tabs)/attendance.tsx index a8c9d64..d09fa5b 100644 --- a/apps/mobile/src/app/(tabs)/attendance.tsx +++ b/apps/mobile/src/app/(tabs)/attendance.tsx @@ -7,46 +7,28 @@ import { ScrollView, Alert, } from "react-native"; -import { useState, useEffect, useRef } from "react"; +import { useState, useEffect } from "react"; import { useAuth } from "@clerk/clerk-expo"; -import { LinearGradient } from "expo-linear-gradient"; import { Ionicons } from "@expo/vector-icons"; +import { useTheme } from "../../contexts/ThemeContext"; +import { MinimalCard } from "../../components/MinimalCard"; +import { SectionHeader } from "../../components/SectionHeader"; +import { MinimalButton } from "../../components/MinimalButton"; +import { Badge } from "../../components/Badge"; +import { IconContainer } from "../../components/IconContainer"; import { attendanceApi, Attendance } from "../../api/attendance"; import { AttendanceCalendar } from "../../components/AttendanceCalendar"; import { useStatistics } from "../../contexts/StatisticsContext"; -import { theme } from "../../styles/theme"; -import { Animated } from "react-native"; import { getErrorMessage } from "../../utils/error-helpers"; import log from "../../utils/logger"; export default function AttendanceScreen() { const { getToken, userId } = useAuth(); + const { colors, typography } = useTheme(); const { clearCache: clearStatisticsCache } = useStatistics(); const [loading, setLoading] = useState(true); const [activeCheckIn, setActiveCheckIn] = useState(null); const [history, setHistory] = useState([]); - const pulseAnim = useRef(new Animated.Value(1)).current; - - useEffect(() => { - if (activeCheckIn) { - const pulse = Animated.loop( - Animated.sequence([ - Animated.timing(pulseAnim, { - toValue: 1.05, - duration: 1000, - useNativeDriver: true, - }), - Animated.timing(pulseAnim, { - toValue: 1, - duration: 1000, - useNativeDriver: true, - }), - ]), - ); - pulse.start(); - return () => pulse.stop(); - } - }, [activeCheckIn]); const fetchAttendance = async () => { try { @@ -82,10 +64,7 @@ export default function AttendanceScreen() { if (!token) return; await attendanceApi.checkIn("gym", token); - - // Clear statistics cache to force refresh on home screen clearStatisticsCache(); - fetchAttendance(); Alert.alert("Success", "Checked in successfully!"); } catch (error: unknown) { @@ -100,10 +79,7 @@ export default function AttendanceScreen() { if (!token) return; await attendanceApi.checkOut(token); - - // Clear statistics cache to force refresh on home screen clearStatisticsCache(); - fetchAttendance(); Alert.alert("Success", "Checked out successfully!"); } catch (error: unknown) { @@ -114,143 +90,204 @@ export default function AttendanceScreen() { if (loading && !history.length) { return ( - - + + ); } return ( - - - Attendance - Track your gym visits - + + {/* Header */} + + + Attendance + + + Track your gym visits + + - + {/* Check In/Out Section */} + {activeCheckIn ? ( - - - - + + + - - - - - Currently Checked In - - Since{" "} - {new Date(activeCheckIn.checkInTime).toLocaleTimeString([], { - hour: "2-digit", - minute: "2-digit", - })} - + + + + + Currently Checked In + + + Since{" "} + {new Date(activeCheckIn.checkInTime).toLocaleTimeString( + [], + { + hour: "2-digit", + minute: "2-digit", + }, + )} + + - - - - Check Out - - - + + ) : ( - - - - - Check In - - - + )} {/* Attendance Calendar */} - {history.length > 0 && } + + + + + + - Recent History - {history.map((item) => ( - - - - + + {history.length === 0 ? ( + + + - - - - - {new Date(item.checkInTime).toLocaleDateString()} + + + No attendance history yet - {item.type.toUpperCase()} - - - - - In:{" "} - {new Date(item.checkInTime).toLocaleTimeString([], { - hour: "2-digit", - minute: "2-digit", - })} - - {item.checkOutTime && ( - - Out:{" "} - {new Date(item.checkOutTime).toLocaleTimeString([], { - hour: "2-digit", - minute: "2-digit", - })} + + Your check-in history will appear here - )} + + + ) : ( + + {history.slice(0, 10).map((record, index) => { + const checkIn = new Date(record.checkInTime); + const checkOut = record.checkOutTime + ? new Date(record.checkOutTime) + : null; + const duration = checkOut + ? Math.round((checkOut.getTime() - checkIn.getTime()) / 60000) + : null; + + return ( + + + + + + + + + {checkIn.toLocaleDateString()} + + + {checkIn.toLocaleTimeString([], { + hour: "2-digit", + minute: "2-digit", + })} + {checkOut && + ` - ${checkOut.toLocaleTimeString([], { + hour: "2-digit", + minute: "2-digit", + })}`} + + + + {duration && ( + + )} + + + ); + })} - - ))} + )} + + + {/* Bottom Spacer */} + ); } @@ -258,147 +295,53 @@ export default function AttendanceScreen() { const styles = StyleSheet.create({ container: { flex: 1, - backgroundColor: theme.colors.background, - }, - content: { - paddingBottom: 20, }, centered: { flex: 1, justifyContent: "center", alignItems: "center", }, + content: { + paddingBottom: 20, + }, header: { + paddingHorizontal: 24, paddingTop: 60, paddingBottom: 24, + }, + section: { paddingHorizontal: 24, marginBottom: 24, - borderBottomLeftRadius: theme.borderRadius.xl, - borderBottomRightRadius: theme.borderRadius.xl, - }, - title: { - fontSize: theme.typography.fontSize["3xl"], - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.white, - marginBottom: 4, - }, - subtitle: { - fontSize: theme.typography.fontSize.base, - color: "rgba(255, 255, 255, 0.9)", - }, - actionContainer: { - marginBottom: 32, - paddingHorizontal: 20, - }, - checkInButton: { - paddingVertical: 20, - paddingHorizontal: 24, - borderRadius: theme.borderRadius.xl, - flexDirection: "row", - alignItems: "center", - justifyContent: "center", - }, - checkInButtonText: { - color: theme.colors.white, - fontSize: theme.typography.fontSize.xl, - fontWeight: theme.typography.fontWeight.semibold, - }, - checkOutButton: { - paddingVertical: 14, - paddingHorizontal: 20, - borderRadius: theme.borderRadius.lg, - flexDirection: "row", - alignItems: "center", - justifyContent: "center", - marginTop: 16, - }, - buttonText: { - color: theme.colors.white, - fontSize: theme.typography.fontSize.base, - fontWeight: theme.typography.fontWeight.semibold, }, activeCard: { padding: 20, - borderRadius: theme.borderRadius.xl, - borderWidth: 1, - borderColor: "rgba(16, 185, 129, 0.2)", }, - activeCardContent: { + activeHeader: { flexDirection: "row", + justifyContent: "space-between", alignItems: "center", - marginBottom: 16, }, - activeIconContainer: { - marginRight: 16, - }, - activeIcon: { - width: 56, - height: 56, - borderRadius: 28, - justifyContent: "center", + activeHeaderLeft: { + flexDirection: "row", alignItems: "center", - }, - activeTextContainer: { flex: 1, }, - activeText: { - fontSize: theme.typography.fontSize.lg, - fontWeight: theme.typography.fontWeight.semibold, - color: theme.colors.gray900, - marginBottom: 4, - }, - timeText: { - fontSize: theme.typography.fontSize.sm, - color: theme.colors.gray600, + emptyState: { + alignItems: "center", + paddingVertical: 40, + paddingHorizontal: 20, }, - sectionTitle: { - fontSize: theme.typography.fontSize.xl, - fontWeight: theme.typography.fontWeight.semibold, - marginBottom: 16, - paddingHorizontal: 20, - color: theme.colors.gray900, + historyList: { + gap: 12, }, historyItem: { - padding: 16, - borderRadius: theme.borderRadius.xl, - marginBottom: 12, - marginHorizontal: 20, flexDirection: "row", justifyContent: "space-between", alignItems: "center", - borderWidth: 1, - borderColor: "rgba(59, 130, 246, 0.1)", }, historyLeft: { flexDirection: "row", alignItems: "center", - gap: 12, - }, - historyIconContainer: { - marginRight: 4, - }, - historyIcon: { - width: 32, - height: 32, - borderRadius: 16, - justifyContent: "center", - alignItems: "center", - }, - dateText: { - fontSize: theme.typography.fontSize.base, - fontWeight: theme.typography.fontWeight.semibold, - color: theme.colors.gray900, - }, - typeText: { - fontSize: theme.typography.fontSize.xs, - color: theme.colors.gray600, - marginTop: 2, - }, - timeContainer: { - alignItems: "flex-end", - }, - historyTime: { - fontSize: theme.typography.fontSize.sm, - color: theme.colors.gray700, + flex: 1, }, }); diff --git a/apps/mobile/src/app/(tabs)/goals.tsx b/apps/mobile/src/app/(tabs)/goals.tsx index 6776775..db94423 100644 --- a/apps/mobile/src/app/(tabs)/goals.tsx +++ b/apps/mobile/src/app/(tabs)/goals.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback, useRef } from "react"; +import React, { useState, useCallback } from "react"; import { View, Text, @@ -6,27 +6,31 @@ import { ScrollView, RefreshControl, TouchableOpacity, - Animated, Alert, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; -import { LinearGradient } from "expo-linear-gradient"; -import { theme } from "../../styles/theme"; +import { useUser } from "@clerk/clerk-expo"; +import { useFocusEffect } from "expo-router"; +import * as SecureStore from "expo-secure-store"; +import { useTheme } from "../../contexts/ThemeContext"; +import { MinimalCard } from "../../components/MinimalCard"; +import { SectionHeader } from "../../components/SectionHeader"; +import { MinimalButton } from "../../components/MinimalButton"; +import { Badge } from "../../components/Badge"; +import { ProgressBar } from "../../components/ProgressBar"; import { GoalProgressCard } from "../../components/GoalProgressCard"; import { GoalCreationModal } from "../../components/GoalCreationModal"; import { WeeklyProgressChart } from "../../components/WeeklyProgressChart"; import { GoalTypeBreakdownChart } from "../../components/GoalTypeBreakdownChart"; -import { useUser } from "@clerk/clerk-expo"; import type { FitnessGoal, CreateGoalData } from "../../services/fitnessGoals"; import { useStatistics } from "../../contexts/StatisticsContext"; import { useFitnessGoals } from "../../contexts/FitnessGoalsContext"; import { useRecommendations } from "../../contexts/RecommendationsContext"; -import { useFocusEffect } from "expo-router"; -import * as SecureStore from "expo-secure-store"; import log from "../../utils/logger"; export default function GoalsScreen() { const { user } = useUser(); + const { colors, typography } = useTheme(); const { statistics, refetchStatistics, @@ -45,10 +49,8 @@ export default function GoalsScreen() { const [refreshing, setRefreshing] = useState(false); const [isModalVisible, setIsModalVisible] = useState(false); const [showAnalytics, setShowAnalytics] = useState(false); - const fabScale = useRef(new Animated.Value(1)).current; const loadData = useCallback(async () => { - // Load goals and statistics (both cached) await refetchGoals(); await refetchStatistics(); }, [refetchGoals, refetchStatistics]); @@ -64,7 +66,6 @@ export default function GoalsScreen() { style: "destructive", onPress: async () => { try { - // Clear all possible Clerk token keys const keysToDelete = [ "__clerk_client_jwt", "__clerk_db_jwt", @@ -82,7 +83,6 @@ export default function GoalsScreen() { } } - // Clear all caches clearStatsCache(); clearGoalsCache(); clearRecommendationsCache(); @@ -128,183 +128,237 @@ export default function GoalsScreen() { const activeGoals = goals?.filter((g) => g.status === "active") || []; const completedGoals = goals?.filter((g) => g.status === "completed") || []; + const avgProgress = + activeGoals.length > 0 + ? Math.round( + activeGoals.reduce((sum, g) => sum + (g.progress || 0), 0) / + activeGoals.length, + ) + : 0; return ( - + } > - - - - Fitness Goals - - Track your fitness journey progress - - - + + + Fitness Goals + + - - + Track your fitness journey progress + - + + + + {/* Stats Summary */} {goals && goals.length > 0 && ( - - - {activeGoals.length} - Active - - - {completedGoals.length} - Completed - - - - {activeGoals.length > 0 - ? Math.round( - activeGoals.reduce( - (sum, g) => sum + (g.progress || 0), - 0, - ) / activeGoals.length, - ) - : 0} - % - - Avg Progress + + + + + {activeGoals.length} + + + Active + + + + + + {completedGoals.length} + + + Completed + + + + + + {avgProgress}% + + + Avg Progress + + )} {/* Analytics Section */} {statistics && ( - - setShowAnalytics(!showAnalytics)} - > - + + + setShowAnalytics(!showAnalytics)} + activeOpacity={0.7} + > + + + + Progress Analytics + + - Progress Analytics - - - + - {showAnalytics && ( - - {statistics.weeklyTrend.length > 0 && ( - - )} - {statistics.goals.goalsByType.length > 0 && ( - - )} - - )} + {showAnalytics && ( + + {statistics.weeklyTrend.length > 0 && ( + + )} + {statistics.goals.goalsByType.length > 0 && ( + + )} + + )} + )} {/* Active Goals */} - - Active Goals ({activeGoals.length}) - + setIsModalVisible(true)} + /> {activeGoals.length === 0 ? ( - - - No active goals yet - - Tap the + button to create your first goal - - + + + + + No active goals yet + + + Tap "Add New" to create your first goal + + + ) : ( - activeGoals.map((goal) => ( - handleCompleteGoal(goal)} - onDelete={() => handleDeleteGoal(goal.id)} - /> - )) + + {activeGoals.map((goal) => ( + handleCompleteGoal(goal)} + onDelete={() => handleDeleteGoal(goal.id)} + /> + ))} + )} {/* Completed Goals */} {completedGoals.length > 0 && ( - - Completed Goals ({completedGoals.length}) - - {completedGoals.map((goal) => ( - handleDeleteGoal(goal.id)} - /> - ))} + + + {completedGoals.map((goal) => ( + handleDeleteGoal(goal.id)} + /> + ))} + )} - {/* Floating Action Button */} - + {/* Floating Action Button - Minimal Style */} + setIsModalVisible(true)} - onPressIn={() => { - Animated.spring(fabScale, { - toValue: 0.9, - friction: 8, - tension: 100, - useNativeDriver: true, - }).start(); - }} - onPressOut={() => { - Animated.spring(fabScale, { - toValue: 1, - friction: 8, - tension: 100, - useNativeDriver: true, - }).start(); - }} - activeOpacity={0.9} + activeOpacity={0.8} + style={[ + styles.fab, + { + backgroundColor: colors.primary, + shadowColor: colors.primary, + }, + ]} > - - - + - + {/* Create Goal Modal */} { setRefreshing(true); - // Force refetch statistics bypassing cache await forceRefresh(); setRefreshing(false); }, [forceRefresh]); @@ -168,57 +167,358 @@ export default function HomeScreen() { return () => clearTimeout(midnightTimer); }, []); + const checkInsThisWeek = statistics?.attendance.checkInsThisWeek || 0; + const currentStreak = statistics?.attendance.currentStreak || 0; + return ( - + } > {/* Header Section */} - {getGreeting()}, - {user?.firstName || "Athlete"} + + {getGreeting()}, + + + {user?.firstName || "Athlete"} + - + {user?.imageUrl ? ( ) : ( - - + + )} - {/* Activity Widget */} - + {/* Daily Stats Card */} + + + + + + + + + {checkInsThisWeek} + + + This Week + + - {/* Quick Action Grid */} - setTrackMealModalVisible(true)} - onAddWaterPress={() => setAddWaterModalVisible(true)} - onScanFoodPress={() => setScanFoodModalVisible(true)} - onLogWorkoutPress={() => { - // TODO: Implement workout logging - console.log("Log workout tapped"); - }} - /> + - {/* Nutrition Widget */} - + + + + + + {calories} + + + Kcal + + - {/* Hydration Widget */} - + - {/* Weekly Progress Widget */} - + + + + + + {currentStreak} + + + Day Streak + + + + + + + {/* Quick Actions */} + + + + { + console.log("Log workout tapped"); + }} + style={styles.actionCard} + > + + + + + Log Workout + + + + setTrackMealModalVisible(true)} + style={styles.actionCard} + > + + + + + Track Meal + + + + setAddWaterModalVisible(true)} + style={styles.actionCard} + > + + + + + Add Water + + + + setScanFoodModalVisible(true)} + style={styles.actionCard} + > + + + + + Scan Food + + + + + + {/* Nutrition Progress */} + + + + + + + + Calories + + + + {calories} / {CALORIE_GOAL} + + + + + + + {/* Hydration Progress */} + + + + + + + Hydration + + + + {waterIntake} / {WATER_GOAL} ml + + + + + + + {/* Recent Activity */} + + console.log("See all tapped")} + /> + + + + + + + + + Upper Body Power + + + Today, 10:00 AM + + + + 45m + + + + + + + + + + Morning Cardio + + + Yesterday, 7:30 AM + + + + 30m + + + + - {/* Recent Activity Section */} - - - Recent Activity - See All - - - - - - - - - - - Upper Body Power - Today, 10:00 AM - - 45m - - - - - - - - - - Morning Cardio - Yesterday, 7:30 AM - - 30m - - - - {/* Bottom Spacer for Tab Bar */} @@ -298,7 +550,6 @@ export default function HomeScreen() { const styles = StyleSheet.create({ container: { flex: 1, - backgroundColor: theme.colors.background, }, scrollContent: { paddingTop: 60, @@ -308,102 +559,65 @@ const styles = StyleSheet.create({ justifyContent: "space-between", alignItems: "center", paddingHorizontal: 24, - marginBottom: 32, - }, - greeting: { - fontSize: 16, - color: theme.colors.gray600, - fontWeight: "500", - marginBottom: 4, - }, - name: { - fontSize: 32, - fontWeight: "800", - color: theme.colors.gray900, - letterSpacing: -0.5, - }, - avatarContainer: { - shadowColor: "#000", - shadowOffset: { width: 0, height: 4 }, - shadowOpacity: 0.1, - shadowRadius: 12, - elevation: 5, + marginBottom: 24, }, avatar: { width: 56, height: 56, - borderRadius: 20, - borderWidth: 2, - borderColor: "#fff", + borderRadius: 28, }, placeholderAvatar: { width: 56, height: 56, - borderRadius: 20, - backgroundColor: theme.colors.primary, + borderRadius: 28, justifyContent: "center", alignItems: "center", - borderWidth: 2, - borderColor: "#fff", }, section: { - paddingHorizontal: 20, + paddingHorizontal: 24, marginBottom: 24, }, - sectionHeader: { + statsRow: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", - marginBottom: 16, }, - sectionTitle: { - fontSize: 18, - fontWeight: "700", - color: theme.colors.gray900, - }, - seeAll: { - fontSize: 14, - color: theme.colors.primary, - fontWeight: "600", - }, - activityCard: { - gap: 12, - }, - recentItem: { - flexDirection: "row", + statItem: { alignItems: "center", - padding: 16, - borderRadius: 20, - backgroundColor: "#fff", - borderWidth: 1, - borderColor: "rgba(255, 255, 255, 0.6)", - }, - recentIconContainer: { - marginRight: 16, - }, - recentIcon: { - width: 48, - height: 48, - borderRadius: 16, - justifyContent: "center", - alignItems: "center", - }, - recentInfo: { flex: 1, }, - recentTitle: { - fontSize: 16, - fontWeight: "600", - color: theme.colors.gray900, - marginBottom: 4, + divider: { + width: 1, + height: 60, }, - recentSubtitle: { - fontSize: 12, - color: theme.colors.gray500, + actionGrid: { + flexDirection: "row", + flexWrap: "wrap", + gap: 12, }, - recentValue: { - fontSize: 14, - fontWeight: "600", - color: theme.colors.gray900, + actionCard: { + width: "48%", + alignItems: "center", + paddingVertical: 20, + }, + progressHeader: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + }, + progressLabelRow: { + flexDirection: "row", + alignItems: "center", + }, + activityList: { + gap: 12, + }, + activityItem: { + flexDirection: "row", + alignItems: "center", + gap: 12, + }, + activityInfo: { + flex: 1, }, }); diff --git a/apps/mobile/src/app/(tabs)/profile.tsx b/apps/mobile/src/app/(tabs)/profile.tsx index a748417..10f86ed 100644 --- a/apps/mobile/src/app/(tabs)/profile.tsx +++ b/apps/mobile/src/app/(tabs)/profile.tsx @@ -11,11 +11,13 @@ import { import { useUser, useClerk, useAuth } from "@clerk/clerk-expo"; import { useRouter } from "expo-router"; import { Ionicons } from "@expo/vector-icons"; -import { LinearGradient } from "expo-linear-gradient"; -import { theme } from "../../styles/theme"; -import { AnimatedButton } from "../../components/AnimatedButton"; -import { GradientBackground } from "../../components/GradientBackground"; import { useState, useEffect } from "react"; +import { useTheme } from "../../contexts/ThemeContext"; +import { MinimalCard } from "../../components/MinimalCard"; +import { ListItem } from "../../components/ListItem"; +import { MinimalButton } from "../../components/MinimalButton"; +import { Badge } from "../../components/Badge"; +import { IconContainer } from "../../components/IconContainer"; import { API_BASE_URL, API_ENDPOINTS } from "../../config/api"; import log from "../../utils/logger"; @@ -23,24 +25,9 @@ export default function ProfileScreen() { const { user } = useUser(); const { signOut } = useClerk(); const router = useRouter(); - - const handleSignOut = async () => { - try { - await signOut(); - } catch (err) { - log.error("Failed to sign out", err); - } - }; - - const confirmSignOut = () => { - Alert.alert("Sign Out", "Are you sure you want to sign out?", [ - { text: "Cancel", style: "cancel" }, - { text: "Sign Out", style: "destructive", onPress: handleSignOut }, - ]); - }; - - // Gym selection state and handlers + const { colors, typography, theme: activeTheme, setTheme } = useTheme(); const { getToken } = useAuth(); + const [gyms, setGyms] = useState< Array<{ id: string; name: string; location?: string }> >([]); @@ -60,7 +47,6 @@ export default function ProfileScreen() { } }, [user?.publicMetadata, gyms]); - // Auto-load gyms on mount useEffect(() => { loadGyms(); }, []); @@ -80,9 +66,7 @@ export default function ProfileScreen() { log.error( "Failed to fetch gyms - non-OK response", new Error(text.slice(0, 200)), - { - status: res.status, - }, + { status: res.status }, ); setGyms([]); return; @@ -92,9 +76,7 @@ export default function ProfileScreen() { log.error( "Failed to fetch gyms - expected JSON", new Error(text.slice(0, 200)), - { - contentType, - }, + { contentType }, ); setGyms([]); return; @@ -149,9 +131,7 @@ export default function ProfileScreen() { log.error( "Failed to update gym selection - non-OK response", new Error(text.slice(0, 200)), - { - status: res.status, - }, + { status: res.status }, ); Alert.alert("Error", "Failed to update gym selection"); return; @@ -167,14 +147,12 @@ export default function ProfileScreen() { }); } } - // Update current gym state for immediate UI reflection setCurrentGymId(selectedGymId); setCurrentGymName( selectedGymId ? (gyms.find((g) => g.id === selectedGymId)?.name ?? null) : null, ); - // Attempt to reload Clerk user metadata so current gym reflects server state try { await (user as any)?.reload?.(); } catch (e) { @@ -190,372 +168,476 @@ export default function ProfileScreen() { } }; - return ( - - - - - {user?.imageUrl ? ( - - ) : ( - - - - )} - - - - - {user?.fullName || "User"} - - {user?.primaryEmailAddress?.emailAddress} - - - Premium Member - - - + const handleSignOut = async () => { + try { + await signOut(); + } catch (err) { + log.error("Failed to sign out", err); + } + }; - - - Account - - router.push("/personal-details")} + const confirmSignOut = () => { + Alert.alert("Sign Out", "Are you sure you want to sign out?", [ + { text: "Cancel", style: "cancel" }, + { text: "Sign Out", style: "destructive", onPress: handleSignOut }, + ]); + }; + + const handleThemeChange = () => { + Alert.alert("Choose Theme", "Select your preferred theme", [ + { + text: "Light", + onPress: () => setTheme("light"), + }, + { + text: "Dark", + onPress: () => setTheme("dark"), + }, + { + text: "System", + onPress: () => setTheme("system"), + }, + { text: "Cancel", style: "cancel" }, + ]); + }; + + const getThemeLabel = () => { + if (activeTheme === "light") return "Light"; + if (activeTheme === "dark") return "Dark"; + return "System"; + }; + + return ( + + {/* Header Card */} + + + {user?.imageUrl ? ( + + ) : ( + - + + )} + + + {user?.fullName || "User"} + + + {user?.primaryEmailAddress?.emailAddress} + + + + + {/* Theme Settings */} + + + Appearance + + + + + + } + rightElement={ + + } + onPress={handleThemeChange} + /> + + + + {/* Account Settings */} + + + Account + + + - - Personal Details + + } + rightElement={ - - - router.push("/fitness-profile")} - > - router.push("/personal-details")} + /> + + - - Fitness Profile + + } + rightElement={ - - - - router.push("/fitness-profile")} + /> + + - - Notifications + + } + rightElement={ - - + } + /> + + - {/* Gym Selection */} - - + + + Gym Selection + + + - - Gym{" "} - {currentGymName - ? `(Current: ${currentGymName})` - : currentGymId - ? `(Current: ${currentGymId})` - : "(Current: None)"} + Refresh + + + + + {currentGymName && ( + + + Current Gym + + + {currentGymName} - - - Refresh Gyms - - + )} - {gymsLoading ? ( - - ) : ( + {gymsLoading ? ( + + + + ) : ( + <> - - setSelectedGymId(null)} + > + setSelectedGymId(null)} > - Proceed without gym - - {gyms.map((gym) => ( - + + {gyms.map((gym) => ( + setSelectedGymId(gym.id)} + > + setSelectedGymId(gym.id)} > - {gym.name} - - ))} - + {gym.name} + + + ))} - )} - - - - } + style={{ marginTop: 16 }} /> - - - + + )} + + - - Support - - - + + Support + + + - - Help Center + + } + rightElement={ - - - - + } + /> + + - - Privacy & Security + + } + rightElement={ - - - + } + /> + + - + } + size="lg" /> - - Version 1.0.0 - + + + Version 1.0.0 + + ); } const styles = StyleSheet.create({ container: { flex: 1, - backgroundColor: theme.colors.background, }, - header: { + content: { + padding: 24, paddingTop: 60, - paddingBottom: 30, - borderBottomLeftRadius: theme.borderRadius.xl, - borderBottomRightRadius: theme.borderRadius.xl, - alignItems: "center", }, profileCard: { alignItems: "center", + paddingVertical: 32, + marginBottom: 24, }, avatarContainer: { position: "relative", - marginBottom: 16, }, avatar: { width: 100, height: 100, borderRadius: 50, - borderWidth: 4, - borderColor: "rgba(255, 255, 255, 0.3)", }, placeholderAvatar: { width: 100, height: 100, borderRadius: 50, - backgroundColor: "rgba(255, 255, 255, 0.2)", justifyContent: "center", alignItems: "center", - borderWidth: 4, - borderColor: "rgba(255, 255, 255, 0.3)", - }, - editBadge: { - position: "absolute", - bottom: 0, - right: 0, - backgroundColor: theme.colors.white, - width: 32, - height: 32, - borderRadius: 16, - justifyContent: "center", - alignItems: "center", - shadowColor: "#000", - shadowOffset: { width: 0, height: 2 }, - shadowOpacity: 0.1, - shadowRadius: 4, - elevation: 3, - }, - name: { - fontSize: theme.typography.fontSize["2xl"], - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.white, - marginBottom: 4, - }, - email: { - fontSize: theme.typography.fontSize.sm, - color: "rgba(255, 255, 255, 0.8)", - marginBottom: 12, - }, - memberBadge: { - backgroundColor: "rgba(255, 255, 255, 0.2)", - paddingHorizontal: 12, - paddingVertical: 6, - borderRadius: theme.borderRadius.full, - borderWidth: 1, - borderColor: "rgba(255, 255, 255, 0.3)", - }, - memberText: { - color: theme.colors.white, - fontSize: theme.typography.fontSize.xs, - fontWeight: theme.typography.fontWeight.bold, - letterSpacing: 0.5, - }, - content: { - padding: 20, - marginTop: -20, }, section: { marginBottom: 24, }, - sectionTitle: { - fontSize: theme.typography.fontSize.lg, - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.gray900, - marginBottom: 12, - marginLeft: 4, - }, - infoCard: { - backgroundColor: theme.colors.white, - borderRadius: theme.borderRadius.xl, - padding: 8, - borderWidth: 1, - borderColor: theme.colors.gray100, - }, - infoRow: { + sectionHeader: { flexDirection: "row", + justifyContent: "space-between", alignItems: "center", - padding: 12, - }, - iconContainer: { - width: 36, - height: 36, - borderRadius: 10, - justifyContent: "center", - alignItems: "center", - marginRight: 12, - }, - infoLabel: { - flex: 1, - fontSize: theme.typography.fontSize.base, - color: theme.colors.gray900, - fontWeight: theme.typography.fontWeight.medium, + marginBottom: 12, }, divider: { height: 1, - backgroundColor: theme.colors.gray100, - marginLeft: 60, + marginLeft: 52, }, - signOutButton: { - marginTop: 8, + currentGym: { + marginBottom: 16, + paddingBottom: 16, + borderBottomWidth: 1, + borderBottomColor: "rgba(0, 0, 0, 0.05)", }, - version: { - textAlign: "center", - marginTop: 24, - color: theme.colors.gray400, - fontSize: theme.typography.fontSize.xs, + loadingContainer: { + paddingVertical: 20, + alignItems: "center", + }, + gymScroll: { + marginHorizontal: -16, + }, + gymScrollContent: { + paddingHorizontal: 16, + gap: 8, + }, + gymChip: { + paddingHorizontal: 16, + paddingVertical: 10, + borderRadius: 20, + borderWidth: 1.5, + marginRight: 8, }, }); diff --git a/apps/mobile/src/app/(tabs)/recommendations.tsx b/apps/mobile/src/app/(tabs)/recommendations.tsx index bc6112e..2594d2a 100644 --- a/apps/mobile/src/app/(tabs)/recommendations.tsx +++ b/apps/mobile/src/app/(tabs)/recommendations.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback, useRef } from "react"; +import React, { useState, useCallback } from "react"; import { View, Text, @@ -9,11 +9,15 @@ import { ActivityIndicator, Alert, } from "react-native"; -import { LinearGradient } from "expo-linear-gradient"; import { Ionicons } from "@expo/vector-icons"; import { useUser } from "@clerk/clerk-expo"; import { useFocusEffect } from "expo-router"; -import { theme } from "../../styles/theme"; +import { useTheme } from "../../contexts/ThemeContext"; +import { MinimalCard } from "../../components/MinimalCard"; +import { SectionHeader } from "../../components/SectionHeader"; +import { MinimalButton } from "../../components/MinimalButton"; +import { Badge } from "../../components/Badge"; +import { IconContainer } from "../../components/IconContainer"; import { useRecommendations } from "../../contexts/RecommendationsContext"; import { useNotifications } from "../../contexts/NotificationsContext"; import { NotificationsModal } from "../../components/NotificationsModal"; @@ -22,6 +26,7 @@ import log from "../../utils/logger"; export default function RecommendationsScreen() { const { user } = useUser(); + const { colors, typography } = useTheme(); const { recommendations: allRecommendations, loading, @@ -43,7 +48,7 @@ export default function RecommendationsScreen() { setNotificationsVisible(false); }; - // Filter to show only approved recommendations for regular users + // Filter to show only approved recommendations const recommendations = allRecommendations.filter( (rec) => rec.status === "approved", ); @@ -101,14 +106,14 @@ export default function RecommendationsScreen() { if (loading && recommendations.length === 0) { return ( - - + + ); } return ( - + } > {/* Header */} - + - AI Recommendations - + + AI Recommendations + + Personalized fitness & nutrition plans - - {unreadCount > 0 && ( - - {unreadCount} - - )} + + + {unreadCount > 0 && ( + + + {unreadCount} + + + )} + - + {/* Generate Button */} - - + - - {generating ? ( - - ) : ( - <> - - - Generate New Plan - - - )} - - + textStyle={{ fontSize: 16 }} + /> {/* Recommendations List */} + 0 + ? `${recommendations.length} active plan${recommendations.length !== 1 ? "s" : ""}` + : undefined + } + /> + {recommendations.length === 0 ? ( - - - - No Recommendations Yet - + + + + + + + No Recommendations Yet + + Tap "Generate New Plan" to get personalized AI-powered fitness and nutrition recommendations based on your profile and goals. - - + + ) : ( - recommendations.map((recommendation) => ( - - )) + + {recommendations.map((recommendation) => ( + + ))} + )} + + {/* Bottom Spacer */} + ); @@ -221,250 +254,195 @@ interface RecommendationCardProps { } function RecommendationCard({ recommendation }: RecommendationCardProps) { + const { colors, typography } = useTheme(); const [expanded, setExpanded] = useState(false); return ( - - + {/* Header */} + setExpanded(!expanded)} + activeOpacity={0.7} + style={styles.cardHeader} > - {/* Header */} - - - - - - - AI Fitness Plan - - {new Date(recommendation.generatedAt).toLocaleDateString()} + + + + + + + AI Fitness Plan + + + {new Date(recommendation.generatedAt).toLocaleDateString()} + + + + + + + {/* Summary */} + + + {recommendation.recommendationText} + + + + {/* Expanded Content */} + {expanded && ( + + {/* Activity Plan */} + + + + + Activity Plan + + {recommendation.activityPlan} + - setExpanded(!expanded)}> - - - - {/* Summary */} - - - {recommendation.recommendationText} - - - - {/* Expanded Content */} - {expanded && ( - - {/* Activity Plan */} - - - - Activity Plan - - {recommendation.activityPlan} - - - {/* Diet Plan */} - - - - Diet Plan - - {recommendation.dietPlan} + + + + Diet Plan + + + {recommendation.dietPlan} + - )} - - + + )} + ); } const styles = StyleSheet.create({ container: { flex: 1, - backgroundColor: theme.colors.background, }, centered: { flex: 1, justifyContent: "center", alignItems: "center", - backgroundColor: theme.colors.background, }, scrollContent: { - paddingBottom: 100, + paddingBottom: 20, }, header: { flexDirection: "row", justifyContent: "space-between", - alignItems: "center", - padding: 24, + alignItems: "flex-start", + paddingHorizontal: 24, paddingTop: 60, paddingBottom: 24, - marginBottom: 20, - borderBottomLeftRadius: theme.borderRadius.xl, - borderBottomRightRadius: theme.borderRadius.xl, }, - headerTitle: { - fontSize: theme.typography.fontSize["3xl"], - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.white, + notificationButton: { + position: "relative", }, - headerSubtitle: { - fontSize: theme.typography.fontSize.base, - color: "rgba(255, 255, 255, 0.9)", - marginTop: 4, - }, - iconContainer: { - backgroundColor: "rgba(255, 255, 255, 0.2)", - width: 64, - height: 64, - borderRadius: 32, - justifyContent: "center", - alignItems: "center", - }, - badge: { + notificationBadge: { position: "absolute", top: -4, right: -4, - backgroundColor: theme.colors.danger, - borderRadius: 10, - width: 20, - height: 20, + minWidth: 18, + height: 18, + borderRadius: 9, justifyContent: "center", alignItems: "center", + paddingHorizontal: 4, }, - badgeText: { + notificationBadgeText: { color: "#fff", - fontSize: 12, - fontWeight: "bold", - }, - actionContainer: { - paddingHorizontal: 20, - marginBottom: 20, - }, - generateButton: { - flexDirection: "row", - alignItems: "center", - justifyContent: "center", - paddingVertical: 16, - paddingHorizontal: 24, - borderRadius: theme.borderRadius.xl, - }, - generateButtonText: { - fontSize: theme.typography.fontSize.lg, - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.white, + fontSize: 11, + fontWeight: "700", }, section: { - paddingHorizontal: 20, + paddingHorizontal: 24, + marginBottom: 24, }, emptyState: { - paddingVertical: 40, - }, - emptyCard: { - borderRadius: theme.borderRadius["2xl"], - padding: 32, alignItems: "center", + paddingVertical: 40, + paddingHorizontal: 20, }, - emptyTitle: { - fontSize: theme.typography.fontSize.xl, - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.gray700, - marginTop: 16, - marginBottom: 8, - }, - emptyText: { - fontSize: theme.typography.fontSize.base, - color: theme.colors.gray500, - textAlign: "center", - lineHeight: 24, - }, - card: { - marginBottom: 16, - }, - cardContent: { - borderRadius: theme.borderRadius["2xl"], - padding: 20, + recommendationsList: { + gap: 12, }, cardHeader: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", - marginBottom: 16, }, cardHeaderLeft: { flexDirection: "row", alignItems: "center", - gap: 12, - }, - cardIcon: { - width: 40, - height: 40, - borderRadius: 20, - justifyContent: "center", - alignItems: "center", - }, - cardTitle: { - fontSize: theme.typography.fontSize.lg, - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.gray800, - }, - cardDate: { - fontSize: theme.typography.fontSize.sm, - color: theme.colors.gray500, - marginTop: 2, + flex: 1, }, cardSummary: { - marginBottom: 12, - }, - summaryText: { - fontSize: theme.typography.fontSize.base, - color: theme.colors.gray700, - lineHeight: 24, + marginTop: 12, + paddingTop: 12, + borderTopWidth: 1, + borderTopColor: "rgba(0, 0, 0, 0.05)", }, expandedContent: { - marginTop: 12, - paddingTop: 16, - borderTopWidth: 1, - borderTopColor: theme.colors.gray200, + marginTop: 16, + gap: 12, }, planSection: { - marginBottom: 16, + padding: 16, + borderRadius: 12, }, planHeader: { flexDirection: "row", alignItems: "center", - gap: 8, - marginBottom: 8, - }, - planTitle: { - fontSize: theme.typography.fontSize.base, - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.gray800, - }, - planText: { - fontSize: theme.typography.fontSize.base, - color: theme.colors.gray600, - lineHeight: 22, }, }); diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx index 0ea3b95..e2c6872 100644 --- a/apps/mobile/src/app/_layout.tsx +++ b/apps/mobile/src/app/_layout.tsx @@ -3,7 +3,9 @@ import { Stack } from "expo-router"; import * as SecureStore from "expo-secure-store"; import { View, Text } from "react-native"; import { useEffect, useState } from "react"; +import { SafeAreaProvider } from "react-native-safe-area-context"; import { validateEnv } from "../utils/env"; +import { ThemeProvider } from "../contexts/ThemeContext"; import { StatisticsProvider } from "../contexts/StatisticsContext"; import { FitnessGoalsProvider } from "../contexts/FitnessGoalsContext"; import { RecommendationsProvider } from "../contexts/RecommendationsContext"; @@ -169,18 +171,22 @@ export default function RootLayout() { }); return ( - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + ); } diff --git a/apps/mobile/src/components/Badge.tsx b/apps/mobile/src/components/Badge.tsx new file mode 100644 index 0000000..17fb59c --- /dev/null +++ b/apps/mobile/src/components/Badge.tsx @@ -0,0 +1,124 @@ +import React from "react"; +import { View, Text, StyleSheet, ViewStyle, StyleProp } from "react-native"; +import { useTheme } from "../contexts/ThemeContext"; +import { fontSize, fontWeight } from "../styles/typography"; + +type BadgeVariant = + | "neutral" + | "success" + | "warning" + | "danger" + | "info" + | "primary"; +type BadgeSize = "sm" | "md"; + +interface BadgeProps { + label: string; + variant?: BadgeVariant; + size?: BadgeSize; + style?: StyleProp; +} + +/** + * Badge - Pill-shaped status indicator + * + * Variants: + * - neutral: Gray badge for general labels + * - success: Green badge for positive status + * - warning: Orange/yellow badge for warnings + * - danger: Red badge for errors or critical status + * - info: Blue badge for informational status + * - primary: Primary color badge + * + * Sizes: + * - sm: 5px vertical, 10px horizontal, 11px font + * - md: 6px vertical, 12px horizontal, 13px font (default) + */ +export function Badge({ + label, + variant = "neutral", + size = "md", + style, +}: BadgeProps) { + const { colors } = useTheme(); + + const sizeStyles = { + sm: { + paddingVertical: 5, + paddingHorizontal: 10, + fontSize: fontSize.xs, + }, + md: { + paddingVertical: 6, + paddingHorizontal: 12, + fontSize: fontSize.sm, + }, + }; + + const variantStyles: Record< + BadgeVariant, + { backgroundColor: string; color: string } + > = { + neutral: { + backgroundColor: colors.surfaceElevated, + color: colors.textSecondary, + }, + success: { + backgroundColor: `${colors.success}20`, // 20% opacity + color: colors.success, + }, + warning: { + backgroundColor: `${colors.warning}20`, + color: colors.warning, + }, + danger: { + backgroundColor: `${colors.danger}20`, + color: colors.danger, + }, + info: { + backgroundColor: `${colors.info}20`, + color: colors.info, + }, + primary: { + backgroundColor: `${colors.primary}20`, + color: colors.primary, + }, + }; + + return ( + + + {label} + + + ); +} + +const styles = StyleSheet.create({ + badge: { + borderRadius: 999, // Full pill shape + alignSelf: "flex-start", + }, + label: { + textAlign: "center", + }, +}); diff --git a/apps/mobile/src/components/CustomTabBar.tsx b/apps/mobile/src/components/CustomTabBar.tsx index cad05e1..8ade46a 100644 --- a/apps/mobile/src/components/CustomTabBar.tsx +++ b/apps/mobile/src/components/CustomTabBar.tsx @@ -1,143 +1,129 @@ -import React from 'react'; -import { View, StyleSheet, TouchableOpacity, Platform, Dimensions } from 'react-native'; -import { BottomTabBarProps } from '@react-navigation/bottom-tabs'; -import { Ionicons } from '@expo/vector-icons'; -import { LinearGradient } from 'expo-linear-gradient'; -import { theme } from '../styles/theme'; -import { Animated } from 'react-native'; +import React from "react"; +import { View, StyleSheet, TouchableOpacity } from "react-native"; +import { BottomTabBarProps } from "@react-navigation/bottom-tabs"; +import { Ionicons } from "@expo/vector-icons"; +import { useSafeAreaInsets } from "react-native-safe-area-context"; +import { useTheme } from "../contexts/ThemeContext"; -const { width } = Dimensions.get('window'); +/** + * CustomTabBar - Minimal bottom navigation with pill indicator + * + * Design: + * - Simple flat design (no floating, no glassmorphism) + * - Clean icons with outline/filled states + * - Small pill indicator below active tab + * - 56px height (reduced from 70px) + * - No animations (just opacity fade on press) + * - Theme-aware colors + */ +export function CustomTabBar({ + state, + descriptors, + navigation, +}: BottomTabBarProps) { + const { colors } = useTheme(); + const insets = useSafeAreaInsets(); -export function CustomTabBar({ state, descriptors, navigation }: BottomTabBarProps) { - return ( - - - {state.routes.map((route, index) => { - const { options } = descriptors[route.key]; - const isFocused = state.index === index; + return ( + + {state.routes.map((route, index) => { + const { options } = descriptors[route.key]; + const isFocused = state.index === index; - const onPress = () => { - const event = navigation.emit({ - type: 'tabPress', - target: route.key, - canPreventDefault: true, - }); + const onPress = () => { + const event = navigation.emit({ + type: "tabPress", + target: route.key, + canPreventDefault: true, + }); - if (!isFocused && !event.defaultPrevented) { - navigation.navigate(route.name); - } - }; + if (!isFocused && !event.defaultPrevented) { + navigation.navigate(route.name); + } + }; - const getIconName = (routeName: string, focused: boolean): keyof typeof Ionicons.glyphMap => { - switch (routeName) { - case 'index': - return focused ? 'home' : 'home-outline'; - case 'goals': - return focused ? 'trophy' : 'trophy-outline'; - case 'attendance': - return focused ? 'calendar' : 'calendar-outline'; - case 'recommendations': - return focused ? 'sparkles' : 'sparkles-outline'; - case 'profile': - return focused ? 'person' : 'person-outline'; - default: - return 'ellipse-outline'; - } - }; + const getIconName = ( + routeName: string, + focused: boolean, + ): keyof typeof Ionicons.glyphMap => { + switch (routeName) { + case "index": + return focused ? "home" : "home-outline"; + case "goals": + return focused ? "trophy" : "trophy-outline"; + case "attendance": + return focused ? "calendar" : "calendar-outline"; + case "recommendations": + return focused ? "sparkles" : "sparkles-outline"; + case "profile": + return focused ? "person" : "person-outline"; + default: + return "ellipse-outline"; + } + }; - // Animation for scale - const scaleValue = React.useRef(new Animated.Value(1)).current; - - React.useEffect(() => { - Animated.spring(scaleValue, { - toValue: isFocused ? 1.2 : 1, - useNativeDriver: true, - friction: 8, - }).start(); - }, [isFocused]); - - return ( - - - {isFocused ? ( - - - - ) : ( - - )} - - - ); - })} - - - ); + return ( + + + + {isFocused && ( + + )} + + + ); + })} + + ); } const styles = StyleSheet.create({ - container: { - position: 'absolute', - bottom: 0, - left: 0, - right: 0, - alignItems: 'center', - paddingBottom: Platform.OS === 'ios' ? 30 : 20, - pointerEvents: 'box-none', - }, - tabBar: { - flexDirection: 'row', - backgroundColor: 'rgba(255, 255, 255, 0.8)', - borderRadius: 35, - height: 70, - width: width - 40, - justifyContent: 'space-around', - alignItems: 'center', - borderWidth: 1, - borderColor: 'rgba(255, 255, 255, 0.5)', - paddingHorizontal: 10, - }, - tabItem: { - flex: 1, - alignItems: 'center', - justifyContent: 'center', - height: '100%', - }, - iconContainer: { - width: 40, - height: 40, - borderRadius: 20, - alignItems: 'center', - justifyContent: 'center', - shadowColor: theme.colors.primary, - shadowOffset: { width: 0, height: 4 }, - shadowOpacity: 0.3, - shadowRadius: 8, - elevation: 4, - }, + container: { + flexDirection: "row", + height: 56, + borderTopWidth: 1, + }, + tabItem: { + flex: 1, + alignItems: "center", + justifyContent: "center", + height: "100%", + }, + iconWrapper: { + alignItems: "center", + justifyContent: "center", + }, + indicator: { + width: 24, + height: 3, + borderRadius: 999, + marginTop: 4, + }, }); diff --git a/apps/mobile/src/components/IconContainer.tsx b/apps/mobile/src/components/IconContainer.tsx new file mode 100644 index 0000000..2b98ab2 --- /dev/null +++ b/apps/mobile/src/components/IconContainer.tsx @@ -0,0 +1,85 @@ +import React from "react"; +import { View, StyleSheet, ViewStyle, StyleProp } from "react-native"; +import { useTheme } from "../contexts/ThemeContext"; + +type IconContainerVariant = "plain" | "subtle" | "colored"; +type IconContainerSize = "sm" | "md" | "lg"; + +interface IconContainerProps { + children: React.ReactNode; + variant?: IconContainerVariant; + size?: IconContainerSize; + backgroundColor?: string; + style?: StyleProp; +} + +/** + * IconContainer - Clean container for icons with subtle backgrounds + * + * Variants: + * - plain: No background, just the icon + * - subtle: Light background (surfaceSecondary) + * - colored: Custom background color (pass backgroundColor prop) + * + * Sizes: + * - sm: 32px circle + * - md: 40px circle (default) + * - lg: 48px circle + */ +export function IconContainer({ + children, + variant = "subtle", + size = "md", + backgroundColor, + style, +}: IconContainerProps) { + const { colors } = useTheme(); + + const sizeStyles: Record = { + sm: { + width: 32, + height: 32, + borderRadius: 16, + }, + md: { + width: 40, + height: 40, + borderRadius: 20, + }, + lg: { + width: 48, + height: 48, + borderRadius: 24, + }, + }; + + const getBackgroundColor = (): string | undefined => { + if (variant === "colored" && backgroundColor) { + return backgroundColor; + } + if (variant === "subtle") { + return colors.surfaceElevated; + } + return "transparent"; + }; + + return ( + + {children} + + ); +} + +const styles = StyleSheet.create({ + container: { + alignItems: "center", + justifyContent: "center", + }, +}); diff --git a/apps/mobile/src/components/ListItem.tsx b/apps/mobile/src/components/ListItem.tsx new file mode 100644 index 0000000..11fabc7 --- /dev/null +++ b/apps/mobile/src/components/ListItem.tsx @@ -0,0 +1,95 @@ +import React from "react"; +import { + View, + Text, + TouchableOpacity, + StyleSheet, + ViewStyle, + StyleProp, +} from "react-native"; +import { useTheme } from "../contexts/ThemeContext"; + +interface ListItemProps { + title: string; + subtitle?: string; + leftIcon?: React.ReactNode; + rightElement?: React.ReactNode; + onPress?: () => void; + style?: StyleProp; +} + +/** + * ListItem - Clean list item with optional icon and trailing element + * + * Usage: + * - Settings lists + * - Navigation items + * - Selectable options + * + * Features: + * - Optional left icon (wrap in IconContainer) + * - Optional subtitle for additional context + * - Optional right element (arrow, badge, switch, etc.) + * - Optional onPress for touchable items + */ +export function ListItem({ + title, + subtitle, + leftIcon, + rightElement, + onPress, + style, +}: ListItemProps) { + const { colors, typography } = useTheme(); + + const content = ( + + {leftIcon && {leftIcon}} + + + {title} + + {subtitle && ( + + {subtitle} + + )} + + {rightElement && {rightElement}} + + ); + + if (onPress) { + return ( + + {content} + + ); + } + + return content; +} + +const styles = StyleSheet.create({ + container: { + flexDirection: "row", + alignItems: "center", + paddingVertical: 12, + paddingHorizontal: 16, + backgroundColor: "transparent", + }, + leftIcon: { + marginRight: 12, + }, + textContainer: { + flex: 1, + }, + rightElement: { + marginLeft: 12, + }, +}); diff --git a/apps/mobile/src/components/MinimalButton.tsx b/apps/mobile/src/components/MinimalButton.tsx new file mode 100644 index 0000000..284dc1c --- /dev/null +++ b/apps/mobile/src/components/MinimalButton.tsx @@ -0,0 +1,152 @@ +import React from "react"; +import { + TouchableOpacity, + Text, + StyleSheet, + ActivityIndicator, + ViewStyle, + TextStyle, + StyleProp, +} from "react-native"; +import { useTheme } from "../contexts/ThemeContext"; +import { fontSize, fontWeight } from "../styles/typography"; + +type ButtonVariant = "primary" | "secondary" | "tertiary" | "danger"; +type ButtonSize = "sm" | "md" | "lg"; + +interface MinimalButtonProps { + title: string; + onPress: () => void; + variant?: ButtonVariant; + size?: ButtonSize; + loading?: boolean; + disabled?: boolean; + style?: StyleProp; + textStyle?: StyleProp; +} + +/** + * MinimalButton - Clean button component with solid colors + * + * Variants: + * - primary: Solid primary background + * - secondary: Outlined with primary color + * - tertiary: Text only, no background + * - danger: Solid danger background + * + * Sizes: + * - sm: 12px vertical padding, 16px horizontal + * - md: 14px vertical padding, 24px horizontal (default) + * - lg: 16px vertical padding, 32px horizontal + */ +export function MinimalButton({ + title, + onPress, + variant = "primary", + size = "md", + loading = false, + disabled = false, + style, + textStyle, +}: MinimalButtonProps) { + const { colors } = useTheme(); + + const isDisabled = disabled || loading; + + // Get button styles based on variant + const getButtonStyle = (): ViewStyle => { + const baseStyle: ViewStyle = { + borderRadius: 10, + alignItems: "center", + justifyContent: "center", + opacity: isDisabled ? 0.5 : 1, + }; + + // Size-specific padding + const sizeStyles: Record< + ButtonSize, + { paddingVertical: number; paddingHorizontal: number } + > = { + sm: { paddingVertical: 12, paddingHorizontal: 16 }, + md: { paddingVertical: 14, paddingHorizontal: 24 }, + lg: { paddingVertical: 16, paddingHorizontal: 32 }, + }; + + const variantStyles: Record = { + primary: { + backgroundColor: colors.primary, + }, + secondary: { + backgroundColor: "transparent", + borderWidth: 1.5, + borderColor: colors.primary, + }, + tertiary: { + backgroundColor: "transparent", + }, + danger: { + backgroundColor: colors.danger, + }, + }; + + return { + ...baseStyle, + ...sizeStyles[size], + ...variantStyles[variant], + }; + }; + + // Get text styles based on variant + const getTextStyle = (): TextStyle => { + const baseTextStyle: TextStyle = { + fontSize: fontSize.base, + fontWeight: fontWeight.semibold, + }; + + const variantTextStyles: Record = { + primary: { + color: colors.white, + }, + secondary: { + color: colors.primary, + }, + tertiary: { + color: colors.primary, + }, + danger: { + color: colors.white, + }, + }; + + return { + ...baseTextStyle, + ...variantTextStyles[variant], + }; + }; + + return ( + + {loading ? ( + + ) : ( + {title} + )} + + ); +} + +const styles = StyleSheet.create({ + // No static styles needed - all dynamic based on theme +}); diff --git a/apps/mobile/src/components/MinimalCard.tsx b/apps/mobile/src/components/MinimalCard.tsx new file mode 100644 index 0000000..8b0d375 --- /dev/null +++ b/apps/mobile/src/components/MinimalCard.tsx @@ -0,0 +1,84 @@ +import React from "react"; +import { + View, + StyleSheet, + TouchableOpacity, + ViewStyle, + StyleProp, +} from "react-native"; +import { useTheme } from "../contexts/ThemeContext"; + +type CardVariant = "default" | "elevated" | "bordered"; + +interface MinimalCardProps { + children: React.ReactNode; + variant?: CardVariant; + onPress?: () => void; + style?: StyleProp; +} + +/** + * MinimalCard - Clean card component without gradients + * + * Variants: + * - default: Subtle shadow on surface background + * - elevated: More prominent shadow + * - bordered: Border instead of shadow + */ +export function MinimalCard({ + children, + variant = "default", + onPress, + style, +}: MinimalCardProps) { + const { colors } = useTheme(); + + const cardStyles = [ + styles.base, + { + backgroundColor: colors.surface, + }, + variant === "default" && styles.default, + variant === "elevated" && styles.elevated, + variant === "bordered" && { + borderWidth: 1, + borderColor: colors.border, + }, + style, + ]; + + if (onPress) { + return ( + + {children} + + ); + } + + return {children}; +} + +const styles = StyleSheet.create({ + base: { + borderRadius: 12, + padding: 16, + }, + default: { + shadowColor: "#000", + shadowOffset: { width: 0, height: 1 }, + shadowOpacity: 0.05, + shadowRadius: 3, + elevation: 1, + }, + elevated: { + shadowColor: "#000", + shadowOffset: { width: 0, height: 2 }, + shadowOpacity: 0.08, + shadowRadius: 8, + elevation: 2, + }, +}); diff --git a/apps/mobile/src/components/ProgressBar.tsx b/apps/mobile/src/components/ProgressBar.tsx new file mode 100644 index 0000000..362b9dd --- /dev/null +++ b/apps/mobile/src/components/ProgressBar.tsx @@ -0,0 +1,82 @@ +import React from "react"; +import { View, StyleSheet, ViewStyle, StyleProp } from "react-native"; +import { useTheme } from "../contexts/ThemeContext"; + +interface ProgressBarProps { + progress: number; // 0-1 (e.g., 0.75 for 75%) + color?: string; + backgroundColor?: string; + height?: number; + borderRadius?: number; + style?: StyleProp; +} + +/** + * ProgressBar - Simple linear progress indicator + * + * Usage: + * - Goal progress tracking + * - Loading states + * - Completion indicators + * + * Props: + * - progress: Value between 0 and 1 (e.g., 0.75 for 75%) + * - color: Custom fill color (defaults to theme primary) + * - backgroundColor: Custom track color (defaults to theme border) + * - height: Bar height in pixels (defaults to 8) + * - borderRadius: Corner radius (defaults to 999 for full pill shape) + */ +export function ProgressBar({ + progress, + color, + backgroundColor, + height = 8, + borderRadius = 999, + style, +}: ProgressBarProps) { + const { colors } = useTheme(); + + // Clamp progress between 0 and 1 + const clampedProgress = Math.min(Math.max(progress, 0), 1); + + const trackColor = backgroundColor || colors.border; + const fillColor = color || colors.primary; + + return ( + + + + ); +} + +const styles = StyleSheet.create({ + track: { + width: "100%", + overflow: "hidden", + }, + fill: { + position: "absolute", + left: 0, + top: 0, + }, +}); diff --git a/apps/mobile/src/components/SectionHeader.tsx b/apps/mobile/src/components/SectionHeader.tsx new file mode 100644 index 0000000..c7004bf --- /dev/null +++ b/apps/mobile/src/components/SectionHeader.tsx @@ -0,0 +1,80 @@ +import React from "react"; +import { + View, + Text, + TouchableOpacity, + StyleSheet, + ViewStyle, + StyleProp, +} from "react-native"; +import { useTheme } from "../contexts/ThemeContext"; + +interface SectionHeaderProps { + title: string; + subtitle?: string; + actionLabel?: string; + onActionPress?: () => void; + style?: StyleProp; +} + +/** + * SectionHeader - Clean section header with optional action button + * + * Usage: + * - Divides content into logical sections + * - Optional subtitle for additional context + * - Optional action button (e.g., "See All", "Add New") + */ +export function SectionHeader({ + title, + subtitle, + actionLabel, + onActionPress, + style, +}: SectionHeaderProps) { + const { colors, typography } = useTheme(); + + return ( + + + + {title} + + {subtitle && ( + + {subtitle} + + )} + + {actionLabel && onActionPress && ( + + + {actionLabel} + + + )} + + ); +} + +const styles = StyleSheet.create({ + container: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + marginBottom: 12, + }, + textContainer: { + flex: 1, + }, +}); diff --git a/apps/mobile/src/contexts/ThemeContext.tsx b/apps/mobile/src/contexts/ThemeContext.tsx new file mode 100644 index 0000000..206bfad --- /dev/null +++ b/apps/mobile/src/contexts/ThemeContext.tsx @@ -0,0 +1,129 @@ +import React, { + createContext, + useContext, + useState, + useEffect, + ReactNode, +} from "react"; +import { useColorScheme } from "react-native"; +import AsyncStorage from "@react-native-async-storage/async-storage"; +import { ColorScheme, lightColors, darkColors } from "../styles/colors"; +import { + TypographyPresets, + createTypographyPresets, +} from "../styles/typography"; + +type ThemeMode = "light" | "dark" | "system"; +type ActiveTheme = "light" | "dark"; + +interface ThemeContextType { + // Current active theme + theme: ActiveTheme; + + // User's theme preference + themeMode: ThemeMode; + + // Active color scheme + colors: ColorScheme; + + // Typography presets + typography: TypographyPresets; + + // Theme actions + setTheme: (mode: ThemeMode) => void; + toggleTheme: () => void; +} + +const ThemeContext = createContext(undefined); + +const THEME_STORAGE_KEY = "@fitai:theme"; + +interface ThemeProviderProps { + children: ReactNode; +} + +export function ThemeProvider({ children }: ThemeProviderProps) { + const systemColorScheme = useColorScheme(); + const [themeMode, setThemeMode] = useState("system"); + const [isLoading, setIsLoading] = useState(true); + + // Determine active theme based on mode and system preference + const getActiveTheme = (): ActiveTheme => { + if (themeMode === "system") { + return systemColorScheme === "dark" ? "dark" : "light"; + } + return themeMode; + }; + + const activeTheme = getActiveTheme(); + const colors = activeTheme === "dark" ? darkColors : lightColors; + const typography = createTypographyPresets( + colors.textPrimary, + colors.textSecondary, + colors.textTertiary, + ); + + // Load saved theme preference on mount + useEffect(() => { + const loadTheme = async () => { + try { + const savedTheme = await AsyncStorage.getItem(THEME_STORAGE_KEY); + if (savedTheme && ["light", "dark", "system"].includes(savedTheme)) { + setThemeMode(savedTheme as ThemeMode); + } + } catch (error) { + console.error("Failed to load theme preference:", error); + } finally { + setIsLoading(false); + } + }; + + loadTheme(); + }, []); + + // Save theme preference when it changes + const setTheme = async (mode: ThemeMode) => { + try { + setThemeMode(mode); + await AsyncStorage.setItem(THEME_STORAGE_KEY, mode); + } catch (error) { + console.error("Failed to save theme preference:", error); + } + }; + + // Toggle between light and dark (sets explicit mode, not system) + const toggleTheme = () => { + const newMode = activeTheme === "dark" ? "light" : "dark"; + setTheme(newMode); + }; + + // Don't render children until theme is loaded + if (isLoading) { + return null; + } + + const value: ThemeContextType = { + theme: activeTheme, + themeMode, + colors, + typography, + setTheme, + toggleTheme, + }; + + return ( + {children} + ); +} + +/** + * Hook to access theme context + * @throws Error if used outside ThemeProvider + */ +export function useTheme() { + const context = useContext(ThemeContext); + if (context === undefined) { + throw new Error("useTheme must be used within a ThemeProvider"); + } + return context; +} diff --git a/apps/mobile/src/styles/colors.ts b/apps/mobile/src/styles/colors.ts new file mode 100644 index 0000000..68198cd --- /dev/null +++ b/apps/mobile/src/styles/colors.ts @@ -0,0 +1,139 @@ +/** + * FitAI Color System + * Minimalist muted earth tones with light and dark mode support + */ + +export interface ColorScheme { + // Primary Earth Tones + primary: string; + primaryDark: string; + primaryLight: string; + + // Accent Colors + accent: string; + terracotta: string; + sand: string; + + // Status Colors + success: string; + warning: string; + danger: string; + info: string; + + // Neutrals + background: string; + surface: string; + surfaceElevated: string; + + // Text + textPrimary: string; + textSecondary: string; + textTertiary: string; + + // Borders + border: string; + borderLight: string; + + // Overlays + overlay: string; + overlayLight: string; + + // Legacy compatibility (will be phased out) + white: string; + black: string; +} + +/** + * Light Mode Color Palette + * Natural, warm, muted earth tones + */ +export const lightColors: ColorScheme = { + // Primary Earth Tones + primary: "#6B9080", // Muted sage green (main actions) + primaryDark: "#5A7A6E", // Darker sage + primaryLight: "#8AAE9E", // Lighter sage + + // Accent Colors (minimal use) + accent: "#A9B4A0", // Warm gray-green + terracotta: "#C1876B", // Warm terracotta (highlights) + sand: "#E8DCC4", // Warm sand (backgrounds) + + // Status Colors (muted) + success: "#7BA05B", // Muted olive green + warning: "#D4A574", // Muted amber + danger: "#B66B6B", // Muted rust red + info: "#7B9BB0", // Muted blue-gray + + // Neutrals + background: "#F9F7F4", // Warm off-white + surface: "#FFFFFF", // Pure white + surfaceElevated: "#FEFDFB", // Slightly warm white + + // Text + textPrimary: "#2C3731", // Deep forest + textSecondary: "#5C6B61", // Medium forest + textTertiary: "#8B9A8F", // Light forest + + // Borders + border: "#E8E4DF", // Very light warm gray + borderLight: "#F2EFE9", // Ultra light warm gray + + // Overlays + overlay: "rgba(44, 55, 49, 0.5)", + overlayLight: "rgba(44, 55, 49, 0.05)", + + // Legacy + white: "#FFFFFF", + black: "#2C3731", +}; + +/** + * Dark Mode Color Palette + * Warm dark tones with adjusted earth colors for contrast + */ +export const darkColors: ColorScheme = { + // Primary Earth Tones (adjusted for dark) + primary: "#8AAE9E", // Lighter sage for contrast + primaryDark: "#6B9080", + primaryLight: "#A4C4B5", + + // Accent Colors + accent: "#B5C2B0", + terracotta: "#D4A285", + sand: "#4A4539", // Dark sand + + // Status Colors + success: "#8DB76A", + warning: "#E0B886", + danger: "#C87D7D", + info: "#8FADC4", + + // Neutrals + background: "#1C1F1D", // Deep warm black + surface: "#252926", // Warm dark gray + surfaceElevated: "#2D3330", // Elevated warm dark + + // Text + textPrimary: "#E8E6E1", // Warm off-white + textSecondary: "#B8BFB5", // Medium warm gray + textTertiary: "#7A8379", // Muted warm gray + + // Borders + border: "#3A3F3C", // Subtle dark border + borderLight: "#2F3432", // Ultra subtle + + // Overlays + overlay: "rgba(0, 0, 0, 0.6)", + overlayLight: "rgba(255, 255, 255, 0.05)", + + // Legacy + white: "#E8E6E1", + black: "#1C1F1D", +}; + +/** + * Get color scheme based on theme mode + */ +export const getColors = (mode: "light" | "dark"): ColorScheme => { + return mode === "dark" ? darkColors : lightColors; +}; diff --git a/apps/mobile/src/styles/theme.ts b/apps/mobile/src/styles/theme.ts index 4a10c78..d7a023b 100644 --- a/apps/mobile/src/styles/theme.ts +++ b/apps/mobile/src/styles/theme.ts @@ -1,191 +1,159 @@ /** - * Modern Design System Theme - * Centralized theme configuration with gradients, colors, shadows, and spacing + * FitAI Design System Theme + * Minimalist theme with light/dark mode support + * @deprecated Use useTheme() hook instead for dynamic theming */ +import { lightColors, darkColors } from "./colors"; +import { typography as typographySystem } from "./typography"; + +/** + * Legacy theme object for backward compatibility + * New components should use useTheme() hook instead + */ export const theme = { - // Color Palette - colors: { - // Primary colors - primary: '#3b82f6', - primaryDark: '#2563eb', - primaryLight: '#60a5fa', - secondary: '#8b5cf6', + // Color Palette (light mode - for legacy components) + colors: { + ...lightColors, - // Accent colors - purple: '#8b5cf6', - purpleDark: '#7c3aed', - pink: '#ec4899', + // Legacy color mappings (deprecated - use new colors instead) + secondary: "#8b5cf6", // Old purple - deprecated + purple: "#A9B4A0", // Mapped to accent + purpleDark: "#5A7A6E", + pink: "#C1876B", // Mapped to terracotta + successLight: "#8DB76A", + gray50: "#F2EFE9", + gray100: "#E8E4DF", + gray200: "#E8E4DF", + gray300: "#B8BFB5", + gray400: "#8B9A8F", + gray500: "#5C6B61", + gray600: "#5C6B61", + gray700: "#2C3731", + gray800: "#2C3731", + gray900: "#2C3731", + }, - // Success - success: '#10b981', - successDark: '#059669', - successLight: '#34d399', + // Typography (updated to new system) + typography: typographySystem, - // Warning - warning: '#f59e0b', - warningDark: '#d97706', + // Spacing Scale (updated for minimalism) + spacing: { + xs: 4, + sm: 8, + md: 12, + lg: 16, + xl: 24, // Increased from 20 + "2xl": 32, // Increased from 24 + "3xl": 40, // Increased from 32 + "4xl": 48, // New + "5xl": 64, // New + }, - // Danger - danger: '#ef4444', - dangerDark: '#dc2626', + // Border Radius (reduced for minimalism) + borderRadius: { + sm: 4, + md: 6, + lg: 10, + xl: 12, // Reduced from 16 + "2xl": 16, // Reduced from 20 + "3xl": 20, // Reduced from 24 + full: 9999, + }, - // Neutrals - white: '#ffffff', - black: '#000000', - gray50: '#f9fafb', - gray100: '#f3f4f6', - gray200: '#e5e7eb', - gray300: '#d1d5db', - gray400: '#9ca3af', - gray500: '#6b7280', - gray600: '#4b5563', - gray700: '#374151', - gray800: '#1f2937', - gray900: '#111827', - - // Backgrounds - background: '#f5f5f5', - backgroundDark: '#0f172a', - surface: '#ffffff', - surfaceDark: '#1e293b', + // Shadow System (simplified) + shadows: { + subtle: { + shadowColor: "#000", + shadowOffset: { width: 0, height: 1 }, + shadowOpacity: 0.05, + shadowRadius: 3, + elevation: 1, }, - - // Gradient Definitions - gradients: { - primary: ['#3b82f6', '#8b5cf6'] as const, - primaryVertical: ['#3b82f6', '#2563eb'] as const, - success: ['#10b981', '#059669'] as const, - warning: ['#f59e0b', '#d97706'] as const, - danger: ['#ef4444', '#ec4899'] as const, - purple: ['#8b5cf6', '#7c3aed'] as const, - ocean: ['#06b6d4', '#3b82f6'] as const, - sunset: ['#f59e0b', '#ef4444'] as const, - forest: ['#10b981', '#059669'] as const, - lavender: ['#a78bfa', '#ec4899'] as const, - dark: ['#1e293b', '#0f172a'] as const, + medium: { + shadowColor: "#000", + shadowOffset: { width: 0, height: 2 }, + shadowOpacity: 0.08, + shadowRadius: 8, + elevation: 2, }, - - // Shadow System - shadows: { - subtle: { - shadowColor: '#000', - shadowOffset: { width: 0, height: 1 }, - shadowOpacity: 0.05, - shadowRadius: 2, - elevation: 2, - }, - medium: { - shadowColor: '#000', - shadowOffset: { width: 0, height: 2 }, - shadowOpacity: 0.1, - shadowRadius: 4, - elevation: 3, - }, - strong: { - shadowColor: '#000', - shadowOffset: { width: 0, height: 4 }, - shadowOpacity: 0.15, - shadowRadius: 8, - elevation: 5, - }, - glow: { - shadowColor: '#3b82f6', - shadowOffset: { width: 0, height: 4 }, - shadowOpacity: 0.3, - shadowRadius: 12, - elevation: 8, - }, - glowDanger: { - shadowColor: '#ef4444', - shadowOffset: { width: 0, height: 4 }, - shadowOpacity: 0.3, - shadowRadius: 12, - elevation: 8, - }, + strong: { + shadowColor: "#000", + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.12, + shadowRadius: 16, + elevation: 4, }, - - // Typography - typography: { - // Font sizes - fontSize: { - xs: 12, - sm: 14, - base: 16, - lg: 18, - xl: 20, - '2xl': 24, - '3xl': 28, - '4xl': 32, - '5xl': 36, - }, - // Font weights - fontWeight: { - normal: '400' as const, - medium: '500' as const, - semibold: '600' as const, - bold: '700' as const, - extrabold: '800' as const, - }, - // Line heights - lineHeight: { - tight: 1.2, - normal: 1.5, - relaxed: 1.75, - }, + // Legacy glow shadows (deprecated - avoid in new designs) + glow: { + shadowColor: "#6B9080", + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.2, + shadowRadius: 12, + elevation: 6, }, - - // Spacing Scale - spacing: { - xs: 4, - sm: 8, - md: 12, - lg: 16, - xl: 20, - '2xl': 24, - '3xl': 32, - '4xl': 40, - '5xl': 48, + glowDanger: { + shadowColor: "#B66B6B", + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.2, + shadowRadius: 12, + elevation: 6, }, + }, - // Border Radius - borderRadius: { - sm: 4, - md: 8, - lg: 12, - xl: 16, - '2xl': 20, - '3xl': 24, - full: 9999, + // Animation Timing (simplified) + animation: { + duration: { + fast: 200, + normal: 300, + slow: 500, }, + }, - // Animation Timing - animation: { - duration: { - fast: 150, - normal: 250, - slow: 350, - }, - easing: { - easeIn: 'ease-in', - easeOut: 'ease-out', - easeInOut: 'ease-in-out', - }, - }, + // Gradients (kept for legacy compatibility - should be avoided in new designs) + gradients: { + primary: ["#6B9080", "#8AAE9E"] as const, + success: ["#7BA05B", "#8DB76A"] as const, + warning: ["#D4A574", "#E0B886"] as const, + danger: ["#B66B6B", "#C87D7D"] as const, + // Legacy gradients (deprecated) + purple: ["#8b5cf6", "#7c3aed"] as const, + ocean: ["#06b6d4", "#3b82f6"] as const, + sunset: ["#f59e0b", "#ef4444"] as const, + forest: ["#10b981", "#059669"] as const, + lavender: ["#a78bfa", "#ec4899"] as const, + dark: ["#1e293b", "#0f172a"] as const, + primaryVertical: ["#6B9080", "#5A7A6E"] as const, + }, +}; - // Glassmorphism - glass: { - light: { - backgroundColor: 'rgba(255, 255, 255, 0.7)', - borderWidth: 1, - borderColor: 'rgba(255, 255, 255, 0.3)', - }, - dark: { - backgroundColor: 'rgba(0, 0, 0, 0.3)', - borderWidth: 1, - borderColor: 'rgba(255, 255, 255, 0.1)', - }, - }, +/** + * Dark theme object + * @deprecated Use useTheme() hook instead + */ +export const darkTheme = { + ...theme, + colors: { + ...darkColors, + + // Legacy color mappings + secondary: "#8b5cf6", // Old purple - deprecated + purple: "#B5C2B0", // Mapped to dark accent + purpleDark: "#6B9080", + pink: "#D4A285", // Mapped to dark terracotta + successLight: "#8DB76A", + gray50: "#2F3432", + gray100: "#3A3F3C", + gray200: "#3A3F3C", + gray300: "#7A8379", + gray400: "#7A8379", + gray500: "#B8BFB5", + gray600: "#B8BFB5", + gray700: "#E8E6E1", + gray800: "#E8E6E1", + gray900: "#E8E6E1", + }, }; export type Theme = typeof theme; +export type DarkTheme = typeof darkTheme; diff --git a/apps/mobile/src/styles/typography.ts b/apps/mobile/src/styles/typography.ts new file mode 100644 index 0000000..37bb3a1 --- /dev/null +++ b/apps/mobile/src/styles/typography.ts @@ -0,0 +1,145 @@ +/** + * FitAI Typography System + * Minimalist typography with clear hierarchy using system fonts + */ + +import { TextStyle } from "react-native"; + +/** + * Font Sizes + * Refined scale with fewer sizes for clearer hierarchy + */ +export const fontSize = { + xs: 11, + sm: 13, + base: 15, + md: 17, // Body emphasis + lg: 20, + xl: 24, + "2xl": 28, + "3xl": 34, + "4xl": 40, +} as const; + +/** + * Font Weights + */ +export const fontWeight = { + regular: "400" as TextStyle["fontWeight"], + medium: "500" as TextStyle["fontWeight"], + semibold: "600" as TextStyle["fontWeight"], + bold: "700" as TextStyle["fontWeight"], +} as const; + +/** + * Line Heights + */ +export const lineHeight = { + tight: 1.2, + normal: 1.5, + relaxed: 1.7, +} as const; + +/** + * Letter Spacing + */ +export const letterSpacing = { + tight: -0.5, + normal: 0, + wide: 0.5, + wider: 1, +} as const; + +/** + * Typography Presets + * Ready-to-use text styles for common use cases + */ +export interface TypographyPresets { + h1: TextStyle; + h2: TextStyle; + h3: TextStyle; + body: TextStyle; + bodyEmphasis: TextStyle; + label: TextStyle; + stat: TextStyle; + caption: TextStyle; +} + +export const createTypographyPresets = ( + textPrimary: string, + textSecondary: string, + textTertiary: string, +): TypographyPresets => ({ + // Display Text (Screen Titles) + h1: { + fontSize: fontSize["3xl"], + fontWeight: fontWeight.bold, + letterSpacing: letterSpacing.tight, + lineHeight: fontSize["3xl"] * lineHeight.tight, + color: textPrimary, + }, + + // Section Headers + h2: { + fontSize: fontSize.xl, + fontWeight: fontWeight.semibold, + letterSpacing: -0.3, + color: textPrimary, + }, + + // Card Titles + h3: { + fontSize: fontSize.md, + fontWeight: fontWeight.semibold, + color: textPrimary, + }, + + // Body Text + body: { + fontSize: fontSize.base, + fontWeight: fontWeight.regular, + lineHeight: fontSize.base * lineHeight.normal, + color: textSecondary, + }, + + // Emphasized Body + bodyEmphasis: { + fontSize: fontSize.md, + fontWeight: fontWeight.medium, + lineHeight: fontSize.md * lineHeight.normal, + color: textPrimary, + }, + + // Labels (uppercase, spaced) + label: { + fontSize: fontSize.sm, + fontWeight: fontWeight.medium, + letterSpacing: letterSpacing.wide, + textTransform: "uppercase", + color: textTertiary, + }, + + // Stats/Numbers + stat: { + fontSize: fontSize["2xl"], + fontWeight: fontWeight.bold, + color: textPrimary, + }, + + // Caption/Small text + caption: { + fontSize: fontSize.xs, + fontWeight: fontWeight.regular, + color: textTertiary, + }, +}); + +/** + * Typography utility object + */ +export const typography = { + fontSize, + fontWeight, + lineHeight, + letterSpacing, +}; From df08ff8950ff070b13d8a30d1131386c990b3f63 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 11 Mar 2026 08:33:09 +0100 Subject: [PATCH 02/11] nord color schema --- apps/mobile/src/styles/colors.ts | 111 ++++++++++++++++--------------- 1 file changed, 56 insertions(+), 55 deletions(-) diff --git a/apps/mobile/src/styles/colors.ts b/apps/mobile/src/styles/colors.ts index 68198cd..4ca01c0 100644 --- a/apps/mobile/src/styles/colors.ts +++ b/apps/mobile/src/styles/colors.ts @@ -1,10 +1,11 @@ /** * FitAI Color System - * Minimalist muted earth tones with light and dark mode support + * Nord Color Palette - A minimal, arctic-inspired palette + * https://www.nordtheme.com/ */ export interface ColorScheme { - // Primary Earth Tones + // Primary Colors primary: string; primaryDark: string; primaryLight: string; @@ -45,90 +46,90 @@ export interface ColorScheme { /** * Light Mode Color Palette - * Natural, warm, muted earth tones + * Nord Snow Storm (light backgrounds) with Polar Night (dark text) */ export const lightColors: ColorScheme = { - // Primary Earth Tones - primary: "#6B9080", // Muted sage green (main actions) - primaryDark: "#5A7A6E", // Darker sage - primaryLight: "#8AAE9E", // Lighter sage + // Primary Colors (Nord Frost - Aurora blue-green) + primary: "#88C0D0", // Nord Frost 8 (main actions, cyan) + primaryDark: "#5E81AC", // Nord Frost 10 (dark blue) + primaryLight: "#8FBCBB", // Nord Frost 7 (pale cyan) - // Accent Colors (minimal use) - accent: "#A9B4A0", // Warm gray-green - terracotta: "#C1876B", // Warm terracotta (highlights) - sand: "#E8DCC4", // Warm sand (backgrounds) + // Accent Colors + accent: "#81A1C1", // Nord Frost 9 (blue-gray) + terracotta: "#D08770", // Nord Aurora 12 (orange - replaces terracotta) + sand: "#EBCB8B", // Nord Aurora 13 (yellow - warm accent) - // Status Colors (muted) - success: "#7BA05B", // Muted olive green - warning: "#D4A574", // Muted amber - danger: "#B66B6B", // Muted rust red - info: "#7B9BB0", // Muted blue-gray + // Status Colors + success: "#A3BE8C", // Nord Aurora 14 (green) + warning: "#EBCB8B", // Nord Aurora 13 (yellow) + danger: "#BF616A", // Nord Aurora 11 (red) + info: "#81A1C1", // Nord Frost 9 (blue) - // Neutrals - background: "#F9F7F4", // Warm off-white - surface: "#FFFFFF", // Pure white - surfaceElevated: "#FEFDFB", // Slightly warm white + // Neutrals (Snow Storm palette) + background: "#ECEFF4", // Nord Snow Storm 3 (lightest) + surface: "#E5E9F0", // Nord Snow Storm 2 (medium) + surfaceElevated: "#D8DEE9", // Nord Snow Storm 1 (slightly darker) - // Text - textPrimary: "#2C3731", // Deep forest - textSecondary: "#5C6B61", // Medium forest - textTertiary: "#8B9A8F", // Light forest + // Text (Polar Night palette) + textPrimary: "#2E3440", // Nord Polar Night 0 (darkest) + textSecondary: "#3B4252", // Nord Polar Night 1 + textTertiary: "#4C566A", // Nord Polar Night 3 // Borders - border: "#E8E4DF", // Very light warm gray - borderLight: "#F2EFE9", // Ultra light warm gray + border: "#D8DEE9", // Nord Snow Storm 1 + borderLight: "#E5E9F0", // Nord Snow Storm 2 // Overlays - overlay: "rgba(44, 55, 49, 0.5)", - overlayLight: "rgba(44, 55, 49, 0.05)", + overlay: "rgba(46, 52, 64, 0.5)", // Polar Night 0 + overlayLight: "rgba(46, 52, 64, 0.05)", // Legacy - white: "#FFFFFF", - black: "#2C3731", + white: "#ECEFF4", + black: "#2E3440", }; /** * Dark Mode Color Palette - * Warm dark tones with adjusted earth colors for contrast + * Nord Polar Night (dark backgrounds) with Snow Storm (light text) */ export const darkColors: ColorScheme = { - // Primary Earth Tones (adjusted for dark) - primary: "#8AAE9E", // Lighter sage for contrast - primaryDark: "#6B9080", - primaryLight: "#A4C4B5", + // Primary Colors (Nord Frost - adjusted for dark mode) + primary: "#88C0D0", // Nord Frost 8 (cyan - brighter on dark) + primaryDark: "#5E81AC", // Nord Frost 10 (dark blue) + primaryLight: "#8FBCBB", // Nord Frost 7 (pale cyan) // Accent Colors - accent: "#B5C2B0", - terracotta: "#D4A285", - sand: "#4A4539", // Dark sand + accent: "#81A1C1", // Nord Frost 9 (blue-gray) + terracotta: "#D08770", // Nord Aurora 12 (orange) + sand: "#EBCB8B", // Nord Aurora 13 (yellow) // Status Colors - success: "#8DB76A", - warning: "#E0B886", - danger: "#C87D7D", - info: "#8FADC4", + success: "#A3BE8C", // Nord Aurora 14 (green) + warning: "#EBCB8B", // Nord Aurora 13 (yellow) + danger: "#BF616A", // Nord Aurora 11 (red) + info: "#81A1C1", // Nord Frost 9 (blue) - // Neutrals - background: "#1C1F1D", // Deep warm black - surface: "#252926", // Warm dark gray - surfaceElevated: "#2D3330", // Elevated warm dark + // Neutrals (Polar Night palette) + background: "#2E3440", // Nord Polar Night 0 (darkest) + surface: "#3B4252", // Nord Polar Night 1 (medium dark) + surfaceElevated: "#434C5E", // Nord Polar Night 2 (lighter) - // Text - textPrimary: "#E8E6E1", // Warm off-white - textSecondary: "#B8BFB5", // Medium warm gray - textTertiary: "#7A8379", // Muted warm gray + // Text (Snow Storm palette) + textPrimary: "#ECEFF4", // Nord Snow Storm 3 (lightest) + textSecondary: "#E5E9F0", // Nord Snow Storm 2 + textTertiary: "#D8DEE9", // Nord Snow Storm 1 // Borders - border: "#3A3F3C", // Subtle dark border - borderLight: "#2F3432", // Ultra subtle + border: "#434C5E", // Nord Polar Night 2 + borderLight: "#3B4252", // Nord Polar Night 1 // Overlays overlay: "rgba(0, 0, 0, 0.6)", - overlayLight: "rgba(255, 255, 255, 0.05)", + overlayLight: "rgba(236, 239, 244, 0.05)", // Snow Storm 3 // Legacy - white: "#E8E6E1", - black: "#1C1F1D", + white: "#ECEFF4", + black: "#2E3440", }; /** From b1439f059a36a5f8e1396a4fa32fc8d99962b386 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 11 Mar 2026 08:47:14 +0100 Subject: [PATCH 03/11] fitness goals ui fix --- apps/mobile/src/app/(tabs)/goals.tsx | 8 +- .../src/components/GoalProgressCard.tsx | 524 +++++++++--------- 2 files changed, 257 insertions(+), 275 deletions(-) diff --git a/apps/mobile/src/app/(tabs)/goals.tsx b/apps/mobile/src/app/(tabs)/goals.tsx index db94423..d6c8acc 100644 --- a/apps/mobile/src/app/(tabs)/goals.tsx +++ b/apps/mobile/src/app/(tabs)/goals.tsx @@ -256,7 +256,12 @@ export default function GoalsScreen() { {showAnalytics && ( - + {statistics.weeklyTrend.length > 0 && ( void; - onComplete?: () => void; - onDelete?: () => void; + goal: FitnessGoal; + onPress?: () => void; + onComplete?: () => void; + onDelete?: () => void; } -export function GoalProgressCard({ goal, onPress, onComplete, onDelete }: GoalProgressCardProps) { - const isCompleted = goal.status === 'completed'; - const progress = goal.progress || 0; +export function GoalProgressCard({ + goal, + onPress, + onComplete, + onDelete, +}: GoalProgressCardProps) { + const { colors, typography } = useTheme(); + const isCompleted = goal.status === "completed"; + const progress = (goal.progress || 0) / 100; // Convert to 0-1 scale - // Calculate days remaining - const daysRemaining = goal.targetDate - ? Math.ceil((new Date(goal.targetDate).getTime() - Date.now()) / (1000 * 60 * 60 * 24)) - : null; + // Calculate days remaining + const daysRemaining = goal.targetDate + ? Math.ceil( + (new Date(goal.targetDate).getTime() - Date.now()) / + (1000 * 60 * 60 * 24), + ) + : null; - const getGoalTypeIcon = (type: string) => { - switch (type) { - case 'weight_target': return 'scale-outline'; - case 'strength_milestone': return 'barbell-outline'; - case 'endurance_target': return 'bicycle-outline'; - case 'flexibility_goal': return 'body-outline'; - case 'habit_building': return 'calendar-outline'; - default: return 'flag-outline'; - } - }; + const getGoalTypeIcon = (type: string) => { + switch (type) { + case "weight_target": + return "scale-outline"; + case "strength_milestone": + return "barbell-outline"; + case "endurance_target": + return "bicycle-outline"; + case "flexibility_goal": + return "body-outline"; + case "habit_building": + return "calendar-outline"; + default: + return "flag-outline"; + } + }; - const getPriorityGradient = (priority: string): readonly [string, string] => { - switch (priority) { - case 'high': return theme.gradients.danger; - case 'medium': return theme.gradients.warning; - case 'low': return theme.gradients.success; - default: return theme.gradients.primary; - } - }; + const getPriorityColor = (priority: string) => { + switch (priority) { + case "high": + return colors.danger; + case "medium": + return colors.warning; + case "low": + return colors.success; + default: + return colors.primary; + } + }; - const handleDelete = () => { - Alert.alert( - 'Delete Goal', - 'Are you sure you want to delete this goal?', - [ - { text: 'Cancel', style: 'cancel' }, - { text: 'Delete', style: 'destructive', onPress: onDelete }, - ] - ); - }; + const handleDelete = () => { + Alert.alert("Delete Goal", "Are you sure you want to delete this goal?", [ + { text: "Cancel", style: "cancel" }, + { text: "Delete", style: "destructive", onPress: onDelete }, + ]); + }; - return ( - - + + {/* Header */} + + + - {/* Priority Accent Bar */} - + + + + + {goal.title} + + {goal.description && ( + + {goal.description} + + )} + + + + {/* Action Buttons */} + + {!isCompleted && onComplete && ( + + + + )} + {onDelete && ( + + + + )} + + - - - - - - - - {goal.title} - - {goal.description && ( - - {goal.description} - - )} - - + {/* Progress Section */} + {goal.targetValue && ( + + + + {goal.currentValue || 0} / {goal.targetValue} {goal.unit || ""} + + + {(progress * 100).toFixed(0)}% + + - - {!isCompleted && onComplete && ( - - - - )} - {onDelete && ( - - - - )} - - + + + )} - {goal.targetValue && ( - - - - {goal.currentValue || 0} / {goal.targetValue} {goal.unit || ''} - - - {progress.toFixed(0)}% - - + {/* Footer */} + + {isCompleted ? ( + + ) : ( + + {goal.priority === "high" && ( + + )} + {goal.priority === "medium" && ( + + )} + {goal.priority === "low" && ( + + )} + + )} - - - - - )} + {daysRemaining !== null && !isCompleted && ( + + {daysRemaining < 0 + ? `${Math.abs(daysRemaining)} days overdue` + : `${daysRemaining} days remaining`} + + )} - - - {goal.priority.toUpperCase()} - - - {daysRemaining !== null && !isCompleted && ( - - {daysRemaining < 0 - ? `${Math.abs(daysRemaining)} days overdue` - : `${daysRemaining} days remaining` - } - - )} - - {isCompleted && goal.completedDate && ( - - Completed {new Date(goal.completedDate).toLocaleDateString()} - - )} - - - - ); + {isCompleted && goal.completedDate && ( + + Completed {new Date(goal.completedDate).toLocaleDateString()} + + )} + + + + ); } const styles = StyleSheet.create({ - card: { - borderRadius: theme.borderRadius.xl, - padding: 16, - marginBottom: 12, - borderWidth: 1, - borderColor: 'rgba(59, 130, 246, 0.1)', - overflow: 'hidden', - }, - cardCompleted: { - borderColor: 'rgba(16, 185, 129, 0.2)', - }, - priorityAccent: { - position: 'absolute', - left: 0, - top: 0, - bottom: 0, - width: 4, - }, - header: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'flex-start', - marginBottom: 12, - marginLeft: 8, - }, - titleRow: { - flexDirection: 'row', - alignItems: 'flex-start', - flex: 1, - }, - iconContainer: { - width: 40, - height: 40, - borderRadius: 20, - justifyContent: 'center', - alignItems: 'center', - marginRight: 12, - }, - titleContainer: { - flex: 1, - }, - title: { - fontSize: theme.typography.fontSize.lg, - fontWeight: theme.typography.fontWeight.semibold, - color: theme.colors.gray900, - marginBottom: 4, - }, - titleCompleted: { - color: theme.colors.gray600, - textDecorationLine: 'line-through', - }, - description: { - fontSize: theme.typography.fontSize.sm, - color: theme.colors.gray600, - lineHeight: 18, - }, - actions: { - flexDirection: 'row', - gap: 8, - }, - actionButton: { - padding: 4, - }, - progressSection: { - marginBottom: 12, - marginLeft: 8, - }, - progressInfo: { - flexDirection: 'row', - justifyContent: 'space-between', - marginBottom: 8, - }, - progressText: { - fontSize: theme.typography.fontSize.sm, - fontWeight: theme.typography.fontWeight.medium, - color: theme.colors.gray700, - }, - progressPercentage: { - fontSize: theme.typography.fontSize.sm, - fontWeight: theme.typography.fontWeight.semibold, - color: theme.colors.primary, - }, - progressBarContainer: { - height: 8, - backgroundColor: theme.colors.gray200, - borderRadius: 4, - overflow: 'hidden', - }, - progressBar: { - height: '100%', - borderRadius: 4, - }, - footer: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'space-between', - marginLeft: 8, - }, - priorityBadge: { - paddingHorizontal: 10, - paddingVertical: 5, - borderRadius: theme.borderRadius.md, - }, - priorityText: { - fontSize: theme.typography.fontSize.xs, - fontWeight: theme.typography.fontWeight.semibold, - color: theme.colors.white, - }, - daysRemaining: { - fontSize: theme.typography.fontSize.xs, - color: theme.colors.gray600, - fontWeight: theme.typography.fontWeight.medium, - }, - overdue: { - color: theme.colors.danger, - fontWeight: theme.typography.fontWeight.semibold, - }, - completedDate: { - fontSize: theme.typography.fontSize.xs, - color: theme.colors.success, - fontWeight: theme.typography.fontWeight.medium, - }, + card: { + marginBottom: 12, + }, + header: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "flex-start", + marginBottom: 12, + }, + titleRow: { + flexDirection: "row", + alignItems: "flex-start", + flex: 1, + }, + titleContainer: { + flex: 1, + marginLeft: 12, + }, + actions: { + flexDirection: "row", + gap: 8, + }, + actionButton: { + padding: 4, + }, + progressSection: { + marginBottom: 12, + }, + progressInfo: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + marginBottom: 8, + }, + footer: { + flexDirection: "row", + alignItems: "center", + justifyContent: "space-between", + }, }); From a5f761062ebb3f69281d917c46ca13387e60fad2 Mon Sep 17 00:00:00 2001 From: echo Date: Wed, 11 Mar 2026 08:55:05 +0100 Subject: [PATCH 04/11] goal creation style fix --- apps/admin/data/fitai.db | Bin 172032 -> 172032 bytes .../src/components/GoalCreationModal.tsx | 898 ++++++++++-------- 2 files changed, 499 insertions(+), 399 deletions(-) diff --git a/apps/admin/data/fitai.db b/apps/admin/data/fitai.db index 823a9751cbea5469abe50cef8187c1aa686cbfb1..25a5e7b590c9598546fa19c75bc1ca59ed022794 100644 GIT binary patch delta 89 zcmZoTz}0YoYl1Xm%0wAw#*~c-3(xcNJ!N3xOJ(3M void; - onSubmit: (goalData: CreateGoalData) => Promise; + visible: boolean; + onClose: () => void; + onSubmit: (goalData: CreateGoalData) => Promise; } const GOAL_TYPES = [ - { value: 'weight_target', label: 'Weight Target' }, - { value: 'strength_milestone', label: 'Strength Milestone' }, - { value: 'endurance_target', label: 'Endurance Target' }, - { value: 'flexibility_goal', label: 'Flexibility Goal' }, - { value: 'habit_building', label: 'Habit Building' }, - { value: 'custom', label: 'Custom Goal' }, + { value: "weight_target", label: "Weight Target" }, + { value: "strength_milestone", label: "Strength Milestone" }, + { value: "endurance_target", label: "Endurance Target" }, + { value: "flexibility_goal", label: "Flexibility Goal" }, + { value: "habit_building", label: "Habit Building" }, + { value: "custom", label: "Custom Goal" }, ] as const; const PRIORITIES = [ - { value: 'low', label: 'Low', color: '#10b981' }, - { value: 'medium', label: 'Medium', color: '#f59e0b' }, - { value: 'high', label: 'High', color: '#ef4444' }, + { value: "low", label: "Low" }, + { value: "medium", label: "Medium" }, + { value: "high", label: "High" }, ] as const; -export function GoalCreationModal({ visible, onClose, onSubmit }: GoalCreationModalProps) { - const [goalType, setGoalType] = useState('weight_target'); - const [title, setTitle] = useState(''); - const [description, setDescription] = useState(''); - const [targetValue, setTargetValue] = useState(''); - const [currentValue, setCurrentValue] = useState(''); - const [unit, setUnit] = useState(''); - const [priority, setPriority] = useState<'low' | 'medium' | 'high'>('medium'); - const [targetDate, setTargetDate] = useState(); - const [showDatePicker, setShowDatePicker] = useState(false); - const [submitting, setSubmitting] = useState(false); +export function GoalCreationModal({ + visible, + onClose, + onSubmit, +}: GoalCreationModalProps) { + const { colors, typography } = useTheme(); + const [goalType, setGoalType] = + useState("weight_target"); + const [title, setTitle] = useState(""); + const [description, setDescription] = useState(""); + const [targetValue, setTargetValue] = useState(""); + const [currentValue, setCurrentValue] = useState(""); + const [unit, setUnit] = useState(""); + const [priority, setPriority] = useState<"low" | "medium" | "high">("medium"); + const [targetDate, setTargetDate] = useState(); + const [showDatePicker, setShowDatePicker] = useState(false); + const [submitting, setSubmitting] = useState(false); - const resetForm = () => { - setGoalType('weight_target'); - setTitle(''); - setDescription(''); - setTargetValue(''); - setCurrentValue(''); - setUnit(''); - setPriority('medium'); - setTargetDate(undefined); - }; + const resetForm = () => { + setGoalType("weight_target"); + setTitle(""); + setDescription(""); + setTargetValue(""); + setCurrentValue(""); + setUnit(""); + setPriority("medium"); + setTargetDate(undefined); + }; - const handleSubmit = async () => { - if (!title.trim()) { - Alert.alert('Error', 'Please enter a goal title'); - return; - } + const handleSubmit = async () => { + if (!title.trim()) { + Alert.alert("Error", "Please enter a goal title"); + return; + } - setSubmitting(true); - try { - const goalData: CreateGoalData = { - goalType, - title: title.trim(), - description: description.trim() || undefined, - targetValue: targetValue ? parseFloat(targetValue) : undefined, - currentValue: currentValue ? parseFloat(currentValue) : undefined, - unit: unit.trim() || undefined, - targetDate: targetDate?.toISOString(), - priority, - }; + setSubmitting(true); + try { + const goalData: CreateGoalData = { + goalType, + title: title.trim(), + description: description.trim() || undefined, + targetValue: targetValue ? parseFloat(targetValue) : undefined, + currentValue: currentValue ? parseFloat(currentValue) : undefined, + unit: unit.trim() || undefined, + targetDate: targetDate?.toISOString(), + priority, + }; - await onSubmit(goalData); - resetForm(); - onClose(); - } catch (error) { - console.error('Error creating goal:', error); - Alert.alert('Error', 'Failed to create goal. Please try again.'); - } finally { - setSubmitting(false); - } - }; + await onSubmit(goalData); + resetForm(); + onClose(); + } catch (error) { + console.error("Error creating goal:", error); + Alert.alert("Error", "Failed to create goal. Please try again."); + } finally { + setSubmitting(false); + } + }; - const handleClose = () => { - resetForm(); - onClose(); - }; + const handleClose = () => { + resetForm(); + onClose(); + }; - return ( - { + switch (p) { + case "high": + return colors.danger; + case "medium": + return colors.warning; + case "low": + return colors.success; + } + }; + + return ( + + + - - - Create Fitness Goal - - - - + + Create Fitness Goal + + + + + - - {/* Goal Type */} - - Goal Type * - - {GOAL_TYPES.map((type) => ( - setGoalType(type.value)} - > - - {type.label} - - - ))} - - + + {/* Goal Type */} + + + Goal Type * + + + {GOAL_TYPES.map((type) => ( + setGoalType(type.value)} + > + + {type.label} + + + ))} + + - {/* Title */} - - Title * - - + {/* Title */} + + + Title * + + + - {/* Description */} - - Description - - + {/* Description */} + + + Description + + + - {/* Target Value & Unit */} - - - Target Value - - - - Unit - - - - - {/* Current Value */} - - Current Value - - - - {/* Target Date */} - - Target Date - setShowDatePicker(!showDatePicker)} - > - - {targetDate ? targetDate.toLocaleDateString() : 'Select target date'} - - - - - - {showDatePicker && ( - - { - setShowDatePicker(Platform.OS === 'ios'); - if (selectedDate) { - setTargetDate(selectedDate); - } - }} - minimumDate={new Date()} - themeVariant="light" - /> - - )} - - {/* Priority */} - - Priority - - {PRIORITIES.map((p) => ( - setPriority(p.value)} - > - - {p.label} - - - ))} - - - - - - - - {submitting ? 'Creating...' : 'Create Goal'} - - - + {/* Target Value & Unit */} + + + + Target Value + + - - ); + + + Unit + + + + + + {/* Current Value */} + + + Current Value + + + + + {/* Target Date */} + + + Target Date + + setShowDatePicker(!showDatePicker)} + > + + {targetDate + ? targetDate.toLocaleDateString() + : "Select target date"} + + + + + + {showDatePicker && ( + + { + setShowDatePicker(Platform.OS === "ios"); + if (selectedDate) { + setTargetDate(selectedDate); + } + }} + minimumDate={new Date()} + themeVariant="light" + /> + + )} + + {/* Priority */} + + + Priority + + + {PRIORITIES.map((p) => ( + setPriority(p.value)} + > + + {p.label} + + + ))} + + + + + + + + + + ); } const styles = StyleSheet.create({ - container: { - flex: 1, - backgroundColor: '#f9fafb', - }, - header: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - padding: 20, - paddingTop: Platform.OS === 'ios' ? 60 : 20, - backgroundColor: '#fff', - borderBottomWidth: 1, - borderBottomColor: '#e5e7eb', - }, - headerTitle: { - fontSize: 20, - fontWeight: '600', - color: '#111827', - }, - closeButton: { - padding: 4, - }, - content: { - flex: 1, - padding: 20, - }, - field: { - marginBottom: 20, - }, - label: { - fontSize: 14, - fontWeight: '600', - color: '#374151', - marginBottom: 8, - }, - input: { - backgroundColor: '#fff', - borderWidth: 1, - borderColor: '#d1d5db', - borderRadius: 8, - padding: 12, - fontSize: 16, - color: '#111827', - }, - textArea: { - height: 80, - textAlignVertical: 'top', - }, - row: { - flexDirection: 'row', - gap: 12, - }, - flex1: { - flex: 1, - }, - typeScroll: { - flexGrow: 0, - }, - typeButton: { - paddingHorizontal: 16, - paddingVertical: 8, - borderRadius: 8, - borderWidth: 1, - borderColor: '#d1d5db', - backgroundColor: '#fff', - marginRight: 8, - }, - typeButtonActive: { - backgroundColor: '#2563eb', - borderColor: '#2563eb', - }, - typeButtonText: { - fontSize: 14, - color: '#374151', - }, - typeButtonTextActive: { - color: '#fff', - fontWeight: '600', - }, - dateButton: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - backgroundColor: '#fff', - borderWidth: 1, - borderColor: '#d1d5db', - borderRadius: 8, - padding: 12, - }, - dateText: { - fontSize: 16, - color: '#111827', - }, - datePlaceholder: { - fontSize: 16, - color: '#9ca3af', - }, - priorityContainer: { - flexDirection: 'row', - gap: 12, - }, - priorityButton: { - flex: 1, - paddingVertical: 12, - borderRadius: 8, - borderWidth: 1, - borderColor: '#d1d5db', - backgroundColor: '#fff', - alignItems: 'center', - }, - priorityButtonText: { - fontSize: 14, - color: '#374151', - fontWeight: '500', - }, - priorityButtonTextActive: { - color: '#fff', - fontWeight: '600', - }, - footer: { - padding: 20, - paddingBottom: Platform.OS === 'ios' ? 40 : 20, - backgroundColor: '#fff', - borderTopWidth: 1, - borderTopColor: '#e5e7eb', - }, - submitButton: { - backgroundColor: '#2563eb', - borderRadius: 8, - padding: 16, - alignItems: 'center', - }, - submitButtonDisabled: { - opacity: 0.6, - }, - submitButtonText: { - fontSize: 16, - fontWeight: '600', - color: '#fff', - }, - datePickerContainer: { - backgroundColor: '#fff', - borderRadius: 8, - borderWidth: 1, - borderColor: '#d1d5db', - marginTop: 8, - overflow: 'hidden', - }, + container: { + flex: 1, + }, + header: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + padding: 20, + paddingTop: Platform.OS === "ios" ? 60 : 20, + borderBottomWidth: 1, + }, + closeButton: { + padding: 4, + }, + content: { + flex: 1, + padding: 20, + }, + field: { + marginBottom: 20, + }, + input: { + borderWidth: 1, + borderRadius: 8, + padding: 12, + fontSize: 16, + marginTop: 8, + }, + textArea: { + height: 80, + textAlignVertical: "top", + }, + row: { + flexDirection: "row", + gap: 12, + }, + flex1: { + flex: 1, + }, + typeScroll: { + flexGrow: 0, + marginTop: 8, + }, + typeButton: { + paddingHorizontal: 16, + paddingVertical: 8, + borderRadius: 8, + borderWidth: 1, + marginRight: 8, + }, + dateButton: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + borderWidth: 1, + borderRadius: 8, + padding: 12, + marginTop: 8, + }, + priorityContainer: { + flexDirection: "row", + gap: 12, + marginTop: 8, + }, + priorityButton: { + flex: 1, + paddingVertical: 12, + borderRadius: 8, + borderWidth: 1, + alignItems: "center", + }, + footer: { + padding: 20, + paddingBottom: Platform.OS === "ios" ? 40 : 20, + borderTopWidth: 1, + }, + submitButton: { + width: "100%", + }, + datePickerContainer: { + borderRadius: 8, + borderWidth: 1, + marginTop: 8, + overflow: "hidden", + }, }); From 981208ab7be51ca360d80e8e7e146a23631d8b19 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 12 Mar 2026 15:32:52 +0100 Subject: [PATCH 05/11] redesign checkpoint --- apps/admin/data/fitai.db | Bin 172032 -> 172032 bytes apps/mobile/src/app/(tabs)/attendance.tsx | 43 +- apps/mobile/src/app/(tabs)/goals.tsx | 35 +- apps/mobile/src/app/(tabs)/index.tsx | 436 ++++++++++++++---- .../mobile/src/app/(tabs)/recommendations.tsx | 36 +- .../src/components/GoalProgressCard.tsx | 331 +++++++------ 6 files changed, 583 insertions(+), 298 deletions(-) diff --git a/apps/admin/data/fitai.db b/apps/admin/data/fitai.db index 25a5e7b590c9598546fa19c75bc1ca59ed022794..d0afb89685d1167da2cb262f26e626b34eb4624a 100644 GIT binary patch delta 128 zcmZoTz}0YoYl1Xm+C&*=#->noNsdKy=I|CHfCX8 zUj}u421Z6f78VwH#>r*(;v_RSDkmrB=N9ComZYYn65L#P|9CwUC(HCZ g`HU*t - Attendance + 📍 Attendance - Track your gym visits + {activeCheckIn + ? "You're crushing it today! 💪" + : history.length === 0 + ? "Ready to start your fitness journey? 🚀" + : "Track your gym visits and build streaks! 🔥"} {/* Check In/Out Section */} {activeCheckIn ? ( - + - Currently Checked In + ✅ Currently Checked In ) : ( - - + + {/* Recent History */} - + {history.length === 0 ? ( - + - - - + 📍 - Your check-in history will appear here + Check in to start building your streak! 🔥 @@ -232,7 +226,11 @@ export default function AttendanceScreen() { : null; return ( - + - Fitness Goals + 🎯 Fitness Goals - Track your fitness journey progress + {activeGoals.length === 0 + ? "Ready to crush some goals? 💪" + : activeGoals.length === 1 + ? "You're on a mission! Keep it up! 🚀" + : `${activeGoals.length} goals in progress. Legend! ⭐`} 0 && ( - + {activeGoals.length} @@ -189,11 +193,11 @@ export default function GoalsScreen() { { color: colors.textTertiary, marginTop: 4 }, ]} > - Active + 🎯 Active - + {completedGoals.length} @@ -203,11 +207,11 @@ export default function GoalsScreen() { { color: colors.textTertiary, marginTop: 4 }, ]} > - Completed + {completedGoals.length >= 5 ? "🏆" : "✅"} Completed - + {avgProgress}% @@ -217,7 +221,7 @@ export default function GoalsScreen() { { color: colors.textTertiary, marginTop: 4 }, ]} > - Avg Progress + {avgProgress >= 75 ? "🔥" : "📊"} Progress @@ -245,7 +249,7 @@ export default function GoalsScreen() { { color: colors.textPrimary, marginLeft: 8 }, ]} > - Progress Analytics + 📈 Progress Analytics setIsModalVisible(true)} /> {activeGoals.length === 0 ? ( - + 🎯 - Tap "Add New" to create your first goal + Tap "Add New" to set your first goal! 💪 @@ -331,7 +331,7 @@ export default function GoalsScreen() { {completedGoals.length > 0 && ( {completedGoals.map((goal) => ( @@ -405,6 +405,7 @@ const styles = StyleSheet.create({ flex: 1, alignItems: "center", paddingVertical: 20, + borderRadius: 20, }, analyticsHeader: { flexDirection: "row", diff --git a/apps/mobile/src/app/(tabs)/index.tsx b/apps/mobile/src/app/(tabs)/index.tsx index 9dda6d7..8aa8a0b 100644 --- a/apps/mobile/src/app/(tabs)/index.tsx +++ b/apps/mobile/src/app/(tabs)/index.tsx @@ -5,9 +5,11 @@ import { ScrollView, RefreshControl, Image, + Animated, + TouchableOpacity, } from "react-native"; import { useUser } from "@clerk/clerk-expo"; -import { useState, useCallback, useEffect } from "react"; +import { useState, useCallback, useEffect, useRef } from "react"; import { useFocusEffect } from "@react-navigation/native"; import AsyncStorage from "@react-native-async-storage/async-storage"; import { Ionicons } from "@expo/vector-icons"; @@ -36,6 +38,11 @@ export default function HomeScreen() { const [calories, setCalories] = useState(0); const [waterIntake, setWaterIntake] = useState(0); + // Animation values + const streakPulse = useRef(new Animated.Value(1)).current; + const caloriesBounce = useRef(new Animated.Value(1)).current; + const waterBounce = useRef(new Animated.Value(1)).current; + // Refetch statistics when screen comes into focus useFocusEffect( useCallback(() => { @@ -51,9 +58,46 @@ export default function HomeScreen() { const getGreeting = () => { const hour = new Date().getHours(); - if (hour < 12) return "Good Morning"; - if (hour < 18) return "Good Afternoon"; - return "Good Evening"; + const greetings = { + morning: [ + "Rise and Shine", + "Good Morning", + "Morning Champion", + "Ready to Crush It", + ], + afternoon: [ + "Keep It Going", + "Good Afternoon", + "Stay Strong", + "You're Doing Great", + ], + evening: [ + "Evening Warrior", + "Good Evening", + "Almost There", + "Finish Strong", + ], + }; + + const randomGreeting = (arr: string[]) => + arr[Math.floor(Math.random() * arr.length)]; + + if (hour < 12) return randomGreeting(greetings.morning); + if (hour < 18) return randomGreeting(greetings.afternoon); + return randomGreeting(greetings.evening); + }; + + const getMotivationalEmoji = () => { + const emojis = ["💪", "🔥", "⚡", "🎯", "🚀", "✨"]; + return emojis[Math.floor(Math.random() * emojis.length)]; + }; + + const getStreakBadge = (streak: number) => { + if (streak >= 30) return "🏆"; + if (streak >= 14) return "🔥"; + if (streak >= 7) return "⭐"; + if (streak >= 3) return "🌟"; + return "💫"; }; const handleSaveMeal = (meal: { @@ -63,11 +107,39 @@ export default function HomeScreen() { }) => { setCalories((prev) => prev + meal.calories); setTrackMealModalVisible(false); + + // Bounce animation + Animated.sequence([ + Animated.timing(caloriesBounce, { + toValue: 1.2, + duration: 150, + useNativeDriver: true, + }), + Animated.timing(caloriesBounce, { + toValue: 1, + duration: 150, + useNativeDriver: true, + }), + ]).start(); }; const handleAddWater = (amount: number) => { setWaterIntake((prev) => prev + amount); setAddWaterModalVisible(false); + + // Bounce animation + Animated.sequence([ + Animated.timing(waterBounce, { + toValue: 1.2, + duration: 150, + useNativeDriver: true, + }), + Animated.timing(waterBounce, { + toValue: 1, + duration: 150, + useNativeDriver: true, + }), + ]).start(); }; const handleResetCalories = () => { @@ -130,6 +202,9 @@ export default function HomeScreen() { persistWater(); }, [waterIntake]); + const checkInsThisWeek = statistics?.attendance.checkInsThisWeek || 0; + const currentStreak = statistics?.attendance.currentStreak || 0; + // Check for midnight reset useEffect(() => { const checkAndResetIfNeeded = async () => { @@ -167,8 +242,29 @@ export default function HomeScreen() { return () => clearTimeout(midnightTimer); }, []); - const checkInsThisWeek = statistics?.attendance.checkInsThisWeek || 0; - const currentStreak = statistics?.attendance.currentStreak || 0; + // Streak pulse animation + useEffect(() => { + const pulse = Animated.loop( + Animated.sequence([ + Animated.timing(streakPulse, { + toValue: 1.1, + duration: 1000, + useNativeDriver: true, + }), + Animated.timing(streakPulse, { + toValue: 1, + duration: 1000, + useNativeDriver: true, + }), + ]), + ); + + if (currentStreak >= 3) { + pulse.start(); + } + + return () => pulse.stop(); + }, [currentStreak]); return ( @@ -184,20 +280,30 @@ export default function HomeScreen() { > {/* Header Section */} - - - {getGreeting()}, - + + {getGreeting()} {getMotivationalEmoji()} + + {user?.firstName || "Athlete"} + {currentStreak >= 3 && ( + + + {getStreakBadge(currentStreak)} {currentStreak} Day Streak! + + + )} - + {user?.imageUrl ? ( ) : ( @@ -210,193 +316,273 @@ export default function HomeScreen() { )} - + - {/* Daily Stats Card */} + {/* Daily Stats Card - More Playful */} - + {checkInsThisWeek} - This Week + Check-ins{"\n"}This Week - + - + {calories} - Kcal + Calories{"\n"}Tracked - + - + - + + {getStreakBadge(currentStreak)} + {currentStreak} - Day Streak + Day{"\n"}Streak - + - {/* Quick Actions */} + {/* Quick Actions - More Playful */} - + - { - console.log("Log workout tapped"); - }} - style={styles.actionCard} + console.log("Log workout tapped")} + activeOpacity={0.7} + style={[ + styles.actionCard, + { + backgroundColor: `${colors.primary}15`, + borderColor: `${colors.primary}30`, + borderWidth: 2, + }, + ]} > - + - Log Workout + 💪 Workout - + - setTrackMealModalVisible(true)} - style={styles.actionCard} + activeOpacity={0.7} + style={[ + styles.actionCard, + { + backgroundColor: `${colors.success}15`, + borderColor: `${colors.success}30`, + borderWidth: 2, + }, + ]} > - + - Track Meal + 🍽️ Track Meal - + - setAddWaterModalVisible(true)} - style={styles.actionCard} + activeOpacity={0.7} + style={[ + styles.actionCard, + { + backgroundColor: `${colors.info}15`, + borderColor: `${colors.info}30`, + borderWidth: 2, + }, + ]} > - - - + + + + + - Add Water + 💧 Add Water - + - setScanFoodModalVisible(true)} - style={styles.actionCard} + activeOpacity={0.7} + style={[ + styles.actionCard, + { + backgroundColor: `${colors.accent}15`, + borderColor: `${colors.accent}30`, + borderWidth: 2, + }, + ]} > - + - Scan Food + 📱 Scan Food - + - {/* Nutrition Progress */} + {/* Nutrition Progress - More Playful */} - - + = CALORIE_GOAL + ? "Goal smashed! 🎉" + : calories >= CALORIE_GOAL * 0.75 + ? "Almost there! Keep going 💪" + : "Let's fuel that body! 🔥" + } + /> + - + 🔥 {calories} / {CALORIE_GOAL} - {/* Hydration Progress */} + {/* Hydration Progress - More Playful */} - + - - - Hydration - + 💧 + + + Hydration + + + {waterIntake >= WATER_GOAL + ? "Perfectly hydrated! 🌊" + : "Stay hydrated, champ! 💪"} + + {waterIntake} / {WATER_GOAL} ml @@ -557,14 +762,33 @@ const styles = StyleSheet.create({ header: { flexDirection: "row", justifyContent: "space-between", - alignItems: "center", + alignItems: "flex-start", paddingHorizontal: 24, marginBottom: 24, }, + greetingContainer: { + flex: 1, + marginRight: 16, + }, + streakBadge: { + marginTop: 8, + paddingHorizontal: 12, + paddingVertical: 6, + backgroundColor: "rgba(136, 192, 208, 0.15)", + borderRadius: 999, + alignSelf: "flex-start", + }, + streakBadgeText: { + fontSize: 13, + fontWeight: "600", + color: "#88C0D0", + }, avatar: { width: 56, height: 56, borderRadius: 28, + borderWidth: 3, + borderColor: "#88C0D0", }, placeholderAvatar: { width: 56, @@ -572,15 +796,21 @@ const styles = StyleSheet.create({ borderRadius: 28, justifyContent: "center", alignItems: "center", + borderWidth: 3, + borderColor: "#88C0D0", }, section: { paddingHorizontal: 24, marginBottom: 24, }, + statsCard: { + borderRadius: 20, + }, statsRow: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", + paddingVertical: 8, }, statItem: { alignItems: "center", @@ -588,7 +818,10 @@ const styles = StyleSheet.create({ }, divider: { width: 1, - height: 60, + height: 70, + }, + emojiIcon: { + fontSize: 28, }, actionGrid: { flexDirection: "row", @@ -598,7 +831,8 @@ const styles = StyleSheet.create({ actionCard: { width: "48%", alignItems: "center", - paddingVertical: 20, + paddingVertical: 24, + borderRadius: 20, }, progressHeader: { flexDirection: "row", diff --git a/apps/mobile/src/app/(tabs)/recommendations.tsx b/apps/mobile/src/app/(tabs)/recommendations.tsx index 2594d2a..4ce68e2 100644 --- a/apps/mobile/src/app/(tabs)/recommendations.tsx +++ b/apps/mobile/src/app/(tabs)/recommendations.tsx @@ -132,7 +132,7 @@ export default function RecommendationsScreen() { - AI Recommendations + ✨ AI Recommendations - Personalized fitness & nutrition plans + {recommendations.length === 0 + ? "Let's create your perfect plan! 🚀" + : `${recommendations.length} plan${recommendations.length !== 1 ? "s" : ""} ready for you! 💪`} 0 ? `${recommendations.length} active plan${recommendations.length !== 1 ? "s" : ""}` @@ -194,19 +196,9 @@ export default function RecommendationsScreen() { /> {recommendations.length === 0 ? ( - + - - - + 🤖 Tap "Generate New Plan" to get personalized AI-powered fitness - and nutrition recommendations based on your profile and goals. + and nutrition recommendations! 🎯 @@ -258,7 +250,7 @@ function RecommendationCard({ recommendation }: RecommendationCardProps) { const [expanded, setExpanded] = useState(false); return ( - + {/* Header */} setExpanded(!expanded)} @@ -278,7 +270,7 @@ function RecommendationCard({ recommendation }: RecommendationCardProps) { - AI Fitness Plan + ✨ AI Fitness Plan {new Date(recommendation.generatedAt).toLocaleDateString()} @@ -320,7 +312,7 @@ function RecommendationCard({ recommendation }: RecommendationCardProps) { { color: colors.textPrimary, marginLeft: 8 }, ]} > - Activity Plan + 💪 Activity Plan - Diet Plan + 🍽️ Diet Plan { + if (isCompleted) { + Animated.sequence([ + Animated.spring(scaleAnim, { + toValue: 1.05, + friction: 3, + tension: 40, + useNativeDriver: true, + }), + Animated.spring(scaleAnim, { + toValue: 1, + friction: 3, + tension: 40, + useNativeDriver: true, + }), + ]).start(); + } + }, [isCompleted]); + + const handleComplete = () => { + if (onComplete) { + // Trigger celebration animation + Animated.sequence([ + Animated.spring(scaleAnim, { + toValue: 1.1, + friction: 3, + tension: 40, + useNativeDriver: true, + }), + Animated.spring(scaleAnim, { + toValue: 1, + friction: 3, + tension: 40, + useNativeDriver: true, + }), + ]).start(() => { + onComplete(); + }); + } + }; // Calculate days remaining const daysRemaining = goal.targetDate @@ -71,160 +121,169 @@ export function GoalProgressCard({ }; return ( - - - {/* Header */} - - - - - - - - + + + {/* Header */} + + + - {goal.title} - - {goal.description && ( + + + + - {goal.description} + {goal.title} + {goal.description && ( + + {goal.description} + + )} + + + + {/* Action Buttons */} + + {!isCompleted && onComplete && ( + + + + )} + {onDelete && ( + + + )} - {/* Action Buttons */} - - {!isCompleted && onComplete && ( - - - - )} - {onDelete && ( - - - - )} - - + {/* Progress Section */} + {goal.targetValue && ( + + + + {goal.currentValue || 0} / {goal.targetValue}{" "} + {goal.unit || ""} + + + {(progress * 100).toFixed(0)}% + + - {/* Progress Section */} - {goal.targetValue && ( - - - - {goal.currentValue || 0} / {goal.targetValue} {goal.unit || ""} - + + + )} + + {/* Footer */} + + {isCompleted ? ( + + ) : ( + + {goal.priority === "high" && ( + + )} + {goal.priority === "medium" && ( + + )} + {goal.priority === "low" && ( + + )} + + )} + + {daysRemaining !== null && !isCompleted && ( - {(progress * 100).toFixed(0)}% + {daysRemaining < 0 + ? `${Math.abs(daysRemaining)} days overdue` + : `${daysRemaining} days remaining`} - + )} - + {isCompleted && goal.completedDate && ( + + Completed {new Date(goal.completedDate).toLocaleDateString()} + + )} - )} - - {/* Footer */} - - {isCompleted ? ( - - ) : ( - - {goal.priority === "high" && ( - - )} - {goal.priority === "medium" && ( - - )} - {goal.priority === "low" && ( - - )} - - )} - - {daysRemaining !== null && !isCompleted && ( - - {daysRemaining < 0 - ? `${Math.abs(daysRemaining)} days overdue` - : `${daysRemaining} days remaining`} - - )} - - {isCompleted && goal.completedDate && ( - - Completed {new Date(goal.completedDate).toLocaleDateString()} - - )} - - - + + + ); } From 96db3ea3b738808289f3225be07cd6bbb79a3bb0 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 12 Mar 2026 16:25:57 +0100 Subject: [PATCH 06/11] recent activity feed updated, now showing real data --- apps/admin/data/fitai.db | Bin 172032 -> 172032 bytes apps/mobile/src/app/(tabs)/index.tsx | 187 +++++++++++++++------- apps/mobile/src/utils/activityFeed.ts | 220 ++++++++++++++++++++++++++ 3 files changed, 351 insertions(+), 56 deletions(-) create mode 100644 apps/mobile/src/utils/activityFeed.ts diff --git a/apps/admin/data/fitai.db b/apps/admin/data/fitai.db index d0afb89685d1167da2cb262f26e626b34eb4624a..4915813e455662ce069d3a76065ab2b6df7d8585 100644 GIT binary patch delta 311 zcmZoTz}0YoYl1Xm#zYxs#*B>#OZr7Pc)u|4@8hrGx8nQ3w~eoa&xrTSW<`ZNyuvmd z9P+*_48ja7rY6}1xjE_OhLbPOSLE7st3SOmHxo#0Hkx;dk%NPOA_Mb^Q!vf7pE#12YIJwZo2U- zbKf?D#N?99veewvl+03~yMSUqy!pjFNk(1<1_oySNeukk`S0*g+AQeM!asS^dsS5x UW?x1^*0D6-dB6S6dq$NF0Pv?}-~a#s delta 202 zcmZoTz}0YoYl1Xm+C&*=#8Tk-wi+s0SIXS7*SL56R$(Y#BH zZ0!8=8Ti+3=2_6nKXHM;=K1SW6}XuAUNG<%^1a|o1u6{Z6Rcwv_Vr~@=VxGK6l7sx zkmQ*B>t38lVsc4lS!zyxdFDp`;~>nyz_9tnJxNAh{_PA*{F4~?@9C6w4$dBePWVWXlv|Q diff --git a/apps/mobile/src/app/(tabs)/index.tsx b/apps/mobile/src/app/(tabs)/index.tsx index 8aa8a0b..d630d89 100644 --- a/apps/mobile/src/app/(tabs)/index.tsx +++ b/apps/mobile/src/app/(tabs)/index.tsx @@ -9,12 +9,13 @@ import { TouchableOpacity, } from "react-native"; import { useUser } from "@clerk/clerk-expo"; -import { useState, useCallback, useEffect, useRef } from "react"; +import { useState, useCallback, useEffect, useRef, useMemo } from "react"; import { useFocusEffect } from "@react-navigation/native"; import AsyncStorage from "@react-native-async-storage/async-storage"; import { Ionicons } from "@expo/vector-icons"; import { useTheme } from "../../contexts/ThemeContext"; import { useStatistics } from "../../contexts/StatisticsContext"; +import { useFitnessGoals } from "../../contexts/FitnessGoalsContext"; import { MinimalCard } from "../../components/MinimalCard"; import { SectionHeader } from "../../components/SectionHeader"; import { IconContainer } from "../../components/IconContainer"; @@ -22,6 +23,18 @@ import { ProgressBar } from "../../components/ProgressBar"; import { TrackMealModal } from "../../components/TrackMealModal"; import { AddWaterModal } from "../../components/AddWaterModal"; import { ScanFoodModal } from "../../components/ScanFoodModal"; +import { + checkInsToActivities, + completedGoalsToActivities, + newGoalsToActivities, + combineActivities, + getRecentActivities, + formatActivityTime, + formatDuration, + getActivityIcon, + getActivityEmoji, + ActivityType, +} from "../../utils/activityFeed"; const CALORIE_GOAL = 2000; // kcal const WATER_GOAL = 2000; // ml @@ -31,6 +44,7 @@ export default function HomeScreen() { const { colors, typography } = useTheme(); const { refetchStatistics, forceRefresh, statistics, loading } = useStatistics(); + const { goals } = useFitnessGoals(); const [refreshing, setRefreshing] = useState(false); const [trackMealModalVisible, setTrackMealModalVisible] = useState(false); const [addWaterModalVisible, setAddWaterModalVisible] = useState(false); @@ -205,6 +219,29 @@ export default function HomeScreen() { const checkInsThisWeek = statistics?.attendance.checkInsThisWeek || 0; const currentStreak = statistics?.attendance.currentStreak || 0; + // Combine activities from multiple sources + const recentActivities = useMemo(() => { + if (!statistics || !goals) return []; + + const checkInActivities = checkInsToActivities(statistics.attendance).slice( + 0, + 2, + ); // Only last 2 check-ins + const completedGoalActivities = completedGoalsToActivities(goals).slice( + 0, + 2, + ); // Only last 2 completed goals + const newGoalActivities = newGoalsToActivities(goals, 7); // Last 7 days + + const allActivities = combineActivities( + checkInActivities, + completedGoalActivities, + newGoalActivities, + ); + + return getRecentActivities(allActivities, 5); // Show top 5 + }, [statistics, goals]); + // Check for midnight reset useEffect(() => { const checkAndResetIfNeeded = async () => { @@ -657,72 +694,104 @@ export default function HomeScreen() { {/* Recent Activity */} console.log("See all tapped")} + title="📊 Recent Activity" + subtitle={ + recentActivities.length === 0 + ? "Your activity will appear here" + : `${recentActivities.length} recent activities` + } /> - - - - - - - - Upper Body Power + {recentActivities.length === 0 ? ( + + + 🏃 + + No Recent Activity - Today, 10:00 AM + Check in at the gym or complete a goal to get started! 💪 - - 45m - + ) : ( + + {recentActivities.map((activity) => { + const iconName = getActivityIcon(activity.type); + const emoji = getActivityEmoji(activity.type); + const timeStr = formatActivityTime(activity.timestamp); + const durationStr = formatDuration(activity.duration); - - - - - - - Morning Cardio - - - Yesterday, 7:30 AM - - - - 30m - - - + // Determine color based on activity type + let iconColor = colors.primary; + if (activity.type === ActivityType.GOAL_COMPLETED) { + iconColor = colors.success; + } else if (activity.type === ActivityType.GOAL_CREATED) { + iconColor = colors.accent; + } else if (activity.type === ActivityType.GYM_CHECKIN) { + iconColor = colors.primary; + } + + return ( + + + + + + + {emoji} {activity.title} + + + {timeStr} + + + {durationStr && ( + + {durationStr} + + )} + + ); + })} + + )} ; +} + +/** + * Convert attendance check-ins to activity items + */ +export function checkInsToActivities( + attendance: AttendanceStatistics, +): ActivityItem[] { + return attendance.recentCheckIns.map((checkIn) => { + const checkInDate = new Date(checkIn.checkInTime); + + return { + id: `checkin-${checkIn.id}`, + type: ActivityType.GYM_CHECKIN, + title: "Gym Check-in", + timestamp: checkInDate, + duration: checkIn.duration || undefined, + metadata: { + checkOutTime: checkIn.checkOutTime, + }, + }; + }); +} + +/** + * Convert completed goals to activity items + */ +export function completedGoalsToActivities( + goals: FitnessGoal[], +): ActivityItem[] { + return goals + .filter((goal) => goal.status === "completed" && goal.completedDate) + .map((goal) => { + const completedDate = new Date(goal.completedDate!); + + return { + id: `goal-completed-${goal.id}`, + type: ActivityType.GOAL_COMPLETED, + title: goal.title, + timestamp: completedDate, + metadata: { + goalType: goal.goalType, + priority: goal.priority, + targetValue: goal.targetValue, + unit: goal.unit, + }, + }; + }); +} + +/** + * Convert recently created goals to activity items + */ +export function newGoalsToActivities( + goals: FitnessGoal[], + daysBack: number = 7, +): ActivityItem[] { + const cutoffDate = new Date(); + cutoffDate.setDate(cutoffDate.getDate() - daysBack); + + return goals + .filter((goal) => { + const createdDate = new Date(goal.createdAt); + return goal.status === "active" && createdDate > cutoffDate; + }) + .map((goal) => { + const createdDate = new Date(goal.createdAt); + + return { + id: `goal-created-${goal.id}`, + type: ActivityType.GOAL_CREATED, + title: goal.title, + timestamp: createdDate, + metadata: { + goalType: goal.goalType, + priority: goal.priority, + }, + }; + }); +} + +/** + * Combine and sort all activities by timestamp (most recent first) + */ +export function combineActivities( + ...activityGroups: ActivityItem[][] +): ActivityItem[] { + const allActivities = activityGroups.flat(); + + return allActivities.sort( + (a, b) => b.timestamp.getTime() - a.timestamp.getTime(), + ); +} + +/** + * Get recent activities limited to a specific count + */ +export function getRecentActivities( + activities: ActivityItem[], + limit: number = 5, +): ActivityItem[] { + return activities.slice(0, limit); +} + +/** + * Format activity timestamp for display + */ +export function formatActivityTime(timestamp: Date): string { + const now = new Date(); + const diffMs = now.getTime() - timestamp.getTime(); + const diffMins = Math.floor(diffMs / 60000); + const diffHours = Math.floor(diffMs / 3600000); + const diffDays = Math.floor(diffMs / 86400000); + + // Today + if (diffDays === 0) { + if (diffMins < 60) { + return diffMins <= 1 ? "Just now" : `${diffMins}m ago`; + } + return `Today, ${timestamp.toLocaleTimeString([], { + hour: "2-digit", + minute: "2-digit", + })}`; + } + + // Yesterday + if (diffDays === 1) { + return `Yesterday, ${timestamp.toLocaleTimeString([], { + hour: "2-digit", + minute: "2-digit", + })}`; + } + + // This week (within 7 days) + if (diffDays < 7) { + return `${diffDays}d ago`; + } + + // Older + return timestamp.toLocaleDateString(); +} + +/** + * Format duration in minutes to human-readable string + */ +export function formatDuration(minutes?: number): string | undefined { + if (!minutes) return undefined; + + if (minutes < 60) { + return `${minutes}m`; + } + + const hours = Math.floor(minutes / 60); + const mins = minutes % 60; + + if (mins === 0) { + return `${hours}h`; + } + + return `${hours}h ${mins}m`; +} + +/** + * Get icon name for activity type + */ +export function getActivityIcon(type: ActivityType): string { + switch (type) { + case ActivityType.GYM_CHECKIN: + return "barbell"; + case ActivityType.GOAL_COMPLETED: + return "trophy"; + case ActivityType.GOAL_CREATED: + return "flag"; + case ActivityType.NUTRITION_MILESTONE: + return "restaurant"; + default: + return "checkmark-circle"; + } +} + +/** + * Get activity title prefix/emoji + */ +export function getActivityEmoji(type: ActivityType): string { + switch (type) { + case ActivityType.GYM_CHECKIN: + return "💪"; + case ActivityType.GOAL_COMPLETED: + return "🏆"; + case ActivityType.GOAL_CREATED: + return "🎯"; + case ActivityType.NUTRITION_MILESTONE: + return "🍽️"; + default: + return "✅"; + } +} From 254a30ff93bce881ade7116ae1c33b765c1cd5a7 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 12 Mar 2026 16:45:38 +0100 Subject: [PATCH 07/11] fitness profile validation error fixed --- apps/mobile/src/app/fitness-profile.tsx | 308 ++++++++++++++++-------- 1 file changed, 208 insertions(+), 100 deletions(-) diff --git a/apps/mobile/src/app/fitness-profile.tsx b/apps/mobile/src/app/fitness-profile.tsx index dfcbc12..4252097 100644 --- a/apps/mobile/src/app/fitness-profile.tsx +++ b/apps/mobile/src/app/fitness-profile.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect } from "react"; import { View, Text, @@ -9,13 +9,13 @@ import { Alert, TextInput, Platform, -} from 'react-native'; -import { useRouter, Stack } from 'expo-router'; -import { useAuth } from '@clerk/clerk-expo'; -import { Ionicons } from '@expo/vector-icons'; -import { LinearGradient } from 'expo-linear-gradient'; -import { theme } from '../styles/theme'; -import { API_BASE_URL } from '../config/api'; +} from "react-native"; +import { useRouter, Stack } from "expo-router"; +import { useAuth } from "@clerk/clerk-expo"; +import { Ionicons } from "@expo/vector-icons"; +import { LinearGradient } from "expo-linear-gradient"; +import { theme } from "../styles/theme"; +import { API_BASE_URL } from "../config/api"; interface FitnessProfileData { height?: number; @@ -30,25 +30,71 @@ interface FitnessProfileData { } const GENDER_OPTIONS = [ - { label: 'Male', value: 'male', icon: 'male' }, - { label: 'Female', value: 'female', icon: 'female' }, - { label: 'Other', value: 'other', icon: 'transgender' }, + { label: "Male", value: "male", icon: "male" }, + { label: "Female", value: "female", icon: "female" }, + { label: "Other", value: "other", icon: "transgender" }, + { + label: "Prefer not to say", + value: "prefer_not_to_say", + icon: "help-circle", + }, ]; const FITNESS_GOAL_OPTIONS = [ - { label: 'Weight Loss', value: 'weight_loss', icon: 'trending-down', color: theme.colors.danger }, - { label: 'Muscle Gain', value: 'muscle_gain', icon: 'barbell', color: theme.colors.primary }, - { label: 'Endurance', value: 'endurance', icon: 'bicycle', color: theme.colors.success }, - { label: 'Flexibility', value: 'flexibility', icon: 'body', color: theme.colors.purple }, - { label: 'General Fitness', value: 'general_fitness', icon: 'fitness', color: theme.colors.warning }, + { + label: "Weight Loss", + value: "weight_loss", + icon: "trending-down", + color: theme.colors.danger, + }, + { + label: "Muscle Gain", + value: "muscle_gain", + icon: "barbell", + color: theme.colors.primary, + }, + { + label: "Endurance", + value: "endurance", + icon: "bicycle", + color: theme.colors.success, + }, + { + label: "Flexibility", + value: "flexibility", + icon: "body", + color: theme.colors.purple, + }, + { + label: "General Fitness", + value: "general_fitness", + icon: "fitness", + color: theme.colors.warning, + }, ]; const ACTIVITY_LEVEL_OPTIONS = [ - { label: 'Sedentary', value: 'sedentary', description: 'Little to no exercise' }, - { label: 'Light', value: 'light', description: '1-3 days/week' }, - { label: 'Moderate', value: 'moderate', description: '3-5 days/week' }, - { label: 'Active', value: 'active', description: '6-7 days/week' }, - { label: 'Very Active', value: 'very_active', description: 'Intense daily training' }, + { + label: "Sedentary", + value: "sedentary", + description: "Little to no exercise", + }, + { + label: "Lightly Active", + value: "lightly_active", + description: "1-3 days/week", + }, + { + label: "Moderately Active", + value: "moderately_active", + description: "3-5 days/week", + }, + { label: "Very Active", value: "very_active", description: "6-7 days/week" }, + { + label: "Extremely Active", + value: "extremely_active", + description: "Intense daily training", + }, ]; export default function FitnessProfileScreen() { @@ -66,34 +112,43 @@ export default function FitnessProfileScreen() { try { setFetchingProfile(true); const token = await getToken(); - const response = await fetch(`${API_BASE_URL}/api/profile/fitness?userId=${userId}`, { - headers: { - Authorization: `Bearer ${token}`, + const response = await fetch( + `${API_BASE_URL}/api/profile/fitness?userId=${userId}`, + { + headers: { + Authorization: `Bearer ${token}`, + }, }, - }); + ); if (response.ok) { const data = await response.json(); if (data.profile) { + // Normalize old activity level values to new schema + let activityLevel = data.profile.activityLevel || ""; + if (activityLevel === "light") activityLevel = "lightly_active"; + if (activityLevel === "moderate") activityLevel = "moderately_active"; + if (activityLevel === "active") activityLevel = "very_active"; + setProfileData({ height: data.profile.height, weight: data.profile.weight, age: data.profile.age, - gender: data.profile.gender || '', + gender: data.profile.gender || "", fitnessGoal: Array.isArray(data.profile.fitnessGoals) ? data.profile.fitnessGoals[0] - : (typeof data.profile.fitnessGoals === 'string' + : typeof data.profile.fitnessGoals === "string" ? JSON.parse(data.profile.fitnessGoals)[0] - : ''), - activityLevel: data.profile.activityLevel || '', - medicalConditions: data.profile.medicalConditions || '', - allergies: data.profile.allergies || '', - injuries: data.profile.injuries || '', + : "", + activityLevel: activityLevel, + medicalConditions: data.profile.medicalConditions || "", + allergies: data.profile.allergies || "", + injuries: data.profile.injuries || "", }); } } } catch (error) { - console.error('Error fetching profile:', error); + console.error("Error fetching profile:", error); } finally { setFetchingProfile(false); } @@ -119,25 +174,25 @@ export default function FitnessProfileScreen() { }; const response = await fetch(`${API_BASE_URL}/api/profile/fitness`, { - method: 'POST', + method: "POST", headers: { - 'Content-Type': 'application/json', + "Content-Type": "application/json", Authorization: `Bearer ${token}`, }, body: JSON.stringify(dataToSave), }); if (response.ok) { - Alert.alert('Success', 'Fitness profile saved successfully!', [ - { text: 'OK', onPress: () => router.back() }, + Alert.alert("Success", "Fitness profile saved successfully!", [ + { text: "OK", onPress: () => router.back() }, ]); } else { const error = await response.json(); - Alert.alert('Error', error.error || 'Failed to save profile'); + Alert.alert("Error", error.error || "Failed to save profile"); } } catch (error) { - console.error('Error saving profile:', error); - Alert.alert('Error', 'Failed to save fitness profile'); + console.error("Error saving profile:", error); + Alert.alert("Error", "Failed to save fitness profile"); } finally { setLoading(false); } @@ -161,7 +216,10 @@ export default function FitnessProfileScreen() { {/* Header */} - router.back()}> + router.back()} + > Fitness Profile @@ -181,12 +239,19 @@ export default function FitnessProfileScreen() { Height (cm) - + - updateField('height', text ? parseFloat(text) : undefined) + updateField( + "height", + text ? parseFloat(text) : undefined, + ) } keyboardType="decimal-pad" placeholder="175" @@ -197,12 +262,19 @@ export default function FitnessProfileScreen() { Weight (kg) - + - updateField('weight', text ? parseFloat(text) : undefined) + updateField( + "weight", + text ? parseFloat(text) : undefined, + ) } keyboardType="decimal-pad" placeholder="70" @@ -214,12 +286,16 @@ export default function FitnessProfileScreen() { Age - + - updateField('age', text ? parseInt(text, 10) : undefined) + updateField("age", text ? parseInt(text, 10) : undefined) } keyboardType="number-pad" placeholder="25" @@ -239,9 +315,10 @@ export default function FitnessProfileScreen() { key={option.value} style={[ styles.optionCard, - profileData.gender === option.value && styles.optionCardActive, + profileData.gender === option.value && + styles.optionCardActive, ]} - onPress={() => updateField('gender', option.value)} + onPress={() => updateField("gender", option.value)} > {option.label} @@ -273,17 +351,32 @@ export default function FitnessProfileScreen() { updateField('fitnessGoal', option.value)} + onPress={() => updateField("fitnessGoal", option.value)} > - - + + {option.label} {profileData.fitnessGoal === option.value && ( - + )} - {index < FITNESS_GOAL_OPTIONS.length - 1 && } + {index < FITNESS_GOAL_OPTIONS.length - 1 && ( + + )} ))} @@ -297,17 +390,25 @@ export default function FitnessProfileScreen() { updateField('activityLevel', option.value)} + onPress={() => updateField("activityLevel", option.value)} > {option.label} - {option.description} + + {option.description} + {profileData.activityLevel === option.value && ( - + )} - {index < ACTIVITY_LEVEL_OPTIONS.length - 1 && } + {index < ACTIVITY_LEVEL_OPTIONS.length - 1 && ( + + )} ))} @@ -315,14 +416,18 @@ export default function FitnessProfileScreen() { {/* Health Information */} - Health Information (Optional) + + Health Information (Optional) + Medical Conditions updateField('medicalConditions', text)} + value={profileData.medicalConditions || ""} + onChangeText={(text) => + updateField("medicalConditions", text) + } placeholder="e.g., Asthma, diabetes..." placeholderTextColor={theme.colors.gray400} multiline @@ -334,8 +439,8 @@ export default function FitnessProfileScreen() { Allergies updateField('allergies', text)} + value={profileData.allergies || ""} + onChangeText={(text) => updateField("allergies", text)} placeholder="e.g., Peanuts, latex..." placeholderTextColor={theme.colors.gray400} multiline @@ -347,8 +452,8 @@ export default function FitnessProfileScreen() { Injuries updateField('injuries', text)} + value={profileData.injuries || ""} + onChangeText={(text) => updateField("injuries", text)} placeholder="e.g., Previous knee injury..." placeholderTextColor={theme.colors.gray400} multiline @@ -367,7 +472,10 @@ export default function FitnessProfileScreen() { onPress={handleSave} disabled={loading} > - + {loading ? ( ) : ( @@ -391,15 +499,15 @@ const styles = StyleSheet.create({ }, loadingContainer: { flex: 1, - justifyContent: 'center', - alignItems: 'center', + justifyContent: "center", + alignItems: "center", backgroundColor: theme.colors.background, }, header: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'space-between', - paddingTop: Platform.OS === 'ios' ? 60 : 40, + flexDirection: "row", + alignItems: "center", + justifyContent: "space-between", + paddingTop: Platform.OS === "ios" ? 60 : 40, paddingBottom: 20, paddingHorizontal: 20, }, @@ -407,14 +515,14 @@ const styles = StyleSheet.create({ width: 40, height: 40, borderRadius: 20, - backgroundColor: 'rgba(255, 255, 255, 0.2)', - justifyContent: 'center', - alignItems: 'center', + backgroundColor: "rgba(255, 255, 255, 0.2)", + justifyContent: "center", + alignItems: "center", }, headerTitle: { - fontSize: theme.typography.fontSize['2xl'], + fontSize: theme.typography.fontSize["2xl"], fontWeight: theme.typography.fontWeight.bold, - color: '#fff', + color: "#fff", }, scrollView: { flex: 1, @@ -433,7 +541,7 @@ const styles = StyleSheet.create({ marginBottom: 12, }, card: { - backgroundColor: '#fff', + backgroundColor: "#fff", borderRadius: theme.borderRadius.xl, padding: 16, ...theme.shadows.subtle, @@ -441,7 +549,7 @@ const styles = StyleSheet.create({ borderColor: theme.colors.gray100, }, row: { - flexDirection: 'row', + flexDirection: "row", gap: 12, marginBottom: 16, }, @@ -456,8 +564,8 @@ const styles = StyleSheet.create({ marginBottom: 8, }, inputContainer: { - flexDirection: 'row', - alignItems: 'center', + flexDirection: "row", + alignItems: "center", backgroundColor: theme.colors.gray50, borderRadius: theme.borderRadius.lg, borderWidth: 1, @@ -482,15 +590,15 @@ const styles = StyleSheet.create({ minHeight: 80, }, optionsRow: { - flexDirection: 'row', + flexDirection: "row", gap: 12, }, optionCard: { flex: 1, - backgroundColor: '#fff', + backgroundColor: "#fff", borderRadius: theme.borderRadius.lg, padding: 16, - alignItems: 'center', + alignItems: "center", gap: 8, borderWidth: 2, borderColor: theme.colors.gray200, @@ -510,8 +618,8 @@ const styles = StyleSheet.create({ fontWeight: theme.typography.fontWeight.bold, }, listItem: { - flexDirection: 'row', - alignItems: 'center', + flexDirection: "row", + alignItems: "center", paddingVertical: 12, gap: 12, }, @@ -519,8 +627,8 @@ const styles = StyleSheet.create({ width: 40, height: 40, borderRadius: 20, - justifyContent: 'center', - alignItems: 'center', + justifyContent: "center", + alignItems: "center", }, listItemText: { flex: 1, @@ -538,25 +646,25 @@ const styles = StyleSheet.create({ backgroundColor: theme.colors.gray100, }, footer: { - position: 'absolute', + position: "absolute", bottom: 0, left: 0, right: 0, padding: 20, - paddingBottom: Platform.OS === 'ios' ? 40 : 20, - backgroundColor: '#fff', + paddingBottom: Platform.OS === "ios" ? 40 : 20, + backgroundColor: "#fff", borderTopWidth: 1, borderTopColor: theme.colors.gray100, ...theme.shadows.medium, }, saveButton: { borderRadius: theme.borderRadius.lg, - overflow: 'hidden', + overflow: "hidden", }, saveButtonGradient: { - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'center', + flexDirection: "row", + alignItems: "center", + justifyContent: "center", paddingVertical: 16, gap: 8, }, @@ -566,6 +674,6 @@ const styles = StyleSheet.create({ saveButtonText: { fontSize: theme.typography.fontSize.base, fontWeight: theme.typography.fontWeight.bold, - color: '#fff', + color: "#fff", }, }); From c3a41d2b32e0ae86c0c471cc26edadccd4eb8de0 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 12 Mar 2026 16:58:14 +0100 Subject: [PATCH 08/11] actual fix --- apps/admin/data/fitai.db | Bin 172032 -> 172032 bytes apps/mobile/src/app/fitness-profile.tsx | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/admin/data/fitai.db b/apps/admin/data/fitai.db index 4915813e455662ce069d3a76065ab2b6df7d8585..c773da183b8c36a482ef4d2d34e1d7e2cb767d62 100644 GIT binary patch delta 105 zcmZoTz}0YoYl1Xm=0q81#>|ZgmiZ#0nhXpKqP)B;Ec#_>RmJHQ#pM-~FV0smX4n#H zl$)57nvdS(fUTUyzz<9cP%i=~13ibc|AJUP@_EVqS7;j8d#pQ$bq+ J#miZzKARsErz+$UhmR41qUQt|LG5O+r1!IOSp+tboY? E0D5a5N&o-= diff --git a/apps/mobile/src/app/fitness-profile.tsx b/apps/mobile/src/app/fitness-profile.tsx index 4252097..59ef8cc 100644 --- a/apps/mobile/src/app/fitness-profile.tsx +++ b/apps/mobile/src/app/fitness-profile.tsx @@ -160,14 +160,15 @@ export default function FitnessProfileScreen() { const token = await getToken(); // Prepare data with userId and convert fitnessGoal to fitnessGoals array + // Convert empty strings to undefined for optional enum fields const dataToSave = { userId: userId, height: profileData.height, weight: profileData.weight, age: profileData.age, - gender: profileData.gender, + gender: profileData.gender || undefined, fitnessGoals: profileData.fitnessGoal ? [profileData.fitnessGoal] : [], - activityLevel: profileData.activityLevel, + activityLevel: profileData.activityLevel || undefined, medicalConditions: profileData.medicalConditions, allergies: profileData.allergies, injuries: profileData.injuries, From aba9b1395b8b4883ffb3350ac7ea949cef9219c6 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 12 Mar 2026 17:06:10 +0100 Subject: [PATCH 09/11] fitness goals on home screen update fix --- apps/mobile/src/app/(tabs)/index.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/mobile/src/app/(tabs)/index.tsx b/apps/mobile/src/app/(tabs)/index.tsx index d630d89..dfb3dbe 100644 --- a/apps/mobile/src/app/(tabs)/index.tsx +++ b/apps/mobile/src/app/(tabs)/index.tsx @@ -44,7 +44,7 @@ export default function HomeScreen() { const { colors, typography } = useTheme(); const { refetchStatistics, forceRefresh, statistics, loading } = useStatistics(); - const { goals } = useFitnessGoals(); + const { goals, refetchGoals } = useFitnessGoals(); const [refreshing, setRefreshing] = useState(false); const [trackMealModalVisible, setTrackMealModalVisible] = useState(false); const [addWaterModalVisible, setAddWaterModalVisible] = useState(false); @@ -57,18 +57,19 @@ export default function HomeScreen() { const caloriesBounce = useRef(new Animated.Value(1)).current; const waterBounce = useRef(new Animated.Value(1)).current; - // Refetch statistics when screen comes into focus + // Refetch statistics and goals when screen comes into focus useFocusEffect( useCallback(() => { refetchStatistics(); - }, [refetchStatistics]), + refetchGoals(); + }, [refetchStatistics, refetchGoals]), ); const onRefresh = useCallback(async () => { setRefreshing(true); - await forceRefresh(); + await Promise.all([forceRefresh(), refetchGoals()]); setRefreshing(false); - }, [forceRefresh]); + }, [forceRefresh, refetchGoals]); const getGreeting = () => { const hour = new Date().getHours(); From 5d6166df1b11074fd9744228e44a36d9c65b3d3f Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 12 Mar 2026 17:56:46 +0100 Subject: [PATCH 10/11] redesign take 2 complete fix artefacts from previous dessign --- apps/admin/data/fitai.db | Bin 172032 -> 172032 bytes apps/mobile/src/app/(tabs)/attendance.tsx | 14 +- apps/mobile/src/app/(tabs)/goals.tsx | 104 +- apps/mobile/src/app/(tabs)/index.tsx | 943 ++++++++---------- apps/mobile/src/app/(tabs)/profile.tsx | 25 +- .../mobile/src/app/(tabs)/recommendations.tsx | 25 +- apps/mobile/src/components/ActivityRing.tsx | 128 +++ apps/mobile/src/components/Badge.tsx | 57 +- apps/mobile/src/components/CustomTabBar.tsx | 56 +- .../src/components/GoalProgressCard.tsx | 23 +- apps/mobile/src/components/IconContainer.tsx | 38 +- apps/mobile/src/components/MinimalButton.tsx | 86 +- apps/mobile/src/components/MinimalCard.tsx | 42 +- apps/mobile/src/components/ProgressBar.tsx | 23 +- apps/mobile/src/components/SectionHeader.tsx | 19 +- apps/mobile/src/styles/colors.ts | 143 +-- apps/mobile/src/styles/typography.ts | 93 +- 17 files changed, 941 insertions(+), 878 deletions(-) create mode 100644 apps/mobile/src/components/ActivityRing.tsx diff --git a/apps/admin/data/fitai.db b/apps/admin/data/fitai.db index c773da183b8c36a482ef4d2d34e1d7e2cb767d62..62294b2b057da644ea4c6b091d91bb0ec162c533 100644 GIT binary patch delta 167 zcmZoTz}0YoYl1Xm_Cy(H#_Wv=%i>uUGVm|lEa=eAuanCtDDTU}$SA7Gz`!8N%Nq;h zD?|7!ETUy;RmJHQ#pM-~FV0t(d^Vp$vMjZzGCnc6B(p5lFTWr)(>l&DbJP1SrRdH7 z@;MZQJ}~g_<%0p^1duAlYh@OV9DI{Hm_NGUc2@@ M#_ihkn65Gc0LDx-ZU6uP delta 162 zcmV;T0A2rpzzTrC3XmHCX^|X50co*dre6e+01uI~5kQ9z9Bly+A58)Q0Tn3#000#Y z4Fm))c4m5WXLxgWc$3keAd}s12q|o7XJ~Y6d0$~;bZK^FPH%8!X**sqX|m#OB3oP{ zWo~43a$#;`Wn3b&{%;5%67&EMz7Kp4Iu7^_whnX-G7a>zAt2lh2RsM}A58=RllPr4 QgDakgE1m(jE1m+?0lyG7a{vGU diff --git a/apps/mobile/src/app/(tabs)/attendance.tsx b/apps/mobile/src/app/(tabs)/attendance.tsx index ea2ea4f..d003dac 100644 --- a/apps/mobile/src/app/(tabs)/attendance.tsx +++ b/apps/mobile/src/app/(tabs)/attendance.tsx @@ -103,20 +103,22 @@ export default function AttendanceScreen() { > {/* Header */} - - 📍 Attendance + + Attendance {activeCheckIn - ? "You're crushing it today! 💪" + ? "You're crushing it today!" : history.length === 0 - ? "Ready to start your fitness journey? 🚀" - : "Track your gym visits and build streaks! 🔥"} + ? "Ready to start your fitness journey?" + : "Track your gym visits and build streaks!"} diff --git a/apps/mobile/src/app/(tabs)/goals.tsx b/apps/mobile/src/app/(tabs)/goals.tsx index cd40862..c6ebe43 100644 --- a/apps/mobile/src/app/(tabs)/goals.tsx +++ b/apps/mobile/src/app/(tabs)/goals.tsx @@ -150,21 +150,26 @@ export default function GoalsScreen() { > {/* Header */} - - - 🎯 Fitness Goals + + + Goals {activeGoals.length === 0 - ? "Ready to crush some goals? 💪" + ? "Ready to crush some goals?" : activeGoals.length === 1 - ? "You're on a mission! Keep it up! 🚀" - : `${activeGoals.length} goals in progress. Legend! ⭐`} + ? "You're on a mission! Keep it up!" + : `${activeGoals.length} goals in progress. Let's go!`} 0 && ( - - + + {activeGoals.length} - 🎯 Active + ACTIVE - - + + {completedGoals.length} - {completedGoals.length >= 5 ? "🏆" : "✅"} Completed + COMPLETED - - + + {avgProgress}% - {avgProgress >= 75 ? "🔥" : "📊"} Progress + PROGRESS @@ -287,8 +316,9 @@ export default function GoalsScreen() { {/* Active Goals */} setIsModalVisible(true)} /> {activeGoals.length === 0 ? ( @@ -331,7 +361,8 @@ export default function GoalsScreen() { {completedGoals.length > 0 && ( {completedGoals.map((goal) => ( @@ -386,15 +417,15 @@ const styles = StyleSheet.create({ flexDirection: "row", justifyContent: "space-between", alignItems: "flex-start", - paddingHorizontal: 24, + paddingHorizontal: 20, paddingTop: 60, - paddingBottom: 24, + paddingBottom: 20, }, debugButton: { padding: 8, }, section: { - paddingHorizontal: 24, + paddingHorizontal: 20, marginBottom: 24, }, statsRow: { @@ -405,6 +436,7 @@ const styles = StyleSheet.create({ flex: 1, alignItems: "center", paddingVertical: 20, + paddingHorizontal: 12, borderRadius: 20, }, analyticsHeader: { @@ -433,18 +465,18 @@ const styles = StyleSheet.create({ }, fabContainer: { position: "absolute", - right: 24, + right: 20, bottom: 90, }, fab: { - width: 56, - height: 56, - borderRadius: 28, + width: 64, + height: 64, + borderRadius: 22, justifyContent: "center", alignItems: "center", - shadowOffset: { width: 0, height: 4 }, - shadowOpacity: 0.2, - shadowRadius: 8, - elevation: 4, + shadowOffset: { width: 0, height: 6 }, + shadowOpacity: 0.35, + shadowRadius: 12, + elevation: 8, }, }); diff --git a/apps/mobile/src/app/(tabs)/index.tsx b/apps/mobile/src/app/(tabs)/index.tsx index dfb3dbe..ecdeb1f 100644 --- a/apps/mobile/src/app/(tabs)/index.tsx +++ b/apps/mobile/src/app/(tabs)/index.tsx @@ -23,6 +23,7 @@ import { ProgressBar } from "../../components/ProgressBar"; import { TrackMealModal } from "../../components/TrackMealModal"; import { AddWaterModal } from "../../components/AddWaterModal"; import { ScanFoodModal } from "../../components/ScanFoodModal"; +import { ActivityRing } from "../../components/ActivityRing"; import { checkInsToActivities, completedGoalsToActivities, @@ -36,8 +37,9 @@ import { ActivityType, } from "../../utils/activityFeed"; -const CALORIE_GOAL = 2000; // kcal -const WATER_GOAL = 2000; // ml +const CALORIE_GOAL = 2000; +const WATER_GOAL = 2000; +const WORKOUT_GOAL = 3; export default function HomeScreen() { const { user } = useUser(); @@ -52,12 +54,9 @@ export default function HomeScreen() { const [calories, setCalories] = useState(0); const [waterIntake, setWaterIntake] = useState(0); - // Animation values - const streakPulse = useRef(new Animated.Value(1)).current; const caloriesBounce = useRef(new Animated.Value(1)).current; const waterBounce = useRef(new Animated.Value(1)).current; - // Refetch statistics and goals when screen comes into focus useFocusEffect( useCallback(() => { refetchStatistics(); @@ -73,46 +72,20 @@ export default function HomeScreen() { const getGreeting = () => { const hour = new Date().getHours(); - const greetings = { - morning: [ - "Rise and Shine", - "Good Morning", - "Morning Champion", - "Ready to Crush It", - ], - afternoon: [ - "Keep It Going", - "Good Afternoon", - "Stay Strong", - "You're Doing Great", - ], - evening: [ - "Evening Warrior", - "Good Evening", - "Almost There", - "Finish Strong", - ], - }; - - const randomGreeting = (arr: string[]) => - arr[Math.floor(Math.random() * arr.length)]; - - if (hour < 12) return randomGreeting(greetings.morning); - if (hour < 18) return randomGreeting(greetings.afternoon); - return randomGreeting(greetings.evening); + if (hour < 12) return "Good Morning"; + if (hour < 18) return "Good Afternoon"; + return "Good Evening"; }; - const getMotivationalEmoji = () => { - const emojis = ["💪", "🔥", "⚡", "🎯", "🚀", "✨"]; - return emojis[Math.floor(Math.random() * emojis.length)]; - }; - - const getStreakBadge = (streak: number) => { - if (streak >= 30) return "🏆"; - if (streak >= 14) return "🔥"; - if (streak >= 7) return "⭐"; - if (streak >= 3) return "🌟"; - return "💫"; + const getMotivationalMessage = () => { + const messages = [ + "Let's crush it today! 💪", + "Ready to level up? 🔥", + "You've got this! ⚡", + "Time to shine! ✨", + "Let's make it happen! 🚀", + ]; + return messages[Math.floor(Math.random() * messages.length)]; }; const handleSaveMeal = (meal: { @@ -122,11 +95,9 @@ export default function HomeScreen() { }) => { setCalories((prev) => prev + meal.calories); setTrackMealModalVisible(false); - - // Bounce animation Animated.sequence([ Animated.timing(caloriesBounce, { - toValue: 1.2, + toValue: 1.15, duration: 150, useNativeDriver: true, }), @@ -141,11 +112,9 @@ export default function HomeScreen() { const handleAddWater = (amount: number) => { setWaterIntake((prev) => prev + amount); setAddWaterModalVisible(false); - - // Bounce animation Animated.sequence([ Animated.timing(waterBounce, { - toValue: 1.2, + toValue: 1.15, duration: 150, useNativeDriver: true, }), @@ -157,14 +126,8 @@ export default function HomeScreen() { ]).start(); }; - const handleResetCalories = () => { - setCalories(0); - }; - - const handleResetWater = () => { - setWaterIntake(0); - }; - + const handleResetCalories = () => setCalories(0); + const handleResetWater = () => setWaterIntake(0); const handleAddScannedFood = (scannedCalories: number) => { setCalories((prev) => prev + scannedCalories); setScanFoodModalVisible(false); @@ -179,131 +142,67 @@ export default function HomeScreen() { await AsyncStorage.removeItem(`water_${today}`); }; - // Load persisted data on mount useEffect(() => { const loadPersistedData = async () => { const today = new Date().toDateString(); const storedCalories = await AsyncStorage.getItem(`calories_${today}`); const storedWater = await AsyncStorage.getItem(`water_${today}`); - - if (storedCalories) { - setCalories(parseInt(storedCalories, 10)); - } - if (storedWater) { - setWaterIntake(parseInt(storedWater, 10)); - } + if (storedCalories) setCalories(parseInt(storedCalories, 10)); + if (storedWater) setWaterIntake(parseInt(storedWater, 10)); }; - loadPersistedData(); }, []); - // Persist calories to AsyncStorage whenever it changes useEffect(() => { const persistCalories = async () => { const today = new Date().toDateString(); await AsyncStorage.setItem(`calories_${today}`, calories.toString()); }; - persistCalories(); }, [calories]); - // Persist water intake to AsyncStorage whenever it changes useEffect(() => { const persistWater = async () => { const today = new Date().toDateString(); await AsyncStorage.setItem(`water_${today}`, waterIntake.toString()); }; - persistWater(); }, [waterIntake]); + useEffect(() => { + const checkAndResetIfNeeded = async () => { + const lastResetDate = await AsyncStorage.getItem("lastResetDate"); + const today = new Date().toDateString(); + if (lastResetDate !== today) { + await resetAllCounters(); + } + }; + checkAndResetIfNeeded(); + }, []); + const checkInsThisWeek = statistics?.attendance.checkInsThisWeek || 0; const currentStreak = statistics?.attendance.currentStreak || 0; + const workoutsThisWeek = checkInsThisWeek; - // Combine activities from multiple sources const recentActivities = useMemo(() => { if (!statistics || !goals) return []; - const checkInActivities = checkInsToActivities(statistics.attendance).slice( 0, 2, - ); // Only last 2 check-ins + ); const completedGoalActivities = completedGoalsToActivities(goals).slice( 0, 2, - ); // Only last 2 completed goals - const newGoalActivities = newGoalsToActivities(goals, 7); // Last 7 days - + ); + const newGoalActivities = newGoalsToActivities(goals, 7); const allActivities = combineActivities( checkInActivities, completedGoalActivities, newGoalActivities, ); - - return getRecentActivities(allActivities, 5); // Show top 5 + return getRecentActivities(allActivities, 5); }, [statistics, goals]); - // Check for midnight reset - useEffect(() => { - const checkAndResetIfNeeded = async () => { - const lastResetDate = await AsyncStorage.getItem("lastResetDate"); - const today = new Date().toDateString(); - - if (lastResetDate !== today) { - await resetAllCounters(); - } - }; - - checkAndResetIfNeeded(); - - // Calculate time until midnight - const now = new Date(); - const midnight = new Date(); - midnight.setHours(24, 0, 0, 0); - const timeUntilMidnight = midnight.getTime() - now.getTime(); - - // Set timer for midnight reset - const midnightTimer = setTimeout(async () => { - await resetAllCounters(); - - // Set up daily interval after first midnight - const dailyInterval = setInterval( - async () => { - await resetAllCounters(); - }, - 24 * 60 * 60 * 1000, - ); // 24 hours - - return () => clearInterval(dailyInterval); - }, timeUntilMidnight); - - return () => clearTimeout(midnightTimer); - }, []); - - // Streak pulse animation - useEffect(() => { - const pulse = Animated.loop( - Animated.sequence([ - Animated.timing(streakPulse, { - toValue: 1.1, - duration: 1000, - useNativeDriver: true, - }), - Animated.timing(streakPulse, { - toValue: 1, - duration: 1000, - useNativeDriver: true, - }), - ]), - ); - - if (currentStreak >= 3) { - pulse.start(); - } - - return () => pulse.stop(); - }, [currentStreak]); - return ( } > - {/* Header Section */} - - + {/* Hero Header */} + + - {getGreeting()} {getMotivationalEmoji()} + {getGreeting()} 👋 - {user?.firstName || "Athlete"} + {user?.firstName || "Champion"} + + + {getMotivationalMessage()} - {currentStreak >= 3 && ( - - - {getStreakBadge(currentStreak)} {currentStreak} Day Streak! - - - )} {user?.imageUrl ? ( - + ) : ( - + )} - {/* Daily Stats Card - More Playful */} + {/* Activity Rings - Hero Section */} - - - - - - + + + + {calories} + + } + /> + + {waterIntake} + + } + /> + + {workoutsThisWeek} + + } + /> + + + {/* Streak Banner */} + {currentStreak >= 1 && ( + + 🔥 - {checkInsThisWeek} + {currentStreak} Day Streak! - Check-ins{"\n"}This Week + Keep it going - - - - - - - - - {calories} - - - Calories{"\n"}Tracked - - - - - - - - - {getStreakBadge(currentStreak)} - - - - {currentStreak} - - - Day{"\n"}Streak - - - + )} - {/* Quick Actions - More Playful */} + {/* Quick Actions */} - + console.log("Log workout tapped")} - activeOpacity={0.7} + onPress={() => console.log("Log workout")} + activeOpacity={0.85} style={[ - styles.actionCard, - { - backgroundColor: `${colors.primary}15`, - borderColor: `${colors.primary}30`, - borderWidth: 2, - }, + styles.quickActionCard, + { backgroundColor: colors.primary }, ]} > - - - - - 💪 Workout + + + + Workout + + + Log your session setTrackMealModalVisible(true)} - activeOpacity={0.7} + activeOpacity={0.85} style={[ - styles.actionCard, - { - backgroundColor: `${colors.success}15`, - borderColor: `${colors.success}30`, - borderWidth: 2, - }, + styles.quickActionCard, + { backgroundColor: colors.success }, ]} > - - - - - 🍽️ Track Meal + + + + Meal + + + Track calories setAddWaterModalVisible(true)} - activeOpacity={0.7} - style={[ - styles.actionCard, - { - backgroundColor: `${colors.info}15`, - borderColor: `${colors.info}30`, - borderWidth: 2, - }, - ]} + activeOpacity={0.85} + style={[styles.quickActionCard, { backgroundColor: colors.info }]} > - - - - - - - 💧 Add Water + + + + Hydrate + + + Add water setScanFoodModalVisible(true)} - activeOpacity={0.7} + activeOpacity={0.85} style={[ - styles.actionCard, - { - backgroundColor: `${colors.accent}15`, - borderColor: `${colors.accent}30`, - borderWidth: 2, - }, + styles.quickActionCard, + { backgroundColor: colors.accent }, ]} > - - - - - 📱 Scan Food + + + + Scan + + + Quick add - {/* Nutrition Progress - More Playful */} + {/* Today's Progress */} = CALORIE_GOAL - ? "Goal smashed! 🎉" - : calories >= CALORIE_GOAL * 0.75 - ? "Almost there! Keep going 💪" - : "Let's fuel that body! 🔥" - } + title="Today's Progress" + subtitle="Track your daily goals" /> - + + - 🔥 - - Calories - + 🔥 + + + + Calories + + + {calories >= CALORIE_GOAL + ? "Goal reached! 🎉" + : `${CALORIE_GOAL - calories} remaining`} + + - - {calories} / {CALORIE_GOAL} + + {calories}/{CALORIE_GOAL} - - {/* Hydration Progress - More Playful */} - - 💧 - - + + 💧 + + + Hydration {waterIntake >= WATER_GOAL - ? "Perfectly hydrated! 🌊" - : "Stay hydrated, champ! 💪"} + ? "Fully hydrated! 🌊" + : `${WATER_GOAL - waterIntake}ml remaining`} - - {waterIntake} / {WATER_GOAL} ml + + {waterIntake}/{WATER_GOAL} @@ -695,39 +563,41 @@ export default function HomeScreen() { {/* Recent Activity */} {recentActivities.length === 0 ? ( - - - 🏃 - - No Recent Activity - - - Check in at the gym or complete a goal to get started! 💪 - - + + 🏃 + + No Activity Yet + + + Start by checking in at the gym or completing a goal! + ) : ( @@ -735,17 +605,11 @@ export default function HomeScreen() { const iconName = getActivityIcon(activity.type); const emoji = getActivityEmoji(activity.type); const timeStr = formatActivityTime(activity.timestamp); - const durationStr = formatDuration(activity.duration); - - // Determine color based on activity type let iconColor = colors.primary; - if (activity.type === ActivityType.GOAL_COMPLETED) { + if (activity.type === ActivityType.GOAL_COMPLETED) iconColor = colors.success; - } else if (activity.type === ActivityType.GOAL_CREATED) { + else if (activity.type === ActivityType.GOAL_CREATED) iconColor = colors.accent; - } else if (activity.type === ActivityType.GYM_CHECKIN) { - iconColor = colors.primary; - } return ( - - - + {emoji} + - {emoji} {activity.title} + {activity.title} - {durationStr && ( + {activity.duration && ( - {durationStr} + {formatDuration(activity.duration)} )} @@ -795,139 +660,119 @@ export default function HomeScreen() { )} - setTrackMealModalVisible(false)} - onSave={handleSaveMeal} - onResetData={handleResetCalories} - /> - - setAddWaterModalVisible(false)} - onAdd={handleAddWater} - onResetData={handleResetWater} - /> - - setScanFoodModalVisible(false)} - onAddFood={handleAddScannedFood} - /> - - {/* Bottom Spacer for Tab Bar */} + + setTrackMealModalVisible(false)} + onSave={handleSaveMeal} + onResetData={handleResetCalories} + /> + setAddWaterModalVisible(false)} + onAdd={handleAddWater} + onResetData={handleResetWater} + /> + setScanFoodModalVisible(false)} + onAddFood={handleAddScannedFood} + /> ); } const styles = StyleSheet.create({ - container: { - flex: 1, - }, - scrollContent: { - paddingTop: 60, - }, - header: { + container: { flex: 1 }, + scrollContent: { paddingTop: 60, paddingBottom: 20 }, + section: { paddingHorizontal: 20, marginBottom: 28 }, + + // Hero Header + heroHeader: { flexDirection: "row", justifyContent: "space-between", - alignItems: "flex-start", - paddingHorizontal: 24, + alignItems: "center", + paddingHorizontal: 20, marginBottom: 24, }, - greetingContainer: { - flex: 1, - marginRight: 16, - }, - streakBadge: { - marginTop: 8, - paddingHorizontal: 12, - paddingVertical: 6, - backgroundColor: "rgba(136, 192, 208, 0.15)", - borderRadius: 999, - alignSelf: "flex-start", - }, - streakBadgeText: { - fontSize: 13, - fontWeight: "600", - color: "#88C0D0", - }, - avatar: { - width: 56, - height: 56, - borderRadius: 28, + heroTextContainer: { flex: 1, marginRight: 16 }, + heroAvatar: { + width: 64, + height: 64, + borderRadius: 20, borderWidth: 3, - borderColor: "#88C0D0", + borderColor: "#0066FF", }, - placeholderAvatar: { - width: 56, - height: 56, - borderRadius: 28, + heroPlaceholderAvatar: { + width: 64, + height: 64, + borderRadius: 20, justifyContent: "center", alignItems: "center", borderWidth: 3, - borderColor: "#88C0D0", + borderColor: "#0066FF", }, - section: { - paddingHorizontal: 24, - marginBottom: 24, + + // Activity Rings + ringsCard: { padding: 24 }, + ringsContainer: { + flexDirection: "row", + justifyContent: "space-around", + alignItems: "center", }, - statsCard: { + streakBanner: { + flexDirection: "row", + alignItems: "center", + marginTop: 24, + padding: 16, + borderRadius: 14, + }, + + // Quick Actions + quickActionsGrid: { flexDirection: "row", flexWrap: "wrap", gap: 12 }, + quickActionCard: { + width: "47%", + padding: 20, borderRadius: 20, }, - statsRow: { - flexDirection: "row", - justifyContent: "space-between", + quickActionIcon: { + width: 52, + height: 52, + borderRadius: 14, + justifyContent: "center", alignItems: "center", - paddingVertical: 8, - }, - statItem: { - alignItems: "center", - flex: 1, - }, - divider: { - width: 1, - height: 70, - }, - emojiIcon: { - fontSize: 28, - }, - actionGrid: { - flexDirection: "row", - flexWrap: "wrap", - gap: 12, - }, - actionCard: { - width: "48%", - alignItems: "center", - paddingVertical: 24, - borderRadius: 20, }, + + // Progress Cards + progressCard: { padding: 20 }, progressHeader: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", }, - progressLabelRow: { - flexDirection: "row", + progressLabelRow: { flexDirection: "row", alignItems: "center" }, + progressIcon: { + width: 48, + height: 48, + borderRadius: 14, + justifyContent: "center", alignItems: "center", }, - activityList: { - gap: 12, - }, - activityItem: { - flexDirection: "row", + + // Activity + activityList: { gap: 12 }, + activityItem: { flexDirection: "row", alignItems: "center", padding: 16 }, + activityIconContainer: { + width: 48, + height: 48, + borderRadius: 14, + justifyContent: "center", alignItems: "center", - gap: 12, - borderRadius: 16, - }, - activityInfo: { - flex: 1, - }, - emptyActivity: { - alignItems: "center", - paddingVertical: 40, - paddingHorizontal: 20, }, + activityInfo: { flex: 1, marginLeft: 14 }, + + // Empty + emptyCard: { alignItems: "center", padding: 40 }, }); diff --git a/apps/mobile/src/app/(tabs)/profile.tsx b/apps/mobile/src/app/(tabs)/profile.tsx index 10f86ed..2945f93 100644 --- a/apps/mobile/src/app/(tabs)/profile.tsx +++ b/apps/mobile/src/app/(tabs)/profile.tsx @@ -213,7 +213,10 @@ export default function ProfileScreen() { contentContainerStyle={styles.content} > {/* Header Card */} - + {user?.imageUrl ? ( @@ -221,29 +224,36 @@ export default function ProfileScreen() { - + )} {user?.fullName || "User"} {user?.primaryEmailAddress?.emailAddress} @@ -580,8 +590,9 @@ const styles = StyleSheet.create({ flex: 1, }, content: { - padding: 24, + padding: 20, paddingTop: 60, + paddingBottom: 100, }, profileCard: { alignItems: "center", diff --git a/apps/mobile/src/app/(tabs)/recommendations.tsx b/apps/mobile/src/app/(tabs)/recommendations.tsx index 4ce68e2..801af20 100644 --- a/apps/mobile/src/app/(tabs)/recommendations.tsx +++ b/apps/mobile/src/app/(tabs)/recommendations.tsx @@ -130,19 +130,24 @@ export default function RecommendationsScreen() { > {/* Header */} - - - ✨ AI Recommendations + + + Recommendations {recommendations.length === 0 - ? "Let's create your perfect plan! 🚀" - : `${recommendations.length} plan${recommendations.length !== 1 ? "s" : ""} ready for you! 💪`} + ? "Let's create your perfect plan!" + : `${recommendations.length} plan${recommendations.length !== 1 ? "s" : ""} ready for you!`} - + {unreadCount > 0 && ( { + Animated.timing(animatedValue, { + toValue: Math.min(progress, 100), + duration: 1200, + useNativeDriver: true, + }).start(); + }, [progress]); + + const strokeDashoffset = animatedValue.interpolate({ + inputRange: [0, 100], + outputRange: [circumference, 0], + }); + + return ( + + + + + + + + {icon ? ( + {icon} + ) : ( + + {Math.round(current)} + + )} + + + + {label} + + + / {goal.toLocaleString()} + + + ); +} + +const styles = StyleSheet.create({ + container: { + alignItems: "center", + }, + iconContainer: { + justifyContent: "center", + alignItems: "center", + }, +}); diff --git a/apps/mobile/src/components/Badge.tsx b/apps/mobile/src/components/Badge.tsx index 17fb59c..ef31f22 100644 --- a/apps/mobile/src/components/Badge.tsx +++ b/apps/mobile/src/components/Badge.tsx @@ -10,49 +10,41 @@ type BadgeVariant = | "danger" | "info" | "primary"; -type BadgeSize = "sm" | "md"; +type BadgeSize = "sm" | "md" | "lg"; interface BadgeProps { label: string; variant?: BadgeVariant; size?: BadgeSize; style?: StyleProp; + emoji?: string; } -/** - * Badge - Pill-shaped status indicator - * - * Variants: - * - neutral: Gray badge for general labels - * - success: Green badge for positive status - * - warning: Orange/yellow badge for warnings - * - danger: Red badge for errors or critical status - * - info: Blue badge for informational status - * - primary: Primary color badge - * - * Sizes: - * - sm: 5px vertical, 10px horizontal, 11px font - * - md: 6px vertical, 12px horizontal, 13px font (default) - */ export function Badge({ label, variant = "neutral", size = "md", style, + emoji, }: BadgeProps) { const { colors } = useTheme(); const sizeStyles = { sm: { - paddingVertical: 5, - paddingHorizontal: 10, + paddingVertical: 6, + paddingHorizontal: 12, fontSize: fontSize.xs, }, md: { - paddingVertical: 6, - paddingHorizontal: 12, + paddingVertical: 8, + paddingHorizontal: 14, fontSize: fontSize.sm, }, + lg: { + paddingVertical: 10, + paddingHorizontal: 18, + fontSize: fontSize.base, + }, }; const variantStyles: Record< @@ -64,24 +56,24 @@ export function Badge({ color: colors.textSecondary, }, success: { - backgroundColor: `${colors.success}20`, // 20% opacity - color: colors.success, + backgroundColor: colors.success, + color: colors.white, }, warning: { - backgroundColor: `${colors.warning}20`, - color: colors.warning, + backgroundColor: colors.warning, + color: colors.black, }, danger: { - backgroundColor: `${colors.danger}20`, - color: colors.danger, + backgroundColor: colors.danger, + color: colors.white, }, info: { - backgroundColor: `${colors.info}20`, - color: colors.info, + backgroundColor: colors.info, + color: colors.white, }, primary: { - backgroundColor: `${colors.primary}20`, - color: colors.primary, + backgroundColor: colors.primary, + color: colors.white, }, }; @@ -103,10 +95,11 @@ export function Badge({ { color: variantStyles[variant].color, fontSize: sizeStyles[size].fontSize, - fontWeight: fontWeight.medium, + fontWeight: fontWeight.bold, }, ]} > + {emoji && `${emoji} `} {label} @@ -115,7 +108,7 @@ export function Badge({ const styles = StyleSheet.create({ badge: { - borderRadius: 999, // Full pill shape + borderRadius: 12, alignSelf: "flex-start", }, label: { diff --git a/apps/mobile/src/components/CustomTabBar.tsx b/apps/mobile/src/components/CustomTabBar.tsx index 8ade46a..301bed3 100644 --- a/apps/mobile/src/components/CustomTabBar.tsx +++ b/apps/mobile/src/components/CustomTabBar.tsx @@ -1,21 +1,10 @@ import React from "react"; -import { View, StyleSheet, TouchableOpacity } from "react-native"; +import { View, StyleSheet, TouchableOpacity, Text } from "react-native"; import { BottomTabBarProps } from "@react-navigation/bottom-tabs"; import { Ionicons } from "@expo/vector-icons"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useTheme } from "../contexts/ThemeContext"; -/** - * CustomTabBar - Minimal bottom navigation with pill indicator - * - * Design: - * - Simple flat design (no floating, no glassmorphism) - * - Clean icons with outline/filled states - * - Small pill indicator below active tab - * - 56px height (reduced from 70px) - * - No animations (just opacity fade on press) - * - Theme-aware colors - */ export function CustomTabBar({ state, descriptors, @@ -71,6 +60,23 @@ export function CustomTabBar({ } }; + const getLabel = (routeName: string) => { + switch (routeName) { + case "index": + return "Home"; + case "goals": + return "Goals"; + case "attendance": + return "Attendance"; + case "recommendations": + return "Plans"; + case "profile": + return "Profile"; + default: + return ""; + } + }; + return ( {isFocused && ( @@ -97,6 +103,17 @@ export function CustomTabBar({ /> )} + + {getLabel(route.name)} + ); })} @@ -107,8 +124,9 @@ export function CustomTabBar({ const styles = StyleSheet.create({ container: { flexDirection: "row", - height: 56, + height: 70, borderTopWidth: 1, + paddingTop: 8, }, tabItem: { flex: 1, @@ -121,9 +139,13 @@ const styles = StyleSheet.create({ justifyContent: "center", }, indicator: { - width: 24, - height: 3, - borderRadius: 999, + width: 20, + height: 4, + borderRadius: 2, + marginTop: 4, + }, + label: { + fontSize: 11, marginTop: 4, }, }); diff --git a/apps/mobile/src/components/GoalProgressCard.tsx b/apps/mobile/src/components/GoalProgressCard.tsx index 20542d4..a8d1999 100644 --- a/apps/mobile/src/components/GoalProgressCard.tsx +++ b/apps/mobile/src/components/GoalProgressCard.tsx @@ -122,15 +122,17 @@ export function GoalProgressCard({ return ( - + {/* Header */} @@ -289,13 +291,14 @@ export function GoalProgressCard({ const styles = StyleSheet.create({ card: { - marginBottom: 12, + marginBottom: 16, + borderRadius: 20, }, header: { flexDirection: "row", justifyContent: "space-between", alignItems: "flex-start", - marginBottom: 12, + marginBottom: 16, }, titleRow: { flexDirection: "row", @@ -304,23 +307,23 @@ const styles = StyleSheet.create({ }, titleContainer: { flex: 1, - marginLeft: 12, + marginLeft: 14, }, actions: { flexDirection: "row", - gap: 8, + gap: 12, }, actionButton: { - padding: 4, + padding: 6, }, progressSection: { - marginBottom: 12, + marginBottom: 16, }, progressInfo: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", - marginBottom: 8, + marginBottom: 10, }, footer: { flexDirection: "row", diff --git a/apps/mobile/src/components/IconContainer.tsx b/apps/mobile/src/components/IconContainer.tsx index 2b98ab2..6193434 100644 --- a/apps/mobile/src/components/IconContainer.tsx +++ b/apps/mobile/src/components/IconContainer.tsx @@ -3,7 +3,7 @@ import { View, StyleSheet, ViewStyle, StyleProp } from "react-native"; import { useTheme } from "../contexts/ThemeContext"; type IconContainerVariant = "plain" | "subtle" | "colored"; -type IconContainerSize = "sm" | "md" | "lg"; +type IconContainerSize = "sm" | "md" | "lg" | "xl"; interface IconContainerProps { children: React.ReactNode; @@ -13,19 +13,6 @@ interface IconContainerProps { style?: StyleProp; } -/** - * IconContainer - Clean container for icons with subtle backgrounds - * - * Variants: - * - plain: No background, just the icon - * - subtle: Light background (surfaceSecondary) - * - colored: Custom background color (pass backgroundColor prop) - * - * Sizes: - * - sm: 32px circle - * - md: 40px circle (default) - * - lg: 48px circle - */ export function IconContainer({ children, variant = "subtle", @@ -37,19 +24,24 @@ export function IconContainer({ const sizeStyles: Record = { sm: { - width: 32, - height: 32, - borderRadius: 16, + width: 36, + height: 36, + borderRadius: 10, }, md: { - width: 40, - height: 40, - borderRadius: 20, - }, - lg: { width: 48, height: 48, - borderRadius: 24, + borderRadius: 14, + }, + lg: { + width: 56, + height: 56, + borderRadius: 16, + }, + xl: { + width: 64, + height: 64, + borderRadius: 18, }, }; diff --git a/apps/mobile/src/components/MinimalButton.tsx b/apps/mobile/src/components/MinimalButton.tsx index 284dc1c..628e88b 100644 --- a/apps/mobile/src/components/MinimalButton.tsx +++ b/apps/mobile/src/components/MinimalButton.tsx @@ -11,8 +11,13 @@ import { import { useTheme } from "../contexts/ThemeContext"; import { fontSize, fontWeight } from "../styles/typography"; -type ButtonVariant = "primary" | "secondary" | "tertiary" | "danger"; -type ButtonSize = "sm" | "md" | "lg"; +type ButtonVariant = + | "primary" + | "secondary" + | "tertiary" + | "danger" + | "success"; +type ButtonSize = "sm" | "md" | "lg" | "xl"; interface MinimalButtonProps { title: string; @@ -23,22 +28,9 @@ interface MinimalButtonProps { disabled?: boolean; style?: StyleProp; textStyle?: StyleProp; + fullWidth?: boolean; } -/** - * MinimalButton - Clean button component with solid colors - * - * Variants: - * - primary: Solid primary background - * - secondary: Outlined with primary color - * - tertiary: Text only, no background - * - danger: Solid danger background - * - * Sizes: - * - sm: 12px vertical padding, 16px horizontal - * - md: 14px vertical padding, 24px horizontal (default) - * - lg: 16px vertical padding, 32px horizontal - */ export function MinimalButton({ title, onPress, @@ -48,37 +40,42 @@ export function MinimalButton({ disabled = false, style, textStyle, + fullWidth = false, }: MinimalButtonProps) { const { colors } = useTheme(); const isDisabled = disabled || loading; - // Get button styles based on variant const getButtonStyle = (): ViewStyle => { const baseStyle: ViewStyle = { - borderRadius: 10, + borderRadius: 14, alignItems: "center", justifyContent: "center", opacity: isDisabled ? 0.5 : 1, }; - // Size-specific padding const sizeStyles: Record< ButtonSize, { paddingVertical: number; paddingHorizontal: number } > = { - sm: { paddingVertical: 12, paddingHorizontal: 16 }, - md: { paddingVertical: 14, paddingHorizontal: 24 }, - lg: { paddingVertical: 16, paddingHorizontal: 32 }, + sm: { paddingVertical: 12, paddingHorizontal: 20 }, + md: { paddingVertical: 16, paddingHorizontal: 28 }, + lg: { paddingVertical: 18, paddingHorizontal: 36 }, + xl: { paddingVertical: 20, paddingHorizontal: 44 }, }; const variantStyles: Record = { primary: { backgroundColor: colors.primary, + shadowColor: colors.primary, + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.3, + shadowRadius: 8, + elevation: 4, }, secondary: { backgroundColor: "transparent", - borderWidth: 1.5, + borderWidth: 2, borderColor: colors.primary, }, tertiary: { @@ -86,6 +83,19 @@ export function MinimalButton({ }, danger: { backgroundColor: colors.danger, + shadowColor: colors.danger, + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.3, + shadowRadius: 8, + elevation: 4, + }, + success: { + backgroundColor: colors.success, + shadowColor: colors.success, + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.3, + shadowRadius: 8, + elevation: 4, }, }; @@ -93,29 +103,23 @@ export function MinimalButton({ ...baseStyle, ...sizeStyles[size], ...variantStyles[variant], + ...(fullWidth && { width: "100%" }), }; }; - // Get text styles based on variant const getTextStyle = (): TextStyle => { const baseTextStyle: TextStyle = { - fontSize: fontSize.base, - fontWeight: fontWeight.semibold, + fontSize: size === "sm" ? fontSize.sm : fontSize.md, + fontWeight: fontWeight.bold, + letterSpacing: 0.5, }; const variantTextStyles: Record = { - primary: { - color: colors.white, - }, - secondary: { - color: colors.primary, - }, - tertiary: { - color: colors.primary, - }, - danger: { - color: colors.white, - }, + primary: { color: colors.white }, + secondary: { color: colors.primary }, + tertiary: { color: colors.primary }, + danger: { color: colors.white }, + success: { color: colors.white }, }; return { @@ -129,7 +133,7 @@ export function MinimalButton({ style={[getButtonStyle(), style]} onPress={onPress} disabled={isDisabled} - activeOpacity={0.7} + activeOpacity={0.85} > {loading ? ( ); } - -const styles = StyleSheet.create({ - // No static styles needed - all dynamic based on theme -}); diff --git a/apps/mobile/src/components/MinimalCard.tsx b/apps/mobile/src/components/MinimalCard.tsx index 8b0d375..5de9e1d 100644 --- a/apps/mobile/src/components/MinimalCard.tsx +++ b/apps/mobile/src/components/MinimalCard.tsx @@ -8,28 +8,22 @@ import { } from "react-native"; import { useTheme } from "../contexts/ThemeContext"; -type CardVariant = "default" | "elevated" | "bordered"; +type CardVariant = "default" | "elevated" | "bordered" | "gradient"; interface MinimalCardProps { children: React.ReactNode; variant?: CardVariant; onPress?: () => void; style?: StyleProp; + padding?: number; } -/** - * MinimalCard - Clean card component without gradients - * - * Variants: - * - default: Subtle shadow on surface background - * - elevated: More prominent shadow - * - bordered: Border instead of shadow - */ export function MinimalCard({ children, variant = "default", onPress, style, + padding = 20, }: MinimalCardProps) { const { colors } = useTheme(); @@ -37,13 +31,20 @@ export function MinimalCard({ styles.base, { backgroundColor: colors.surface, + padding: padding, }, variant === "default" && styles.default, - variant === "elevated" && styles.elevated, + variant === "elevated" && { + ...styles.elevated, + backgroundColor: colors.surfaceElevated, + }, variant === "bordered" && { borderWidth: 1, borderColor: colors.border, }, + variant === "gradient" && { + backgroundColor: colors.surfaceElevated, + }, style, ]; @@ -52,7 +53,7 @@ export function MinimalCard({ {children} @@ -64,21 +65,20 @@ export function MinimalCard({ const styles = StyleSheet.create({ base: { - borderRadius: 12, - padding: 16, + borderRadius: 20, }, default: { - shadowColor: "#000", - shadowOffset: { width: 0, height: 1 }, - shadowOpacity: 0.05, - shadowRadius: 3, - elevation: 1, - }, - elevated: { shadowColor: "#000", shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.08, shadowRadius: 8, - elevation: 2, + elevation: 3, + }, + elevated: { + shadowColor: "#000", + shadowOffset: { width: 0, height: 4 }, + shadowOpacity: 0.12, + shadowRadius: 16, + elevation: 6, }, }); diff --git a/apps/mobile/src/components/ProgressBar.tsx b/apps/mobile/src/components/ProgressBar.tsx index 362b9dd..ce80b38 100644 --- a/apps/mobile/src/components/ProgressBar.tsx +++ b/apps/mobile/src/components/ProgressBar.tsx @@ -3,43 +3,28 @@ import { View, StyleSheet, ViewStyle, StyleProp } from "react-native"; import { useTheme } from "../contexts/ThemeContext"; interface ProgressBarProps { - progress: number; // 0-1 (e.g., 0.75 for 75%) + progress: number; color?: string; backgroundColor?: string; height?: number; borderRadius?: number; style?: StyleProp; + animated?: boolean; } -/** - * ProgressBar - Simple linear progress indicator - * - * Usage: - * - Goal progress tracking - * - Loading states - * - Completion indicators - * - * Props: - * - progress: Value between 0 and 1 (e.g., 0.75 for 75%) - * - color: Custom fill color (defaults to theme primary) - * - backgroundColor: Custom track color (defaults to theme border) - * - height: Bar height in pixels (defaults to 8) - * - borderRadius: Corner radius (defaults to 999 for full pill shape) - */ export function ProgressBar({ progress, color, backgroundColor, - height = 8, + height = 10, borderRadius = 999, style, }: ProgressBarProps) { const { colors } = useTheme(); - // Clamp progress between 0 and 1 const clampedProgress = Math.min(Math.max(progress, 0), 1); - const trackColor = backgroundColor || colors.border; + const trackColor = backgroundColor || colors.surfaceElevated; const fillColor = color || colors.primary; return ( diff --git a/apps/mobile/src/components/SectionHeader.tsx b/apps/mobile/src/components/SectionHeader.tsx index c7004bf..b3b68b6 100644 --- a/apps/mobile/src/components/SectionHeader.tsx +++ b/apps/mobile/src/components/SectionHeader.tsx @@ -17,14 +17,6 @@ interface SectionHeaderProps { style?: StyleProp; } -/** - * SectionHeader - Clean section header with optional action button - * - * Usage: - * - Divides content into logical sections - * - Optional subtitle for additional context - * - Optional action button (e.g., "See All", "Add New") - */ export function SectionHeader({ title, subtitle, @@ -44,7 +36,7 @@ export function SectionHeader({ {subtitle} @@ -53,12 +45,7 @@ export function SectionHeader({ {actionLabel && onActionPress && ( - + {actionLabel} @@ -72,7 +59,7 @@ const styles = StyleSheet.create({ flexDirection: "row", justifyContent: "space-between", alignItems: "center", - marginBottom: 12, + marginBottom: 16, }, textContainer: { flex: 1, diff --git a/apps/mobile/src/styles/colors.ts b/apps/mobile/src/styles/colors.ts index 4ca01c0..8abdf6d 100644 --- a/apps/mobile/src/styles/colors.ts +++ b/apps/mobile/src/styles/colors.ts @@ -1,7 +1,6 @@ /** - * FitAI Color System - * Nord Color Palette - A minimal, arctic-inspired palette - * https://www.nordtheme.com/ + * FitAI Color System - BOLD MODERN + * Electric Blue palette with high-energy fitness app aesthetics */ export interface ColorScheme { @@ -12,6 +11,7 @@ export interface ColorScheme { // Accent Colors accent: string; + secondary: string; terracotta: string; sand: string; @@ -21,6 +21,11 @@ export interface ColorScheme { danger: string; info: string; + // Activity Ring Colors + calories: string; + water: string; + workouts: string; + // Neutrals background: string; surface: string; @@ -39,97 +44,119 @@ export interface ColorScheme { overlay: string; overlayLight: string; - // Legacy compatibility (will be phased out) + // Gradients (as arrays) + primaryGradient: string[]; + cardGradient: string[]; + + // Legacy compatibility white: string; black: string; } /** - * Light Mode Color Palette - * Nord Snow Storm (light backgrounds) with Polar Night (dark text) + * Light Mode - Bold & Energetic */ export const lightColors: ColorScheme = { - // Primary Colors (Nord Frost - Aurora blue-green) - primary: "#88C0D0", // Nord Frost 8 (main actions, cyan) - primaryDark: "#5E81AC", // Nord Frost 10 (dark blue) - primaryLight: "#8FBCBB", // Nord Frost 7 (pale cyan) + // Primary Colors - Electric Blue + primary: "#0066FF", + primaryDark: "#0052CC", + primaryLight: "#3385FF", // Accent Colors - accent: "#81A1C1", // Nord Frost 9 (blue-gray) - terracotta: "#D08770", // Nord Aurora 12 (orange - replaces terracotta) - sand: "#EBCB8B", // Nord Aurora 13 (yellow - warm accent) + accent: "#7B2CBF", // Purple + secondary: "#FF3B7A", // Hot Pink + terracotta: "#FF6B35", // Neon Orange + sand: "#FFD60A", // Electric Yellow - // Status Colors - success: "#A3BE8C", // Nord Aurora 14 (green) - warning: "#EBCB8B", // Nord Aurora 13 (yellow) - danger: "#BF616A", // Nord Aurora 11 (red) - info: "#81A1C1", // Nord Frost 9 (blue) + // Status Colors - Vibrant + success: "#00D26A", + warning: "#FFB800", + danger: "#FF3B3B", + info: "#00B8D9", - // Neutrals (Snow Storm palette) - background: "#ECEFF4", // Nord Snow Storm 3 (lightest) - surface: "#E5E9F0", // Nord Snow Storm 2 (medium) - surfaceElevated: "#D8DEE9", // Nord Snow Storm 1 (slightly darker) + // Activity Ring Colors + calories: "#FF6B35", // Orange for calories + water: "#00B8D9", // Cyan for water + workouts: "#0066FF", // Blue for workouts - // Text (Polar Night palette) - textPrimary: "#2E3440", // Nord Polar Night 0 (darkest) - textSecondary: "#3B4252", // Nord Polar Night 1 - textTertiary: "#4C566A", // Nord Polar Night 3 + // Neutrals - Bold dark on light + background: "#F5F5F7", + surface: "#FFFFFF", + surfaceElevated: "#FFFFFF", + + // Text - High contrast dark + textPrimary: "#1A1A1A", + textSecondary: "#4A4A4A", + textTertiary: "#8E8E93", // Borders - border: "#D8DEE9", // Nord Snow Storm 1 - borderLight: "#E5E9F0", // Nord Snow Storm 2 + border: "#E5E5EA", + borderLight: "#F0F0F5", // Overlays - overlay: "rgba(46, 52, 64, 0.5)", // Polar Night 0 - overlayLight: "rgba(46, 52, 64, 0.05)", + overlay: "rgba(0, 0, 0, 0.5)", + overlayLight: "rgba(0, 0, 0, 0.03)", + + // Gradients + primaryGradient: ["#0066FF", "#0052CC"], + cardGradient: ["#FFFFFF", "#F8F8FA"], // Legacy - white: "#ECEFF4", - black: "#2E3440", + white: "#FFFFFF", + black: "#1A1A1A", }; /** - * Dark Mode Color Palette - * Nord Polar Night (dark backgrounds) with Snow Storm (light text) + * Dark Mode - Premium & Immersive */ export const darkColors: ColorScheme = { - // Primary Colors (Nord Frost - adjusted for dark mode) - primary: "#88C0D0", // Nord Frost 8 (cyan - brighter on dark) - primaryDark: "#5E81AC", // Nord Frost 10 (dark blue) - primaryLight: "#8FBCBB", // Nord Frost 7 (pale cyan) + // Primary Colors - Electric Blue (brighter on dark) + primary: "#0A84FF", + primaryDark: "#0066FF", + primaryLight: "#5AC8FA", // Accent Colors - accent: "#81A1C1", // Nord Frost 9 (blue-gray) - terracotta: "#D08770", // Nord Aurora 12 (orange) - sand: "#EBCB8B", // Nord Aurora 13 (yellow) + accent: "#BF5AF2", // Purple + secondary: "#FF375F", // Hot Pink + terracotta: "#FF9500", // Orange + sand: "#FFD60A", // Yellow // Status Colors - success: "#A3BE8C", // Nord Aurora 14 (green) - warning: "#EBCB8B", // Nord Aurora 13 (yellow) - danger: "#BF616A", // Nord Aurora 11 (red) - info: "#81A1C1", // Nord Frost 9 (blue) + success: "#30D158", + warning: "#FFD60A", + danger: "#FF453A", + info: "#64D2FF", - // Neutrals (Polar Night palette) - background: "#2E3440", // Nord Polar Night 0 (darkest) - surface: "#3B4252", // Nord Polar Night 1 (medium dark) - surfaceElevated: "#434C5E", // Nord Polar Night 2 (lighter) + // Activity Ring Colors (even brighter for dark mode) + calories: "#FF9500", + water: "#64D2FF", + workouts: "#0A84FF", - // Text (Snow Storm palette) - textPrimary: "#ECEFF4", // Nord Snow Storm 3 (lightest) - textSecondary: "#E5E9F0", // Nord Snow Storm 2 - textTertiary: "#D8DEE9", // Nord Snow Storm 1 + // Neutrals - Dark backgrounds + background: "#000000", + surface: "#1C1C1E", + surfaceElevated: "#2C2C2E", + + // Text - Bright on dark + textPrimary: "#FFFFFF", + textSecondary: "#EBEBF5", + textTertiary: "#8E8E93", // Borders - border: "#434C5E", // Nord Polar Night 2 - borderLight: "#3B4252", // Nord Polar Night 1 + border: "#38383A", + borderLight: "#48484A", // Overlays overlay: "rgba(0, 0, 0, 0.6)", - overlayLight: "rgba(236, 239, 244, 0.05)", // Snow Storm 3 + overlayLight: "rgba(255, 255, 255, 0.05)", + + // Gradients + primaryGradient: ["#0A84FF", "#0066FF"], + cardGradient: ["#1C1C1E", "#2C2C2E"], // Legacy - white: "#ECEFF4", - black: "#2E3440", + white: "#FFFFFF", + black: "#000000", }; /** diff --git a/apps/mobile/src/styles/typography.ts b/apps/mobile/src/styles/typography.ts index 37bb3a1..08e91dd 100644 --- a/apps/mobile/src/styles/typography.ts +++ b/apps/mobile/src/styles/typography.ts @@ -1,53 +1,54 @@ /** - * FitAI Typography System - * Minimalist typography with clear hierarchy using system fonts + * FitAI Typography System - BOLD MODERN + * High-impact typography with clear hierarchy using system fonts */ import { TextStyle } from "react-native"; /** - * Font Sizes - * Refined scale with fewer sizes for clearer hierarchy + * Font Sizes - Larger for bold impact */ export const fontSize = { - xs: 11, - sm: 13, - base: 15, - md: 17, // Body emphasis - lg: 20, - xl: 24, - "2xl": 28, - "3xl": 34, - "4xl": 40, + xs: 12, + sm: 14, + base: 16, + md: 18, // Body emphasis + lg: 22, + xl: 26, + "2xl": 32, + "3xl": 40, + "4xl": 52, + "5xl": 64, } as const; /** - * Font Weights + * Font Weights - Emphasize bold */ export const fontWeight = { regular: "400" as TextStyle["fontWeight"], medium: "500" as TextStyle["fontWeight"], semibold: "600" as TextStyle["fontWeight"], bold: "700" as TextStyle["fontWeight"], + extrabold: "800" as TextStyle["fontWeight"], } as const; /** * Line Heights */ export const lineHeight = { - tight: 1.2, - normal: 1.5, - relaxed: 1.7, + tight: 1.15, + normal: 1.4, + relaxed: 1.6, } as const; /** * Letter Spacing */ export const letterSpacing = { - tight: -0.5, + tight: -1, normal: 0, wide: 0.5, - wider: 1, + wider: 1.5, } as const; /** @@ -58,11 +59,14 @@ export interface TypographyPresets { h1: TextStyle; h2: TextStyle; h3: TextStyle; + h4: TextStyle; body: TextStyle; bodyEmphasis: TextStyle; label: TextStyle; stat: TextStyle; + statLarge: TextStyle; caption: TextStyle; + button: TextStyle; } export const createTypographyPresets = ( @@ -70,25 +74,33 @@ export const createTypographyPresets = ( textSecondary: string, textTertiary: string, ): TypographyPresets => ({ - // Display Text (Screen Titles) + // Display Text (Screen Titles) - Extra Bold h1: { - fontSize: fontSize["3xl"], - fontWeight: fontWeight.bold, + fontSize: fontSize["4xl"], + fontWeight: fontWeight.extrabold, letterSpacing: letterSpacing.tight, - lineHeight: fontSize["3xl"] * lineHeight.tight, + lineHeight: fontSize["4xl"] * lineHeight.tight, color: textPrimary, }, - // Section Headers + // Section Headers - Bold h2: { - fontSize: fontSize.xl, + fontSize: fontSize["2xl"], + fontWeight: fontWeight.bold, + letterSpacing: -0.5, + color: textPrimary, + }, + + // Card Titles - Semibold + h3: { + fontSize: fontSize.lg, fontWeight: fontWeight.semibold, letterSpacing: -0.3, color: textPrimary, }, - // Card Titles - h3: { + // Small Headers + h4: { fontSize: fontSize.md, fontWeight: fontWeight.semibold, color: textPrimary, @@ -112,17 +124,27 @@ export const createTypographyPresets = ( // Labels (uppercase, spaced) label: { - fontSize: fontSize.sm, - fontWeight: fontWeight.medium, - letterSpacing: letterSpacing.wide, + fontSize: fontSize.xs, + fontWeight: fontWeight.semibold, + letterSpacing: letterSpacing.wider, textTransform: "uppercase", color: textTertiary, }, - // Stats/Numbers + // Stats/Numbers - Bold Large stat: { - fontSize: fontSize["2xl"], + fontSize: fontSize["3xl"], fontWeight: fontWeight.bold, + letterSpacing: -1, + color: textPrimary, + }, + + // Large Stats (Hero numbers) + statLarge: { + fontSize: fontSize["5xl"], + fontWeight: fontWeight.extrabold, + letterSpacing: -2, + lineHeight: fontSize["5xl"] * lineHeight.tight, color: textPrimary, }, @@ -132,6 +154,13 @@ export const createTypographyPresets = ( fontWeight: fontWeight.regular, color: textTertiary, }, + + // Button Text + button: { + fontSize: fontSize.base, + fontWeight: fontWeight.bold, + letterSpacing: 0.5, + }, }); /** From 064dafad57c015cb0d9a2a2456f596394cd0a0bc Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 12 Mar 2026 20:19:48 +0100 Subject: [PATCH 11/11] refinenments --- apps/admin/data/fitai.db | Bin 172032 -> 172032 bytes apps/mobile/src/app/(tabs)/goals.tsx | 163 ++++-- apps/mobile/src/app/(tabs)/profile.tsx | 466 ++++++++++++++---- .../src/components/GoalTypeBreakdownChart.tsx | 154 ++++-- .../src/components/WeeklyProgressChart.tsx | 96 ++-- apps/mobile/src/config/api.ts | 1 + 6 files changed, 635 insertions(+), 245 deletions(-) diff --git a/apps/admin/data/fitai.db b/apps/admin/data/fitai.db index 62294b2b057da644ea4c6b091d91bb0ec162c533..17ac7ec5bdc37716ca4895a85abbfcb5d9a70775 100644 GIT binary patch delta 1993 zcma)7U5Fc16rR~6ZL@85wzOK7t?encw2>su-zMFNVBJ~~j4dsTC|h@LX6_`nnVFlt zb7#{PF}t8eOQG5bd9YXnkqSa}LtXHp_Q7`%`cSMC{CNdlx z@0{=Z&Yh(j!%H`Y-yPTI-`hE*&wnxZsiC|5;nA^?jn#wWyAz2$-OqPV8A4ACenw+y zP3wMl8M>eC%5DF-c>Y7TmJf=aJ82eQBYCIh^ncv-_(vlfjLn*H*0^e%GHw~0`=dA3 zM$!i&)4E->%ae!fVtS%9SxXnoxpI2as#)o5!7P~6E)|O;yFmr^wp<$8+nxFL%9d#2 zre@5K{5mq1xY^$W-y}-Q@z}O%RZH*CbbVVis*PS!XZ+&ax_oOteT?t#;o3ntlYo5 zI`gW2MIVkBXBFAEjH}qz86&Cq`#-fJy{lZG#`KFCPPJ-W#Pm0f-fBnR8;gW(E3n%g zJ&7^*G~yrM9u`?Qp>k;)f6p6&+!7^+qh<2z%t85@7iU3--gJ( zXf>{@rdPketUvL`rlHu1ws|eK(%&=sNvwSS$cEAB>h8B@--*3V9z!XWjQ{PBkc8ux zhT>1Y%!B<46kK9aAmB^Ey*hpnA)&SiCU;v7l?=~hn?s!w#|J@8>Pcs@w{&Uf(N44e z)6)C0LF9fPY~o4cOJ;(F@|#35?q%Sm26HGZ@<4zY2!XkVdSd{r4kPQkgDr{;>uzBEFAuLD^wSYMm1TEFX3sf~| zHi+j@2Xlx7m%G?Y-~vK%9M$ugFYzP=K6ZoPq=pbJ!RvzhK5%cnlhE-X0uP91!6`cs z*nxmHW%ULYB_64x`#qUC%FQ55BTyrb+8GPlTr_zgRd;^SYH>v~myLBMDv(RU^PZ$) zfjDp?@G8CEs`_}RCYaxZHgTFEHwcH=4u*L|QpkhLyg*Wfvf(tZBZqas@dyrRQK3Rw z#H4V5Fc%3DP^uKN>2f8TRfz|iZW7uITgVOSs4@erFg)Lx_y<99Nt_fOI}UH-IA{?9 z6Y2E^kV5XHE#CIR{0!uia8jb)b*w(cgc&edf#WC@7cLaQr!wq0mq$yre4xZ^DDWD$ z76)wl^8u0j{1mhTzmX0w=s?q>6mSYu2&EQQG8O93>b0u+*mJ4%SxQ-~j*42!t)a7I zn<8rpG6RJq91brjIDtXRSrs^nUh^9RCbGQ;iuaIhTdAlhMg1LG_d_(3qi0b=!Ys88 zVU6$)v_ICC;^1lN=bv}-DJ~A$$g^rPYy&(dQdS(FblhOirVo;haaFbX(11CLVHvQhr zF?~E1=5+bjJGyIM?R=#G4nxO>hH0ax1z3bRix_07yF&@2yp5n}eZ?B!b4r~KHqOr= YNdkqk@R>A=ue*cK+10fVhBik31~qA--2eap delta 307 zcmYj~ze@sP7{{OI-ZS+s-$#drFw`r93MvBsfWS3F0-@omTbdjy#Q7YewYnQ_NU*3u zX}IFW-qrsg+CoEU3mR+_A)*&r8o!_KuSU;k^o)x%Rxjs@SbcOlgsw1>vpjmRp3Wu` zmj93~W^46hG)sR#kF3^fht59@{!1(8H!~Z0e|M`R-ZKj~JVFJaGYV;sUa26g+&t+^ ztb)OGQ_K7IbK79t0XpFy+)?fh7tZhw4MrZ2q&M - + {statistics && + (statistics.weeklyTrend.length > 0 || + statistics.goals.goalsByType.length > 0) && ( + setShowAnalytics(!showAnalytics)} - activeOpacity={0.7} + activeOpacity={0.85} > - - - - 📈 Progress Analytics - - - - + + + + + + + + + Progress Analytics + + + {showAnalytics ? "Tap to collapse" : "Tap to expand"} + + + + + + + - {showAnalytics && ( - - {statistics.weeklyTrend.length > 0 && ( - + {showAnalytics && ( + + {statistics.weeklyTrend.length > 0 && ( + + + Weekly Trend + + + + )} + {statistics.goals.goalsByType.length > 0 && ( + + + Goals by Type + + + + )} + )} - {statistics.goals.goalsByType.length > 0 && ( - - )} - - )} - - - )} + + + + )} {/* Active Goals */} @@ -439,6 +476,9 @@ const styles = StyleSheet.create({ paddingHorizontal: 12, borderRadius: 20, }, + analyticsCard: { + padding: 20, + }, analyticsHeader: { flexDirection: "row", justifyContent: "space-between", @@ -448,13 +488,32 @@ const styles = StyleSheet.create({ flexDirection: "row", alignItems: "center", }, + analyticsIcon: { + width: 48, + height: 48, + borderRadius: 14, + justifyContent: "center", + alignItems: "center", + marginRight: 14, + }, + analyticsToggle: { + width: 36, + height: 36, + borderRadius: 10, + justifyContent: "center", + alignItems: "center", + }, analyticsContent: { - paddingTop: 16, - marginTop: 16, + paddingTop: 24, + marginTop: 20, borderTopWidth: 1, + borderTopColor: "rgba(0,0,0,0.05)", + }, + chartSection: { + marginBottom: 20, }, goalsList: { - gap: 12, + gap: 16, }, emptyState: { alignItems: "center", diff --git a/apps/mobile/src/app/(tabs)/profile.tsx b/apps/mobile/src/app/(tabs)/profile.tsx index 2945f93..d6808a3 100644 --- a/apps/mobile/src/app/(tabs)/profile.tsx +++ b/apps/mobile/src/app/(tabs)/profile.tsx @@ -19,6 +19,7 @@ import { MinimalButton } from "../../components/MinimalButton"; import { Badge } from "../../components/Badge"; import { IconContainer } from "../../components/IconContainer"; import { API_BASE_URL, API_ENDPOINTS } from "../../config/api"; +import { fitnessProfileApi, FitnessProfile } from "../../api/fitnessProfile"; import log from "../../utils/logger"; export default function ProfileScreen() { @@ -35,6 +36,11 @@ export default function ProfileScreen() { const [selectedGymId, setSelectedGymId] = useState(null); const [currentGymId, setCurrentGymId] = useState(null); const [currentGymName, setCurrentGymName] = useState(null); + const [showGymDropdown, setShowGymDropdown] = useState(false); + const [fitnessProfile, setFitnessProfile] = useState( + null, + ); + const [profileLoading, setProfileLoading] = useState(false); useEffect(() => { const gid = @@ -49,8 +55,23 @@ export default function ProfileScreen() { useEffect(() => { loadGyms(); + loadFitnessProfile(); }, []); + const loadFitnessProfile = async () => { + try { + setProfileLoading(true); + const token = await getToken(); + if (!token) return; + const profile = await fitnessProfileApi.getFitnessProfile(token); + setFitnessProfile(profile); + } catch (error) { + log.error("Failed to load fitness profile", error); + } finally { + setProfileLoading(false); + } + }; + const loadGyms = async () => { try { setGymsLoading(true); @@ -115,8 +136,12 @@ export default function ProfileScreen() { const handleApplyGym = async () => { try { const token = await getToken(); - const url = `${API_BASE_URL}${API_ENDPOINTS.USERS}/gym`; - log.debug("Updating gym selection", { url, gymId: selectedGymId }); + const url = `${API_BASE_URL}${API_ENDPOINTS.USERS.GYM}`; + log.debug("Updating gym selection", { + url, + gymId: selectedGymId, + token: token ? "present" : "missing", + }); const res = await fetch(url, { method: "PATCH", headers: { @@ -331,29 +356,145 @@ export default function ProfileScreen() { onPress={() => router.push("/personal-details")} /> - - - - } - rightElement={ - - } + + {/* Fitness Profile Card */} + router.push("/fitness-profile")} - /> + activeOpacity={0.85} + > + + + + + + + + Fitness Profile + + + {fitnessProfile ? "Tap to edit" : "Set up your profile"} + + + + + + + + {profileLoading ? ( + + + + ) : fitnessProfile ? ( + + + + {fitnessProfile.height || "-"} + + + Height (cm) + + + + + + {fitnessProfile.weight || "-"} + + + Weight (kg) + + + + + + {fitnessProfile.age || "-"} + + + Age + + + + ) : ( + + + Complete your fitness profile to get personalized + recommendations + + router.push("/fitness-profile")} + /> + + )} + + + - - - Gym Selection - - - - Refresh - - - - - {currentGymName && ( - - - Current Gym - - + Gym Selection + + + setShowGymDropdown(!showGymDropdown)} + activeOpacity={0.85} + > + + + + + Current Gym + + + {currentGymName || "No gym selected"} + + + - {currentGymName} - + + - )} + + - {gymsLoading ? ( - - - - ) : ( - <> - + {showGymDropdown && ( + + {gymsLoading ? ( + + + + ) : ( + <> setSelectedGymId(null)} + onPress={() => { + setSelectedGymId(null); + setShowGymDropdown(false); + }} > No Gym + {selectedGymId === null && ( + + )} {gyms.map((gym) => ( setSelectedGymId(gym.id)} + onPress={() => { + setSelectedGymId(gym.id); + setShowGymDropdown(false); + }} > - - {gym.name} - + + + {gym.name} + + {gym.location && ( + + {gym.location} + + )} + + {selectedGymId === gym.id && ( + + )} ))} - - - - )} - + {selectedGymId !== currentGymId && ( + + )} + + )} + + )} {/* Support */} @@ -651,4 +825,78 @@ const styles = StyleSheet.create({ borderWidth: 1.5, marginRight: 8, }, + dropdownCard: { + padding: 16, + }, + dropdownHeader: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + }, + dropdownIcon: { + width: 36, + height: 36, + borderRadius: 10, + justifyContent: "center", + alignItems: "center", + }, + dropdownOptions: { + marginTop: 8, + padding: 8, + }, + dropdownOption: { + flexDirection: "row", + alignItems: "center", + justifyContent: "space-between", + paddingVertical: 14, + paddingHorizontal: 16, + borderRadius: 12, + marginBottom: 4, + }, + fitnessProfileCard: { + padding: 16, + }, + fitnessProfileHeader: { + flexDirection: "row", + alignItems: "center", + }, + fitnessProfileIcon: { + width: 48, + height: 48, + borderRadius: 14, + justifyContent: "center", + alignItems: "center", + }, + editButton: { + width: 32, + height: 32, + borderRadius: 8, + justifyContent: "center", + alignItems: "center", + }, + profileLoading: { + paddingVertical: 20, + alignItems: "center", + }, + fitnessProfileStats: { + flexDirection: "row", + justifyContent: "space-around", + marginTop: 20, + paddingTop: 16, + borderTopWidth: 1, + }, + profileStat: { + alignItems: "center", + flex: 1, + }, + profileStatDivider: { + width: 1, + height: 40, + }, + noProfile: { + marginTop: 16, + paddingTop: 16, + borderTopWidth: 1, + alignItems: "center", + }, }); diff --git a/apps/mobile/src/components/GoalTypeBreakdownChart.tsx b/apps/mobile/src/components/GoalTypeBreakdownChart.tsx index 22757d6..6d62a19 100644 --- a/apps/mobile/src/components/GoalTypeBreakdownChart.tsx +++ b/apps/mobile/src/components/GoalTypeBreakdownChart.tsx @@ -1,7 +1,7 @@ import React from "react"; import { View, Text, StyleSheet, Dimensions } from "react-native"; import { PieChart } from "react-native-chart-kit"; -import { theme } from "../styles/theme"; +import { useTheme } from "../contexts/ThemeContext"; interface GoalTypeData { goalType: string; @@ -17,37 +17,40 @@ export function GoalTypeBreakdownChart({ data, title = "Goals by Type", }: GoalTypeBreakdownChartProps) { + const { colors, typography } = useTheme(); const screenWidth = Dimensions.get("window").width; - // Color palette for different goal types - const colors = [ - "#3b82f6", // Blue - "#10b981", // Green - "#f59e0b", // Orange - "#8b5cf6", // Purple - "#ec4899", // Pink - "#06b6d4", // Cyan + const chartColors = [ + colors.primary, + colors.success, + colors.warning, + colors.accent, + colors.secondary, + colors.info, ]; - // Prepare chart data const chartData = data.map((item, index) => ({ - name: item.goalType, + name: item.goalType + .replace(/_/g, " ") + .replace(/\b\w/g, (l) => l.toUpperCase()), count: item.count, - color: colors[index % colors.length], - legendFontColor: theme.colors.gray600, + color: chartColors[index % chartColors.length], + legendFontColor: colors.textSecondary, legendFontSize: 12, })); - const chartConfig = { - color: (opacity = 1) => `rgba(59, 130, 246, ${opacity})`, - }; + const totalGoals = data.reduce((sum, item) => sum + item.count, 0); if (data.length === 0) { return ( - {title} + + {title} + - No goals yet + + No goals yet + ); @@ -55,46 +58,123 @@ export function GoalTypeBreakdownChart({ return ( - {title} + + {title} + + + {/* Summary Stats */} + + + + {totalGoals} + + + Total Goals + + + + + {data.length} + + + Types + + + + `rgba(0, 0, 0, ${opacity})`, + }} accessor="count" backgroundColor="transparent" paddingLeft="15" absolute /> + + {/* Legend */} + + {data.map((item, index) => ( + + + + {item.goalType + .replace(/_/g, " ") + .replace(/\b\w/g, (l) => l.toUpperCase())} + + + {item.count} + + + ))} + ); } const styles = StyleSheet.create({ container: { - backgroundColor: theme.colors.white, - borderRadius: theme.borderRadius.xl, - padding: 16, - marginBottom: 16, - ...theme.shadows.medium, + borderRadius: 16, + padding: 4, }, - title: { - fontSize: theme.typography.fontSize.lg, - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.gray700, - marginBottom: 12, + summaryRow: { + flexDirection: "row", + justifyContent: "space-around", + marginBottom: 16, + paddingVertical: 12, + }, + summaryItem: { + alignItems: "center", }, chartContainer: { alignItems: "center", + marginBottom: 16, + }, + legendGrid: { + gap: 10, + }, + legendItem: { + flexDirection: "row", + alignItems: "center", + gap: 10, + }, + legendDot: { + width: 12, + height: 12, + borderRadius: 6, }, emptyState: { - paddingVertical: 40, + paddingVertical: 32, alignItems: "center", }, - emptyText: { - fontSize: theme.typography.fontSize.sm, - color: theme.colors.gray400, - }, }); diff --git a/apps/mobile/src/components/WeeklyProgressChart.tsx b/apps/mobile/src/components/WeeklyProgressChart.tsx index 26e43c5..9d6a1a4 100644 --- a/apps/mobile/src/components/WeeklyProgressChart.tsx +++ b/apps/mobile/src/components/WeeklyProgressChart.tsx @@ -1,7 +1,7 @@ import React from "react"; import { View, Text, StyleSheet, Dimensions } from "react-native"; import { LineChart } from "react-native-chart-kit"; -import { theme } from "../styles/theme"; +import { useTheme } from "../contexts/ThemeContext"; import type { WeeklyTrendData } from "../api/types"; interface WeeklyProgressChartProps { @@ -13,28 +13,26 @@ export function WeeklyProgressChart({ weeklyData, title = "Weekly Progress", }: WeeklyProgressChartProps) { + const { colors, typography } = useTheme(); const screenWidth = Dimensions.get("window").width; - // Prepare chart data - const labels = weeklyData.map((week) => week.weekLabel); - const checkInsData = weeklyData.map((week) => week.checkIns); - const goalsCompletedData = weeklyData.map((week) => week.goalsCompleted); - const avgProgressData = weeklyData.map((week) => week.averageProgress); + const labels = weeklyData.map((week: WeeklyTrendData) => week.weekLabel); + const checkInsData = weeklyData.map((week: WeeklyTrendData) => week.checkIns); + const goalsCompletedData = weeklyData.map( + (week: WeeklyTrendData) => week.goalsCompleted, + ); const chartConfig = { - backgroundColor: theme.colors.white, - backgroundGradientFrom: theme.colors.white, - backgroundGradientTo: theme.colors.white, + backgroundColor: colors.surface, + backgroundGradientFrom: colors.surface, + backgroundGradientTo: colors.surface, decimalPlaces: 0, - color: (opacity = 1) => `rgba(59, 130, 246, ${opacity})`, - labelColor: (opacity = 1) => `rgba(107, 114, 128, ${opacity})`, - style: { - borderRadius: theme.borderRadius.lg, - }, + color: (opacity = 1) => `rgba(0, 102, 255, ${opacity})`, + labelColor: (opacity = 1) => colors.textTertiary, propsForDots: { - r: "4", + r: "5", strokeWidth: "2", - stroke: theme.colors.primary, + stroke: colors.primary, }, }; @@ -43,31 +41,40 @@ export function WeeklyProgressChart({ datasets: [ { data: checkInsData, - color: (opacity = 1) => `rgba(59, 130, 246, ${opacity})`, // Blue for check-ins - strokeWidth: 2, + color: () => colors.primary, + strokeWidth: 3, }, { data: goalsCompletedData, - color: (opacity = 1) => `rgba(16, 185, 129, ${opacity})`, // Green for goals - strokeWidth: 2, + color: () => colors.success, + strokeWidth: 3, }, ], - legend: ["Check-ins", "Goals Completed"], + legend: ["Check-ins", "Goals"], }; return ( - {title} + {title && ( + + {title} + + )} - - Check-ins + + + Check-ins + - - Goals Completed + + + Goals + @@ -89,17 +104,8 @@ export function WeeklyProgressChart({ const styles = StyleSheet.create({ container: { - backgroundColor: theme.colors.white, - borderRadius: theme.borderRadius.xl, - padding: 16, - marginBottom: 16, - ...theme.shadows.medium, - }, - title: { - fontSize: theme.typography.fontSize.lg, - fontWeight: theme.typography.fontWeight.bold, - color: theme.colors.gray700, - marginBottom: 12, + borderRadius: 16, + padding: 4, }, chartContainer: { alignItems: "center", @@ -107,26 +113,22 @@ const styles = StyleSheet.create({ }, chart: { marginVertical: 8, - borderRadius: theme.borderRadius.lg, + borderRadius: 12, }, legend: { flexDirection: "row", justifyContent: "center", - gap: 20, + gap: 24, paddingTop: 8, }, legendItem: { flexDirection: "row", alignItems: "center", - gap: 6, + gap: 8, }, legendDot: { width: 10, height: 10, borderRadius: 5, }, - legendText: { - fontSize: theme.typography.fontSize.sm, - color: theme.colors.gray500, - }, }); diff --git a/apps/mobile/src/config/api.ts b/apps/mobile/src/config/api.ts index 08c3d3a..563dbba 100644 --- a/apps/mobile/src/config/api.ts +++ b/apps/mobile/src/config/api.ts @@ -35,6 +35,7 @@ export const API_ENDPOINTS = { USERS: { LIST: "/api/users", STATISTICS: "/api/users/statistics", + GYM: "/api/users/gym", }, GYMS: "/api/gyms", ATTENDANCE: {