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

210 lines
6.0 KiB
TypeScript

import { View, Text } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { colors } from '../../lib/theme';
export type HelpedByEntry = {
key: 'breathing' | 'game' | 'talk' | 'other';
label: string;
count: number;
};
type Props = {
sessions: number;
overcome: number;
helpedBy: HelpedByEntry[];
topEmotion: string | null;
};
export function UrgeStatsCard({ sessions, overcome, helpedBy, topEmotion }: Props) {
const overcomePct = sessions > 0 ? Math.round((overcome / sessions) * 100) : 0;
const totalHelped = helpedBy.reduce((sum, h) => sum + h.count, 0);
return (
<View style={{ marginHorizontal: 16, marginTop: 24 }}>
<View
style={{
flexDirection: 'row',
alignItems: 'center',
gap: 8,
marginBottom: 10,
}}
>
<Ionicons name="sparkles-outline" size={14} color={colors.textMuted} />
<Text
style={{
fontSize: 11,
color: colors.textMuted,
fontFamily: 'Nunito_700Bold',
letterSpacing: 0.8,
}}
>
LYRA INSIGHTS
</Text>
</View>
<View
style={{
backgroundColor: '#ffffff',
borderWidth: 1,
borderColor: '#e5e5e5',
borderRadius: 14,
padding: 16,
}}
>
<Text
style={{
fontSize: 12,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
Letzte 30 Tage
</Text>
{sessions === 0 ? (
<Text
style={{
marginTop: 8,
fontSize: 13,
color: colors.text,
fontFamily: 'Nunito_600SemiBold',
}}
>
Noch keine SOS-Session. Lyra ist da, wenn du sie brauchst.
</Text>
) : (
<>
<View style={{ marginTop: 6, flexDirection: 'row', alignItems: 'baseline', gap: 6 }}>
<Text
style={{
fontSize: 22,
color: colors.text,
fontFamily: 'Nunito_700Bold',
}}
>
{sessions}
</Text>
<Text
style={{
fontSize: 13,
color: colors.text,
fontFamily: 'Nunito_600SemiBold',
}}
>
SOS-Sessions, {overcome} bewältigt
</Text>
</View>
<View
style={{
marginTop: 8,
height: 6,
backgroundColor: '#f5f5f5',
borderRadius: 999,
overflow: 'hidden',
}}
>
<View
style={{
height: '100%',
width: `${overcomePct}%`,
backgroundColor: colors.success,
borderRadius: 999,
}}
/>
</View>
<Text
style={{
marginTop: 4,
fontSize: 11,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
{overcomePct}% bewältigt
</Text>
{totalHelped > 0 ? (
<View style={{ marginTop: 16 }}>
<Text
style={{
fontSize: 12,
color: colors.text,
fontFamily: 'Nunito_600SemiBold',
marginBottom: 8,
}}
>
Was hat geholfen
</Text>
{helpedBy.map((h) => {
const pct = totalHelped > 0 ? (h.count / totalHelped) * 100 : 0;
return (
<View key={h.key} style={{ marginBottom: 8 }}>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
marginBottom: 3,
}}
>
<Text
style={{
fontSize: 12,
color: colors.text,
fontFamily: 'Nunito_600SemiBold',
}}
>
{h.label}
</Text>
<Text
style={{
fontSize: 11,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
{h.count} {h.count === 1 ? 'Session' : 'Sessions'}
</Text>
</View>
<View
style={{
height: 4,
backgroundColor: '#f5f5f5',
borderRadius: 999,
overflow: 'hidden',
}}
>
<View
style={{
height: '100%',
width: `${pct}%`,
backgroundColor: colors.brandOrange,
borderRadius: 999,
}}
/>
</View>
</View>
);
})}
</View>
) : null}
{topEmotion ? (
<Text
style={{
marginTop: 8,
fontSize: 12,
color: colors.textMuted,
fontFamily: 'Nunito_400Regular',
}}
>
Häufigste Emotion: {topEmotion}
</Text>
) : null}
</>
)}
</View>
</View>
);
}