correct issues
This commit is contained in:
@@ -44,22 +44,20 @@ const Notification = () => {
|
||||
dispatch(clearAllNotifications());
|
||||
};
|
||||
|
||||
const handleMarkAsRead = (messageId: string, screen: string) => {
|
||||
const handleMarkAsRead = (messageId: string, screen: string, groupId: string, cycleNumber: string, contributionId: string) => {
|
||||
console.log("screen type : ", screen);
|
||||
handleMarkAsReadAndNavigate(
|
||||
messageId,
|
||||
screen,
|
||||
{
|
||||
// Pass additional parameters based on notification type
|
||||
groupId: 'ebc27862-acde-4129-b12c-fd4c2966e858',
|
||||
cycleNumber: '1',
|
||||
contributionId: '12345',
|
||||
actionTab3: 'Your Requests' ,
|
||||
groupId: groupId,
|
||||
cycleNumber,
|
||||
contributionId,
|
||||
actionTab3: 'Your Requests',
|
||||
actionTab1: 'Joined Groups',
|
||||
GroupDetails: {
|
||||
item: {}
|
||||
},
|
||||
// etc.
|
||||
}
|
||||
);
|
||||
};
|
||||
@@ -240,74 +238,77 @@ const Notification = () => {
|
||||
keyExtractor={(item) => item.messageId}
|
||||
showsVerticalScrollIndicator={false}
|
||||
contentContainerStyle={styles.listContainer}
|
||||
renderItem={({ item }) => (
|
||||
<TouchableOpacity
|
||||
onPress={() => handleMarkAsRead(item.messageId, item?.data?.msgType)}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
<LinearGradient
|
||||
colors={item.read ? ['#f8f9fa', '#e9ecef'] : ['#ffffff', '#f8f9fa']}
|
||||
style={[
|
||||
styles.notificationCard,
|
||||
!item.read && styles.unreadNotification, { borderLeftColor: getNotificationColor(item.data.msgType) }
|
||||
]}>
|
||||
<View style={styles.notificationContent}>
|
||||
{/* Icon */}
|
||||
<View style={styles.iconContainer}>
|
||||
<Ionicons
|
||||
name={getNotificationIcon(item.data.msgType)}
|
||||
size={24}
|
||||
color={getNotificationColor(item.data.msgType)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
{/* Content */}
|
||||
<View style={styles.textContent}>
|
||||
<View style={styles.headerRow}>
|
||||
<Text style={[
|
||||
styles.title,
|
||||
!item.read && styles.unreadTitle
|
||||
]}>
|
||||
{item.data.title}
|
||||
</Text>
|
||||
<Text style={styles.time}>
|
||||
{formatTime(item.sentTime)}
|
||||
</Text>
|
||||
renderItem={({ item }) => {
|
||||
console.log("noti items : ", item)
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={() => handleMarkAsRead(item.messageId, item?.data?.msgType, item?.data?.groupId, item?.data?.cycleNumber, item?.data?.contributionId)}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
<LinearGradient
|
||||
colors={item.read ? ['#f8f9fa', '#e9ecef'] : ['#ffffff', '#f8f9fa']}
|
||||
style={[
|
||||
styles.notificationCard,
|
||||
!item.read && styles.unreadNotification, { borderLeftColor: getNotificationColor(item.data.msgType) }
|
||||
]}>
|
||||
<View style={styles.notificationContent}>
|
||||
{/* Icon */}
|
||||
<View style={styles.iconContainer}>
|
||||
<Ionicons
|
||||
name={getNotificationIcon(item.data.msgType)}
|
||||
size={24}
|
||||
color={getNotificationColor(item.data.msgType)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<Text style={styles.message}>
|
||||
{item.data.body}
|
||||
</Text>
|
||||
|
||||
{item.data.msgType && (
|
||||
<View style={styles.tagContainer}>
|
||||
{/* Content */}
|
||||
<View style={styles.textContent}>
|
||||
<View style={styles.headerRow}>
|
||||
<Text style={[
|
||||
styles.tag,
|
||||
{ backgroundColor: getNotificationColor(item.data.msgType) }
|
||||
styles.title,
|
||||
!item.read && styles.unreadTitle
|
||||
]}>
|
||||
{/* {item.data.msgType} */}
|
||||
{getFilterDisplayName(item.data.msgType as FilterType)}
|
||||
{item.data.title}
|
||||
</Text>
|
||||
<Text style={styles.time}>
|
||||
{formatTime(item.sentTime)}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Actions */}
|
||||
<View style={styles.actionsContainer}>
|
||||
{!item.read && (
|
||||
<View style={styles.unreadIndicator} />
|
||||
)}
|
||||
<TouchableOpacity
|
||||
onPress={() => handleDelete(item.messageId)}
|
||||
style={styles.deleteButton}
|
||||
>
|
||||
<Ionicons name="trash-outline" size={20} color="#e63946" />
|
||||
</TouchableOpacity>
|
||||
<Text style={styles.message}>
|
||||
{item.data.body}
|
||||
</Text>
|
||||
|
||||
{item.data.msgType && (
|
||||
<View style={styles.tagContainer}>
|
||||
<Text style={[
|
||||
styles.tag,
|
||||
{ backgroundColor: getNotificationColor(item.data.msgType) }
|
||||
]}>
|
||||
{/* {item.data.msgType} */}
|
||||
{getFilterDisplayName(item.data.msgType as FilterType)}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
{/* Actions */}
|
||||
<View style={styles.actionsContainer}>
|
||||
{!item.read && (
|
||||
<View style={styles.unreadIndicator} />
|
||||
)}
|
||||
<TouchableOpacity
|
||||
onPress={() => handleDelete(item.messageId)}
|
||||
style={styles.deleteButton}
|
||||
>
|
||||
<Ionicons name="trash-outline" size={20} color="#e63946" />
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</LinearGradient>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</LinearGradient>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
}}
|
||||
ListEmptyComponent={
|
||||
<View style={styles.emptyContainer}>
|
||||
<Ionicons name="notifications-off-outline" size={64} color="#ccc" />
|
||||
|
||||
Reference in New Issue
Block a user