import { useEffect } from 'react'; import { View, Text, FlatList, TouchableOpacity, RefreshControl } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { useRouter } from 'expo-router'; import { Ionicons } from '@expo/vector-icons'; import { HeroShieldCheck } from '../../components/HeroShieldCheck'; import { useTranslation } from 'react-i18next'; import { EmptyState } from '../../components/EmptyState'; import { useNotificationStore, type AppNotification } from '../../stores/notifications'; import { useColors } from '../../lib/theme'; export default function NotificationsScreen() { const router = useRouter(); const { t } = useTranslation(); const colors = useColors(); const items = useNotificationStore((s) => s.items); const loaded = useNotificationStore((s) => s.loaded); const load = useNotificationStore((s) => s.load); const markRead = useNotificationStore((s) => s.markRead); const remove = useNotificationStore((s) => s.remove); useEffect(() => { load(); const tm = setTimeout(() => { markRead(); }, 400); return () => clearTimeout(tm); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return ( router.back()} activeOpacity={0.7} style={{ width: 36, height: 36, borderRadius: 18, backgroundColor: colors.surfaceElevated, borderWidth: 1, borderColor: colors.border, alignItems: 'center', justifyContent: 'center' }} > {t('notifications.title')} {items.length === 0 ? ( ) : ( n.id} contentContainerStyle={{ paddingVertical: 8 }} refreshControl={ } renderItem={({ item }) => ( { if (item.postId) { router.push(`/?postId=${item.postId}` as never); } }} onDelete={() => remove(item.id)} /> )} /> )} ); } function NotificationRow({ notif, onPress, onDelete, }: { notif: AppNotification; onPress: () => void; onDelete: () => void; }) { const colors = useColors(); const isUnread = !notif.readAt; return ( {/* Pure-Icon — KEIN bg-Circle (User-Wunsch: kein extra Rand). */} {notif.type === 'domain_accepted' ? ( ) : ( )} {notif.actorName} {notif.preview && ( {notif.preview} )} ); } function iconForType(type: string): React.ComponentProps['name'] { if (type.includes('like')) return 'heart'; if (type.includes('comment')) return 'chatbubble'; if (type.includes('follow')) return 'person-add'; if (type.includes('domain')) return 'shield-checkmark'; return 'notifications'; }