chahinebrini 3c52d8869e feat(native): WIP checkpoint — Profile/Settings/Demographics + WheelPicker + Maestro
Rollback-Punkt vor Expo SDK 54 / RN 0.81 Upgrade.

UI/UX:
- Profile: ProfileHeader redesign (sign-in chip + member-since), StatsBar 3 pill cards,
  Demographics accordion completed (Geburtsjahr, Geschlecht, Familienstand, Beruf-split,
  Wohnort), Pro-Trial-Banner, Approved-Domains list, DigaMissionBanner
- Settings: section-based layout, neutral icons (matched Header dropdown style)
- Header dropdown: extended with logout + games-page link
- Notifications page: skeleton dummy data
- Locales: i18n keys for new screens

New components:
- WheelPickerModal: native iOS UIPickerView wheel for long lists (Geburtsjahr 91 items,
  Bundesland 16, Stadt 30+/Bundesland)
- OptionsBottomSheet: iOS-style options sheet (used briefly for Geschlecht, currently
  unused — kept for potential future use)
- germanCities.ts: Top-cities per Bundesland (DSGVO-clean static data)

New libs (NewArch-codegen verified):
- @react-native-menu/menu 2.0.0 (UIMenu wrapper, Apple HIG-konform)
- @lodev09/react-native-true-sheet 3.10.1 (UISheetPresentationController wrapper —
  ABER incompatible mit RN 0.79.6, Build-Error → Trigger für SDK-54-Upgrade)

Maestro E2E:
- Initial setup mit auth/community/profile/urge flows

Scripts:
- build-ios-clean.sh: Xcode DerivedData + ios/build cleanup vor expo run:ios

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 19:32:27 +02:00

154 lines
4.8 KiB
TypeScript

import { useEffect } from 'react';
import { View, Text, FlatList, Pressable, 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 { colors } from '../../lib/theme';
export default function NotificationsScreen() {
const router = useRouter();
const { t } = useTranslation();
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 (
<SafeAreaView className="flex-1 bg-white" edges={['top']}>
<View className="flex-row items-center gap-3 px-5 pt-3 pb-3 border-b border-neutral-200">
<Pressable
onPress={() => router.back()}
className="w-9 h-9 rounded-full bg-neutral-100 border border-neutral-200 items-center justify-center"
>
<Ionicons name="arrow-back" size={18} color="#737373" />
</Pressable>
<Text
className="text-neutral-900 text-lg flex-1"
style={{ fontFamily: 'Nunito_700Bold' }}
>
{t('notifications.title')}
</Text>
</View>
{items.length === 0 ? (
<EmptyState
icon="notifications-off-outline"
title={t('notifications.empty_title')}
subtitle={t('notifications.empty_subtitle')}
/>
) : (
<FlatList
data={items}
keyExtractor={(n) => n.id}
contentContainerStyle={{ paddingVertical: 8 }}
refreshControl={
<RefreshControl
refreshing={!loaded}
onRefresh={load}
tintColor={colors.brandOrange}
/>
}
renderItem={({ item }) => (
<NotificationRow
notif={item}
onPress={() => {
if (item.postId) {
router.push(`/?postId=${item.postId}` as never);
}
}}
onDelete={() => remove(item.id)}
/>
)}
/>
)}
</SafeAreaView>
);
}
function NotificationRow({
notif,
onPress,
onDelete,
}: {
notif: AppNotification;
onPress: () => void;
onDelete: () => void;
}) {
const isUnread = !notif.readAt;
return (
<Pressable
onPress={onPress}
style={({ pressed }) => ({
opacity: pressed ? 0.7 : 1,
})}
>
<View
style={{
flexDirection: 'row',
alignItems: 'flex-start',
paddingHorizontal: 16,
paddingVertical: 12,
borderBottomWidth: 1,
borderBottomColor: '#f5f5f5',
backgroundColor: isUnread ? '#fff7ed' : '#fff',
}}
>
{/* Pure-Icon — KEIN bg-Circle (User-Wunsch: kein extra Rand). */}
<View style={{ width: 36, alignItems: 'center', justifyContent: 'center', marginRight: 12 }}>
{notif.type === 'domain_accepted' ? (
<HeroShieldCheck size={22} color="#16a34a" />
) : (
<Ionicons name={iconForType(notif.type)} size={22} color="#d97706" />
)}
</View>
<View style={{ flex: 1, minWidth: 0, marginRight: 8 }}>
<Text
style={{ fontSize: 13, fontFamily: 'Nunito_700Bold', color: '#0a0a0a' }}
numberOfLines={1}
>
{notif.actorName}
</Text>
{notif.preview && (
<Text
style={{
fontSize: 12,
fontFamily: 'Nunito_400Regular',
color: '#525252',
marginTop: 2,
}}
numberOfLines={2}
>
{notif.preview}
</Text>
)}
</View>
<Pressable onPress={onDelete} hitSlop={8}>
<Ionicons name="close" size={16} color="#a3a3a3" />
</Pressable>
</View>
</Pressable>
);
}
function iconForType(type: string): React.ComponentProps<typeof Ionicons>['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';
}