feat: mutuals pill/button from catsky.social #4

closed
opened by vielle.dev targeting main
Changed files
+32 -2
src
components
screens
Profile
Header
+27
src/components/Pills.tsx
··· 180 180 </View> 181 181 ) 182 182 } 183 + 184 + export function Mutuals({size = 'sm'}: CommonProps) { 185 + const t = useTheme() 186 + 187 + const variantStyles = React.useMemo(() => { 188 + switch (size) { 189 + case 'sm': 190 + case 'lg': 191 + default: 192 + return [ 193 + { 194 + paddingHorizontal: 6, 195 + paddingVertical: 3, 196 + borderRadius: 4, 197 + }, 198 + ] 199 + } 200 + }, [size]) 201 + 202 + return ( 203 + <View style={[variantStyles, a.justify_center, t.atoms.bg_contrast_25]}> 204 + <Text style={[a.text_xs, a.leading_tight]}> 205 + <Trans>Mutuals</Trans> 206 + </Text> 207 + </View> 208 + ) 209 + }
+2 -1
src/components/ProfileCard.tsx
··· 625 625 const moderation = moderateProfile(profile, moderationOpts) 626 626 const modui = moderation.ui('profileList') 627 627 const followedBy = profile.viewer?.followedBy 628 + const following = profile.viewer?.following 628 629 629 630 if (!followedBy && !modui.inform && !modui.alert) { 630 631 return null ··· 632 633 633 634 return ( 634 635 <Pills.Row style={[a.pt_xs]}> 635 - {followedBy && <Pills.FollowsYou />} 636 + {followedBy && (following ? <Pills.Mutuals /> : <Pills.FollowsYou />)} 636 637 {modui.alerts.map(alert => ( 637 638 <Pills.Label key={getModerationCauseKey(alert)} cause={alert} /> 638 639 ))}
+3 -1
src/screens/Profile/Header/Handle.tsx
··· 39 39 {profile.viewer?.followedBy && !blockHide ? ( 40 40 <View style={[t.atoms.bg_contrast_50, a.rounded_xs, a.px_sm, a.py_xs]}> 41 41 <Text style={[t.atoms.text, a.text_sm]}> 42 - <Trans>Follows you</Trans> 42 + <Trans> 43 + {profile.viewer?.following ? 'Mutuals' : 'Follows you'} 44 + </Trans> 43 45 </Text> 44 46 </View> 45 47 ) : undefined}