tangled
alpha
login
or
join now
back
round
1
view raw
feat: mutuals pill/button from catsky.social
#4
closed
opened by
vielle.dev
1 month ago
targeting
main
copy pasted from
https://github.com/NekoDrone/catsky-social/pull/73
full credit to isabel
options
unified
split
Changed files
+32
-2
src
components
Pills.tsx
ProfileCard.tsx
screens
Profile
Header
Handle.tsx
+27
src/components/Pills.tsx
···
177
177
</View>
178
178
)
179
179
}
180
180
+
181
181
+
export function Mutuals({size = 'sm'}: CommonProps) {
182
182
+
const t = useTheme()
183
183
+
184
184
+
const variantStyles = React.useMemo(() => {
185
185
+
switch (size) {
186
186
+
case 'sm':
187
187
+
case 'lg':
188
188
+
default:
189
189
+
return [
190
190
+
{
191
191
+
paddingHorizontal: 6,
192
192
+
paddingVertical: 3,
193
193
+
borderRadius: 4,
194
194
+
},
195
195
+
]
196
196
+
}
197
197
+
}, [size])
198
198
+
199
199
+
return (
200
200
+
<View style={[variantStyles, a.justify_center, t.atoms.bg_contrast_25]}>
201
201
+
<Text style={[a.text_xs, a.leading_tight]}>
202
202
+
<Trans>Mutuals</Trans>
203
203
+
</Text>
204
204
+
</View>
205
205
+
)
206
206
+
}
+2
-1
src/components/ProfileCard.tsx
···
596
596
const moderation = moderateProfile(profile, moderationOpts)
597
597
const modui = moderation.ui('profileList')
598
598
const followedBy = profile.viewer?.followedBy
599
599
+
const following = profile.viewer?.following
599
600
600
601
if (!followedBy && !modui.inform && !modui.alert) {
601
602
return null
···
603
604
604
605
return (
605
606
<Pills.Row style={[a.pt_xs]}>
606
606
-
{followedBy && <Pills.FollowsYou />}
607
607
+
{followedBy && (following ? <Pills.Mutuals /> : <Pills.FollowsYou />)}
607
608
{modui.alerts.map(alert => (
608
609
<Pills.Label key={getModerationCauseKey(alert)} cause={alert} />
609
610
))}
+3
-1
src/screens/Profile/Header/Handle.tsx
···
29
29
{profile.viewer?.followedBy && !blockHide ? (
30
30
<View style={[t.atoms.bg_contrast_25, a.rounded_xs, a.px_sm, a.py_xs]}>
31
31
<Text style={[t.atoms.text, a.text_sm]}>
32
32
-
<Trans>Follows you</Trans>
32
32
+
<Trans>
33
33
+
{profile.viewer?.following ? 'Mutuals' : 'Follows you'}
34
34
+
</Trans>
33
35
</Text>
34
36
</View>
35
37
) : undefined}