import React, {useEffect, useState} from 'react'; import {Alert, StyleSheet, Text, View} from 'react-native'; import {ScrollView} from 'react-native-gesture-handler'; import {useSelector} from 'react-redux'; import {BadgeIcon} from '..'; import PlusIcon from '../../assets/icons/plus_icon-01.svg'; import {RootState} from '../../store/rootReducer'; import {ScreenType, UniversityBadgeDisplayType} from '../../types'; import {badgesToDisplayBadges, normalize} from '../../utils'; interface ProfileBadgesProps { userXId: string | undefined; screenType: ScreenType; } const ProfileBadges: React.FC = ({userXId, screenType}) => { const {badges} = useSelector((state: RootState) => userXId ? state.userX[screenType][userXId].profile : state.user.profile, ); const [displayBadges, setDisplayBadges] = useState< UniversityBadgeDisplayType[] >([]); useEffect(() => { setDisplayBadges(badgesToDisplayBadges(badges)); }, [badges]); return ( <> {displayBadges.length === 0 && ( <> Badges Proudly represent your team, club, or organization! )} {displayBadges.length === 0 ? ( Alert.alert('fooo')} /> {[0, 0, 0, 0, 0].map(() => ( ))} ) : ( {displayBadges.map((displayBadge) => ( ))} )} ); }; const styles = StyleSheet.create({ title: { fontWeight: '600', fontSize: normalize(13.5), lineHeight: normalize(18), }, body: { fontSize: normalize(13.5), lineHeight: normalize(17), }, badgeContainer: { width: '100%', borderWidth: 1, justifyContent: 'space-between', }, greyCircle: { width: normalize(31), height: normalize(31), borderRadius: normalize(31) / 2, backgroundColor: '#c4c4c4', }, }); export default ProfileBadges;