import React from "react"; import { StyleSheet, Text, View, } from "react-native"; import { moderateScale, scale, verticalScale, } from "react-native-size-matters"; import { Colors } from "@/theme"; interface ProfileAvatarProps { name: string; email: string; } function getInitials(nameString: string): string { if (!nameString || !nameString.trim()) return "U"; const parts = nameString.trim().split(/\s+/); if (parts.length === 1) { return parts[0].slice(0, 2).toUpperCase(); } return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase(); } export default function ProfileAvatar({ name, email, }: ProfileAvatarProps) { const initials = getInitials(name); return ( {initials} {name} {email} ); } const styles = StyleSheet.create({ container: { alignItems: "center", marginTop: verticalScale(4), marginBottom: verticalScale(16), }, initialsContainer: { width: scale(88), height: scale(88), borderRadius: scale(44), backgroundColor: "#DCFCE7", borderWidth: 2, borderColor: "#BBF7D0", justifyContent: "center", alignItems: "center", marginBottom: verticalScale(12), }, initialsText: { fontSize: moderateScale(28), fontWeight: "800", color: "#15803D", letterSpacing: 1, }, name: { fontSize: moderateScale(18), fontWeight: "700", color: Colors.textPrimary, textAlign: "center", }, email: { marginTop: verticalScale(3), fontSize: moderateScale(13), color: Colors.textSecondary, textAlign: "center", }, });