chahinebrini e76be7ee78 feat(profile): Profile-Page komplett + Header-Dropdown + UI-Pattern-Fixes
Profile (3 Iterationen):
- app/profile/index.tsx + components/profile/* (Header, StatsBar, Approved,
  Streak, UrgeStats, Demographics, DigaMissionBanner)
- echte Live-Daten via useMe-Hook (Avatar/Nickname/Plan/Email/Provider-Pill)
- Demographics mit echten Inputs (TextInput + Bottom-Sheet-Selects),
  debounced auto-save, Pro-Trial-Reward-Banner, Mikro-Why-Texte
- Approved Domains als plain integer (KEIN Plan-Slot/Cap)
- Friendly Hint-Text statt Progress-Bar (alignSelf:'stretch' Pattern)
- StatsBar zentriert mit 3 prominenten Cards (vertikale Dividers)
- Cooldown-Timeline als Liste mit 1px-Rail
- ApprovedDomainsList: Collapse-Chevron rechts in Title-Row (Pattern-Fix)
- Eigene vs fremde Profile-Ansicht streng getrennt (DSGVO/Anonymität)

Header-Dropdown (kein 3-Punkte-Icon):
- Avatar als Trigger im AppHeader (User-Wunsch)
- Custom-Modal beide Plattformen, Card-Style
- SOS prominent oben (nur Wort 'SOS' rot, Tagline 'wir sind für dich da' klein darunter)
- Profile/Settings/Games/Debug(__DEV__)/Logout
- Logout neutral (nicht rot — Recovery-tonal)
- AppHeader: neue showBack + title Props für Sub-Routes

Routes (Stub bis Phase C):
- app/profile/[userId].tsx — anonym (nur public-Stats)
- app/settings.tsx — Coming-Soon-Skeleton
- app/games.tsx — Standalone Games-Page mit GameCard-Grid
- app/debug.tsx — __DEV__-only

Game-Picker (Migration aus Nuxt):
- components/games/{GameCard, StarRating, GameRatingStars}
- 2x2 Grid, 56pt SVG-Icons (inline aus components/urge/gameSvgs.ts)
- Live-Backend /api/games/ratings (silent-fail)
- Re-use UrgeGames.tsx ohne TTS/Cooldown-Loop

UI-Pattern-Fixes (alle aus screenshot-User-Feedback 2026-05-07):
- Snake-Bug (food-pellet React-18-StrictMode-Reducer-double-call) gefixt
- Snake-Buttons platform-native (iOS-blue / Android-ripple)
- Tetris-Margins (16px paddingHorizontal)
- PostCard-Buttons Apple-44pt-Hit-Area (Image-Select, Image-Remove,
  Cancel, Share-Pill — via hitSlop)
- ProfileHeader Demographics-Hint: alignSelf:'stretch' Pattern
- ApprovedDomainsList Collapse: Title flex:1 + Chevron rechts
- ProtectionDetailsSheet FAQ-Items: alignSelf:'stretch' defensive
- AppHeader Back-Button: neue showBack-Prop + chevron-back

Memory + Plan-Docs:
- 17 Memory-Files dokumentieren System-Wissen + Patterns
- ops/{CUTOVER, UI_MIGRATION, PROFILE_PAGE, WEBHOOK, GAMES_1V1,
  RELEASE_READINESS, TESTING_STATE, MAESTRO_HOSTING}_*.md

Backend bleibt unverändert (Tier-LLM + Nickname + sort:latency
sind seit gestern deployed).
2026-05-07 18:22:58 +02:00

233 lines
6.9 KiB
TypeScript

import { View, Text } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { colors } from '../../lib/theme';
export type CooldownEntry = {
id: string;
startedAt: string;
durationLabel: string;
status: 'active' | 'resolved' | 'cancelled';
reason: string | null;
};
type Props = {
currentDays: number;
longestDays: number;
startDate: string;
cooldowns: CooldownEntry[];
};
const statusLabel: Record<CooldownEntry['status'], string> = {
active: 'aktiv',
resolved: 'beendet',
cancelled: 'abgebrochen',
};
const statusColor: Record<CooldownEntry['status'], { bg: string; text: string }> = {
active: { bg: '#fff7ed', text: '#c2410c' },
resolved: { bg: '#f0fdf4', text: '#15803d' },
cancelled: { bg: '#f5f5f5', text: '#737373' },
};
export function StreakSection({ currentDays, longestDays, startDate, cooldowns }: Props) {
return (
<View style={{ marginHorizontal: 16, marginTop: 24 }}>
<View
style={{
flexDirection: 'row',
alignItems: 'center',
gap: 8,
marginBottom: 10,
}}
>
<Ionicons name="flame-outline" size={14} color={colors.textMuted} />
<Text
style={{
fontSize: 11,
color: colors.textMuted,
fontFamily: 'Nunito_700Bold',
letterSpacing: 0.8,
}}
>
STREAK
</Text>
</View>
<View
style={{
backgroundColor: '#ffffff',
borderWidth: 1,
borderColor: '#e5e5e5',
borderRadius: 14,
padding: 16,
}}
>
<View style={{ flexDirection: 'row', alignItems: 'baseline', gap: 8 }}>
<Text
style={{
fontSize: 36,
color: colors.text,
fontFamily: 'Nunito_800ExtraBold',
}}
>
{currentDays}
</Text>
<Text
style={{
fontSize: 14,
color: colors.text,
fontFamily: 'Nunito_600SemiBold',
}}
>
Tage geschützt
</Text>
</View>
<Text
style={{
marginTop: 2,
fontSize: 12,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
seit {startDate}
</Text>
<Text
style={{
marginTop: 8,
fontSize: 12,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
Längste Streak: {longestDays} Tage
</Text>
</View>
{cooldowns.length > 0 ? (
<View style={{ marginTop: 16 }}>
<Text
style={{
fontSize: 11,
color: colors.textMuted,
fontFamily: 'Nunito_700Bold',
letterSpacing: 0.8,
marginBottom: 8,
paddingHorizontal: 2,
}}
>
COOLDOWN-VERLAUF
</Text>
<View
style={{
backgroundColor: '#ffffff',
borderWidth: 1,
borderColor: '#e5e5e5',
borderRadius: 14,
padding: 14,
}}
>
{cooldowns.map((c, idx) => {
const isLast = idx === cooldowns.length - 1;
const colorPair = statusColor[c.status];
return (
<View key={c.id} style={{ flexDirection: 'row' }}>
<View style={{ width: 16, alignItems: 'center' }}>
<View
style={{
width: 8,
height: 8,
borderRadius: 4,
backgroundColor:
c.status === 'active'
? colors.brandOrange
: c.status === 'resolved'
? '#15803d'
: '#a3a3a3',
marginTop: 4,
}}
/>
{!isLast ? (
<View
style={{
width: 1,
flex: 1,
backgroundColor: 'rgba(0,0,0,0.06)',
marginTop: 2,
}}
/>
) : null}
</View>
<View style={{ flex: 1, paddingLeft: 12, paddingBottom: isLast ? 0 : 14 }}>
<View
style={{
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
}}
>
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 8 }}>
<Text
style={{
fontSize: 13,
color: colors.text,
fontFamily: 'Nunito_600SemiBold',
}}
>
{c.startedAt}
</Text>
<Text
style={{
fontSize: 12,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
{c.durationLabel}
</Text>
</View>
<View
style={{
paddingHorizontal: 8,
paddingVertical: 2,
borderRadius: 999,
backgroundColor: colorPair.bg,
}}
>
<Text
style={{
fontSize: 10,
color: colorPair.text,
fontFamily: 'Nunito_700Bold',
letterSpacing: 0.4,
}}
>
{statusLabel[c.status].toUpperCase()}
</Text>
</View>
</View>
{c.reason ? (
<Text
style={{
marginTop: 2,
fontSize: 12,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
{c.reason}
</Text>
) : null}
</View>
</View>
);
})}
</View>
</View>
) : null}
</View>
);
}