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
···
</View>
)
}
+
+
export function Mutuals({size = 'sm'}: CommonProps) {
+
const t = useTheme()
+
+
const variantStyles = React.useMemo(() => {
+
switch (size) {
+
case 'sm':
+
case 'lg':
+
default:
+
return [
+
{
+
paddingHorizontal: 6,
+
paddingVertical: 3,
+
borderRadius: 4,
+
},
+
]
+
}
+
}, [size])
+
+
return (
+
<View style={[variantStyles, a.justify_center, t.atoms.bg_contrast_25]}>
+
<Text style={[a.text_xs, a.leading_tight]}>
+
<Trans>Mutuals</Trans>
+
</Text>
+
</View>
+
)
+
}
+2 -1
src/components/ProfileCard.tsx
···
const moderation = moderateProfile(profile, moderationOpts)
const modui = moderation.ui('profileList')
const followedBy = profile.viewer?.followedBy
+
const following = profile.viewer?.following
if (!followedBy && !modui.inform && !modui.alert) {
return null
···
return (
<Pills.Row style={[a.pt_xs]}>
-
{followedBy && <Pills.FollowsYou />}
+
{followedBy && (following ? <Pills.Mutuals /> : <Pills.FollowsYou />)}
{modui.alerts.map(alert => (
<Pills.Label key={getModerationCauseKey(alert)} cause={alert} />
))}
+3 -1
src/screens/Profile/Header/Handle.tsx
···
{profile.viewer?.followedBy && !blockHide ? (
<View style={[t.atoms.bg_contrast_25, a.rounded_xs, a.px_sm, a.py_xs]}>
<Text style={[t.atoms.text, a.text_sm]}>
-
<Trans>Follows you</Trans>
+
<Trans>
+
{profile.viewer?.following ? 'Mutuals' : 'Follows you'}
+
</Trans>
</Text>
</View>
) : undefined}