/** * Profile Section Component * Generic user profile section for settings screens */ import React from "react"; import { View, TouchableOpacity, StyleSheet } from "react-native"; import { useAppDesignTokens } from "@umituz/react-native-design-system/theme"; import { AtomicText, AtomicIcon, AtomicAvatar } from "@umituz/react-native-design-system/atoms"; import { ProfileBenefitsList } from "./ProfileBenefitsList"; export interface ProfileSectionConfig { displayName?: string; userId?: string; isAnonymous: boolean; avatarUrl?: string; accountSettingsRoute?: string; benefits?: string[]; } export interface ProfileSectionProps { profile: ProfileSectionConfig; onPress?: () => void; onSignIn?: () => void; signInText?: string; anonymousText?: string; } export const ProfileSection: React.FC = ({ profile, onPress, onSignIn, signInText, anonymousText, }) => { const tokens = useAppDesignTokens(); const handlePress = () => { if (profile.isAnonymous && onSignIn) { onSignIn(); } else if (onPress) { onPress(); } }; return ( {profile.displayName} {profile.userId && ( {profile.userId} )} {onPress && !profile.isAnonymous && ( )} {profile.isAnonymous && onSignIn && ( {profile.benefits && profile.benefits.length > 0 && ( )} {signInText} )} ); }; const styles = StyleSheet.create({ container: { borderRadius: 12, padding: 16, marginBottom: 16 }, content: { flexDirection: "row", alignItems: "center" }, avatarContainer: { marginRight: 12 }, info: { flex: 1 }, displayName: { marginBottom: 2 }, ctaContainer: { marginTop: 12, paddingTop: 12, borderTopWidth: 1 }, ctaButton: { paddingVertical: 12, borderRadius: 8, alignItems: "center" }, });