Skip to content

Commit

Permalink
Support follow and comment activity items
Browse files Browse the repository at this point in the history
  • Loading branch information
micahlt committed Mar 20, 2024
1 parent 398e627 commit d535a63
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/components/ActivityItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Card,
Icon,
Text,
Avatar,
TouchableRipple,
useTheme,
} from 'react-native-paper';
Expand Down Expand Up @@ -81,6 +82,62 @@ function ActivityItem({ activity }) {
</Text>
</Card.Content>
);
} else if (activity.type.includes('comment')) {
return (
<Card.Content style={{ padding: 15 }}>
<View style={{ flexDirection: 'row', marginBottom: 5 }}>
<Icon source="message" color={colors.primary} size={20}></Icon>
<Text
variant="labelLarge"
style={{ marginLeft: 5, color: colors.primary, flex: 1 }}>
{activity.type == 'comment_reply' ? 'Comment reply' : 'Comment'}
</Text>
<Text variant="bodySmall">{timesago(activity.timestamp)}</Text>
</View>
<Text variant="bodyMedium" style={{ color: colors.secondary }}>
{activity.text}
</Text>
</Card.Content>
);
} else if (activity.type == 'new_follower') {
return (
<Card.Content style={{ padding: 15 }}>
<View style={{ flexDirection: 'row', marginBottom: 5 }}>
<Icon source="account-plus" color={colors.primary} size={20}></Icon>
<Text
variant="labelLarge"
style={{ marginLeft: 5, color: colors.primary, flex: 1 }}>
New follower
</Text>
<Text variant="bodySmall">{timesago(activity.timestamp)}</Text>
</View>
<View style={{ flexDirection: 'row' }}>
{activity.conversation_icon ? (
<Avatar.Text
size={46}
label={String(activity.conversation_icon?.emoji || '‼️')}
color="white"
style={{
backgroundColor:
activity.conversation_icon?.color || colors.primary,
borderRadius: 10,
}}
/>
) : (
<Avatar.Text
size={46}
label={activity.username.length < 3 ? activity.username : '💬'}
style={{ borderRadius: 10 }}
/>
)}
<Text
variant="bodyMedium"
style={{ marginLeft: 10, color: colors.secondary }}>
{activity.text}
</Text>
</View>
</Card.Content>
);
}
};
return (
Expand Down

0 comments on commit d535a63

Please sign in to comment.