notifications enhanced

This commit is contained in:
feruz 2019-12-16 20:27:35 +02:00
parent 8345995a44
commit fa341e406a
3 changed files with 26 additions and 8 deletions

View File

@ -41,6 +41,10 @@ export default EStyleSheet.create({
title: {
color: '$primaryDarkGray',
},
moreinfo: {
color: '$primaryBlack',
flex: 1,
},
description: {
color: '$primaryBlack',
fontSize: 12,

View File

@ -15,7 +15,7 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
const intl = useIntl();
let _title;
let titleExtra = '';
let _moreinfo = '';
useEffect(() => {
setIsRead(notification.read);
}, [notification]);
@ -33,7 +33,6 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
titleExtra = notification.amount;
} else if (notification.weight) {
const _percent = `${parseFloat((notification.weight / 100).toFixed(2))}% `;
titleExtra = _percent;
}
@ -41,6 +40,18 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
id: `notification.${notification.type}`,
})}`;
if (
notification.type === 'vote' ||
notification.type === 'reblog' ||
(notification.type === 'mention' && notification.post)
) {
_moreinfo = notification.title || notification.permlink;
}
if (notification.type === 'reply' || (notification.type === 'mention' && !notification.post)) {
_moreinfo = notification.parent_title || notification.permlink;
}
return (
<TouchableHighlight onPress={_handleOnNotificationPress}>
<View
@ -54,7 +65,10 @@ const NotificationLineView = ({ notification, handleOnPressNotification }) => {
<View style={styles.body}>
<View style={styles.titleWrapper}>
<Text style={styles.name}>{notification.source} </Text>
<Text style={styles.title}>{_title}</Text>
<Text style={styles.title}>{_title} </Text>
<Text style={styles.moreinfo} numberOfLines={1} ellipsizeMode={4}>
{_moreinfo}
</Text>
</View>
{notification.description && (
<Text numberOfLines={1} style={styles.description}>

View File

@ -103,14 +103,14 @@
}
},
"notification": {
"vote": "likes your post",
"unvote": "unvoted your post",
"reply": "replied to your post",
"mention": "mentioned you",
"vote": "voted",
"unvote": "unvoted",
"reply": "replied to",
"mention": "mentioned in",
"follow": "followed you",
"unfollow": "unfollowed you",
"ignore": "ignored you",
"reblog": "reblogged your post",
"reblog": "reblogged",
"transfer": "transferred",
"notification": "Notifications",
"leaderboard": "Leaderboard",