import React from "react";
import {
View,
Text,
StyleSheet,
ScrollView,
TouchableOpacity,
} from "react-native";
import { useUser } from "@clerk/clerk-expo";
import { Ionicons } from "@expo/vector-icons";
import { useRouter } from "expo-router";
export default function HomeScreen() {
const { user, isLoaded } = useUser();
const router = useRouter();
if (!isLoaded || !user) {
return (
Loading...
);
}
const firstName = user.firstName || "User";
const greeting = getGreeting();
return (
{/* Welcome Header */}
{greeting}!
{firstName}
{/* Quick Stats */}
0
This Month
0
Day Streak
0
Total Visits
{/* Quick Actions */}
Quick Actions
router.push("/fitness-profile")}
>
Fitness Profile
Manage your fitness information
Check In
Start your workout session
View Schedule
Check your upcoming classes
Payments
View payment history
{/* Membership Info */}
Membership
Basic Plan
Active
{user.primaryEmailAddress?.emailAddress}
Member since {new Date(user.createdAt!).toLocaleDateString()}
{/* Recent Activity */}
Recent Activity
No recent activity
Check in to start tracking your workouts
);
}
function getGreeting(): string {
const hour = new Date().getHours();
if (hour < 12) return "Good morning";
if (hour < 18) return "Good afternoon";
return "Good evening";
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#f5f5f5",
},
content: {
padding: 20,
},
header: {
marginBottom: 24,
},
greeting: {
fontSize: 16,
color: "#6b7280",
marginBottom: 4,
},
name: {
fontSize: 32,
fontWeight: "bold",
color: "#1a1a1a",
},
statsContainer: {
flexDirection: "row",
justifyContent: "space-between",
marginBottom: 24,
},
statCard: {
flex: 1,
backgroundColor: "white",
borderRadius: 12,
padding: 16,
alignItems: "center",
marginHorizontal: 4,
shadowColor: "#000",
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.05,
shadowRadius: 2,
elevation: 2,
},
statValue: {
fontSize: 24,
fontWeight: "bold",
color: "#1a1a1a",
marginTop: 8,
marginBottom: 4,
},
statLabel: {
fontSize: 12,
color: "#6b7280",
textAlign: "center",
},
section: {
marginBottom: 24,
},
sectionTitle: {
fontSize: 18,
fontWeight: "600",
color: "#1a1a1a",
marginBottom: 12,
},
actionButton: {
flexDirection: "row",
alignItems: "center",
backgroundColor: "white",
borderRadius: 12,
padding: 16,
marginBottom: 8,
shadowColor: "#000",
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.05,
shadowRadius: 2,
elevation: 2,
},
actionIcon: {
width: 48,
height: 48,
borderRadius: 24,
backgroundColor: "#f0f9ff",
justifyContent: "center",
alignItems: "center",
marginRight: 12,
},
actionContent: {
flex: 1,
},
actionTitle: {
fontSize: 16,
fontWeight: "600",
color: "#1a1a1a",
marginBottom: 2,
},
actionSubtitle: {
fontSize: 14,
color: "#6b7280",
},
membershipCard: {
backgroundColor: "white",
borderRadius: 12,
padding: 16,
shadowColor: "#000",
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.05,
shadowRadius: 2,
elevation: 2,
},
membershipHeader: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
marginBottom: 8,
},
membershipType: {
fontSize: 18,
fontWeight: "600",
color: "#1a1a1a",
},
statusBadge: {
backgroundColor: "#dcfce7",
paddingHorizontal: 12,
paddingVertical: 4,
borderRadius: 12,
},
statusText: {
fontSize: 12,
fontWeight: "600",
color: "#16a34a",
},
membershipEmail: {
fontSize: 14,
color: "#6b7280",
marginBottom: 4,
},
membershipDate: {
fontSize: 12,
color: "#9ca3af",
},
emptyState: {
backgroundColor: "white",
borderRadius: 12,
padding: 32,
alignItems: "center",
shadowColor: "#000",
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.05,
shadowRadius: 2,
elevation: 2,
},
emptyStateText: {
fontSize: 16,
fontWeight: "600",
color: "#6b7280",
marginTop: 12,
marginBottom: 4,
},
emptyStateSubtext: {
fontSize: 14,
color: "#9ca3af",
textAlign: "center",
},
});