import React from 'react'; import { StyleSheet, View } from 'react-native'; import { useTheme, Avatar, Card, Text } from 'react-native-paper'; export interface UserCardProps { /** User data to display */ user: { displayName: string; email?: string; avatarUrl?: string; ratingAvg?: number; totalRides?: number; }; /** Callback when the card is pressed */ onPress?: () => void; /** Visual size variant */ size?: 'small' | 'medium' | 'large'; } /** * User profile summary card showing avatar, name, email, * rating, and ride count. Supports three size variants. */ export function UserCard({ user, onPress, size = 'medium' }: UserCardProps) { const theme = useTheme(); const avatarSize = size === 'small' ? 36 : size === 'medium' ? 52 : 72; const initials = user.displayName .split(' ') .map((w) => w.charAt(0)) .join('') .toUpperCase() .slice(0, 2); return ( {user.displayName} {user.email ? ( {user.email} ) : null} {user.ratingAvg != null && user.ratingAvg > 0 && ( ⭐ {user.ratingAvg.toFixed(1)} )} {user.totalRides != null && user.totalRides > 0 && ( {user.totalRides} ride{user.totalRides !== 1 ? 's' : ''} )} ); } const styles = StyleSheet.create({ card: { borderRadius: 12, }, content: { flexDirection: 'row', alignItems: 'center', gap: 14, paddingVertical: 10, paddingHorizontal: 14, }, contentLarge: { flexDirection: 'column', alignItems: 'center', gap: 10, paddingVertical: 20, }, info: { flex: 1, gap: 2, }, metaRow: { flexDirection: 'row', gap: 12, marginTop: 2, }, });