Fix rendering inconsistencies between one's own and someone else's profile

This commit is contained in:
Nat 2021-03-24 11:49:08 -03:00
parent a13dcc48a7
commit 63b3727481
1 changed files with 19 additions and 14 deletions

View File

@ -144,7 +144,6 @@ const ProfileDisplayJsx = ({navigation}) => {
const accountName = navigation.getParam("acct", ""); const accountName = navigation.getParam("acct", "");
let [state, setState] = useState({ let [state, setState] = useState({
loaded: false, loaded: false,
own: false
}); });
const notif_pack = { const notif_pack = {
@ -157,7 +156,8 @@ const ProfileDisplayJsx = ({navigation}) => {
setState({ setState({
profile: TEST_PROFILE, profile: TEST_PROFILE,
mutuals: getMutuals(TEST_YOUR_FOLLOWERS, TEST_THEIR_FOLLOWERS), mutuals: getMutuals(TEST_YOUR_FOLLOWERS, TEST_THEIR_FOLLOWERS),
loaded: true own: true,
loaded: true,
}); });
}, []); }, []);
@ -200,16 +200,13 @@ const ProfileDisplayJsx = ({navigation}) => {
</View> </View>
{ {
state.own ? state.own ?
<View style = { styles.profileContextContainer }>
<TouchableWithoutFeedback> <TouchableWithoutFeedback>
<Image <Image
source = { activeOrNot(state.unread_notifs, notif_pack) } source = { activeOrNot(state.unread_notifs, notif_pack) }
style = { style = { styles.profileHeaderIcon } />
[
styles.profileHeaderIcon,
styles.profileContextConatiner
]
} />
</TouchableWithoutFeedback> </TouchableWithoutFeedback>
</View>
: <ModerateMenuJsx : <ModerateMenuJsx
triggerStyle = { styles.profileHeaderIcon } triggerStyle = { styles.profileHeaderIcon }
containerStyle = { styles.profileContextContainer } /> containerStyle = { styles.profileContextContainer } />
@ -220,13 +217,21 @@ const ProfileDisplayJsx = ({navigation}) => {
<Text <Text
onPress = { onPress = {
() => { () => {
const context = state.own ?
"People following you"
: "Your mutual followers with " + state.profile.display_name;
navigation.navigate("UserList", { navigation.navigate("UserList", {
data: [/*Some array of users*/], data: [/*Some array of users*/],
context: "Your mutual followers with " + state.profile.display_name context: context
}); });
} }
}> }>
{ state.mutuals.length } mutuals {
state.own ?
"View followers"
:state.mutuals.length + " mutuals"
}
</Text> </Text>
</Text> </Text>
<Text style = { styles.note }> <Text style = { styles.note }>