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).
316 lines
9.5 KiB
TypeScript
316 lines
9.5 KiB
TypeScript
import { useState } from 'react';
|
|
import { View, Text, ScrollView, Pressable, Image } from 'react-native';
|
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
import { useLocalSearchParams, useRouter } from 'expo-router';
|
|
import { Ionicons } from '@expo/vector-icons';
|
|
import { colors } from '../../lib/theme';
|
|
import { resolveAvatar } from '../../lib/resolveAvatar';
|
|
import type { Plan } from '../../hooks/useUserPlan';
|
|
|
|
const planLabel: Record<Plan, string> = {
|
|
free: 'Free',
|
|
pro: 'Pro',
|
|
legend: 'Legend',
|
|
};
|
|
|
|
const planColors: Record<Plan, { bg: string; text: string; border: string }> = {
|
|
free: { bg: '#f5f5f5', text: '#525252', border: '#e5e5e5' },
|
|
pro: { bg: '#fff7ed', text: '#c2410c', border: '#fed7aa' },
|
|
legend: { bg: '#fef9c3', text: '#854d0e', border: '#fde68a' },
|
|
};
|
|
|
|
// TODO: GET /api/social/profile/[userId] — extend response um approvedDomainsCount.
|
|
// Strikt anonym: nur nickname, avatar, plan, memberSince, postsCount, followersCount,
|
|
// approvedDomainsCount, isFollowing. NIEMALS email, demographics, cooldowns, sos-insights.
|
|
type ForeignProfile = {
|
|
id: string;
|
|
nickname: string;
|
|
avatar: string | null;
|
|
plan: Plan;
|
|
memberSince: string;
|
|
postsCount: number;
|
|
followersCount: number;
|
|
approvedDomainsCount: number;
|
|
isFollowing: boolean;
|
|
};
|
|
|
|
const DUMMY_FOREIGN: ForeignProfile = {
|
|
id: 'foreign-user-id',
|
|
nickname: 'Jonas_42',
|
|
avatar: 'wolf',
|
|
plan: 'pro',
|
|
memberSince: 'April 2026',
|
|
postsCount: 12,
|
|
followersCount: 47,
|
|
approvedDomainsCount: 8,
|
|
isFollowing: false,
|
|
};
|
|
|
|
type StatProps = {
|
|
value: string;
|
|
label: string;
|
|
};
|
|
|
|
function ForeignStat({ value, label }: StatProps) {
|
|
return (
|
|
<View
|
|
style={{
|
|
flex: 1,
|
|
backgroundColor: '#ffffff',
|
|
borderWidth: 1,
|
|
borderColor: '#e5e5e5',
|
|
borderRadius: 14,
|
|
paddingVertical: 14,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
}}
|
|
>
|
|
<Text style={{ fontSize: 22, color: colors.text, fontFamily: 'Nunito_700Bold' }}>
|
|
{value}
|
|
</Text>
|
|
<Text
|
|
style={{
|
|
marginTop: 2,
|
|
fontSize: 11,
|
|
color: colors.textMuted,
|
|
fontFamily: 'Nunito_600SemiBold',
|
|
}}
|
|
>
|
|
{label}
|
|
</Text>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
export default function ForeignProfileScreen() {
|
|
const insets = useSafeAreaInsets();
|
|
const router = useRouter();
|
|
const { userId } = useLocalSearchParams<{ userId: string }>();
|
|
const [imageFailed, setImageFailed] = useState(false);
|
|
const [isFollowing, setIsFollowing] = useState(DUMMY_FOREIGN.isFollowing);
|
|
|
|
// TODO: useQuery → apiFetch(`/api/social/profile/${userId}`)
|
|
const profile = DUMMY_FOREIGN;
|
|
void userId;
|
|
|
|
const avatarUrl = resolveAvatar(profile.avatar, profile.nickname);
|
|
const initials = profile.nickname.slice(0, 2).toUpperCase();
|
|
const showImage = !!profile.avatar && !imageFailed;
|
|
const planStyle = planColors[profile.plan];
|
|
|
|
return (
|
|
<View style={{ flex: 1, backgroundColor: '#ffffff' }}>
|
|
<View
|
|
style={{
|
|
paddingTop: insets.top,
|
|
backgroundColor: '#ffffff',
|
|
borderBottomWidth: 1,
|
|
borderBottomColor: '#e5e5e5',
|
|
}}
|
|
>
|
|
<View
|
|
style={{
|
|
height: 56,
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
paddingHorizontal: 12,
|
|
}}
|
|
>
|
|
<Pressable
|
|
onPress={() => router.back()}
|
|
hitSlop={8}
|
|
style={({ pressed }) => ({
|
|
opacity: pressed ? 0.5 : 1,
|
|
padding: 8,
|
|
})}
|
|
>
|
|
<Ionicons name="chevron-back" size={22} color={colors.text} />
|
|
</Pressable>
|
|
<Text style={{ fontSize: 15, color: colors.text, fontFamily: 'Nunito_600SemiBold' }}>
|
|
Profil
|
|
</Text>
|
|
<View style={{ width: 38 }} />
|
|
</View>
|
|
</View>
|
|
|
|
<ScrollView
|
|
style={{ flex: 1 }}
|
|
contentContainerStyle={{ paddingBottom: insets.bottom + 24 }}
|
|
showsVerticalScrollIndicator={false}
|
|
>
|
|
<View style={{ alignItems: 'center', paddingVertical: 24, paddingHorizontal: 20 }}>
|
|
<View
|
|
style={{
|
|
width: 96,
|
|
height: 96,
|
|
borderRadius: 48,
|
|
borderWidth: 2,
|
|
borderColor: planStyle.border,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
overflow: 'hidden',
|
|
backgroundColor: showImage ? '#fafafa' : colors.brandOrange,
|
|
}}
|
|
>
|
|
{showImage ? (
|
|
<Image
|
|
source={{ uri: avatarUrl }}
|
|
onError={() => setImageFailed(true)}
|
|
style={{ width: 92, height: 92, borderRadius: 46 }}
|
|
/>
|
|
) : (
|
|
<Text style={{ color: '#fff', fontSize: 32, fontFamily: 'Nunito_700Bold' }}>
|
|
{initials}
|
|
</Text>
|
|
)}
|
|
</View>
|
|
|
|
<Text
|
|
style={{
|
|
marginTop: 16,
|
|
fontSize: 22,
|
|
color: colors.text,
|
|
fontFamily: 'Nunito_700Bold',
|
|
}}
|
|
>
|
|
{profile.nickname}
|
|
</Text>
|
|
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 10, marginTop: 8 }}>
|
|
<View
|
|
style={{
|
|
paddingHorizontal: 10,
|
|
paddingVertical: 3,
|
|
borderRadius: 999,
|
|
backgroundColor: planStyle.bg,
|
|
borderWidth: 1,
|
|
borderColor: planStyle.border,
|
|
}}
|
|
>
|
|
<Text
|
|
style={{
|
|
fontSize: 11,
|
|
color: planStyle.text,
|
|
fontFamily: 'Nunito_700Bold',
|
|
letterSpacing: 0.4,
|
|
}}
|
|
>
|
|
{planLabel[profile.plan].toUpperCase()}
|
|
</Text>
|
|
</View>
|
|
<Text style={{ fontSize: 12, color: colors.textMuted, fontFamily: 'Nunito_400Regular' }}>
|
|
Mitglied seit {profile.memberSince}
|
|
</Text>
|
|
</View>
|
|
|
|
<View style={{ flexDirection: 'row', gap: 8, marginTop: 16, width: '100%' }}>
|
|
<Pressable
|
|
onPress={() => {
|
|
// TODO: POST /api/social/follow/[userId] resp. DELETE bei unfollow
|
|
setIsFollowing((v) => !v);
|
|
}}
|
|
style={({ pressed }) => ({
|
|
flex: 1,
|
|
opacity: pressed ? 0.7 : 1,
|
|
paddingVertical: 11,
|
|
borderRadius: 12,
|
|
backgroundColor: isFollowing ? '#f5f5f5' : colors.brandOrange,
|
|
borderWidth: 1,
|
|
borderColor: isFollowing ? '#e5e5e5' : colors.brandOrange,
|
|
alignItems: 'center',
|
|
})}
|
|
>
|
|
<Text
|
|
style={{
|
|
fontSize: 13,
|
|
color: isFollowing ? colors.text : '#ffffff',
|
|
fontFamily: 'Nunito_600SemiBold',
|
|
}}
|
|
>
|
|
{isFollowing ? 'Folge ich' : 'Folgen'}
|
|
</Text>
|
|
</Pressable>
|
|
<Pressable
|
|
onPress={() => {
|
|
// TODO: navigate to DM with this userId
|
|
router.push(`/dm`);
|
|
}}
|
|
style={({ pressed }) => ({
|
|
flex: 1,
|
|
opacity: pressed ? 0.7 : 1,
|
|
paddingVertical: 11,
|
|
borderRadius: 12,
|
|
backgroundColor: '#ffffff',
|
|
borderWidth: 1,
|
|
borderColor: '#e5e5e5',
|
|
alignItems: 'center',
|
|
})}
|
|
>
|
|
<Text
|
|
style={{
|
|
fontSize: 13,
|
|
color: colors.text,
|
|
fontFamily: 'Nunito_600SemiBold',
|
|
}}
|
|
>
|
|
Nachricht
|
|
</Text>
|
|
</Pressable>
|
|
</View>
|
|
</View>
|
|
|
|
<View
|
|
style={{
|
|
height: 1,
|
|
backgroundColor: 'rgba(0,0,0,0.06)',
|
|
marginHorizontal: 16,
|
|
}}
|
|
/>
|
|
|
|
<View style={{ flexDirection: 'row', gap: 8, marginTop: 16, paddingHorizontal: 16 }}>
|
|
<ForeignStat value={String(profile.postsCount)} label="Posts" />
|
|
<ForeignStat value={String(profile.followersCount)} label="Follower" />
|
|
<ForeignStat value={String(profile.approvedDomainsCount)} label="Approved" />
|
|
</View>
|
|
|
|
{/* TODO: GET /api/community/posts?userId=... — letzte 5 Posts */}
|
|
<View style={{ marginTop: 24, paddingHorizontal: 16 }}>
|
|
<Text
|
|
style={{
|
|
fontSize: 11,
|
|
color: colors.textMuted,
|
|
fontFamily: 'Nunito_700Bold',
|
|
letterSpacing: 0.8,
|
|
marginBottom: 8,
|
|
}}
|
|
>
|
|
LETZTE POSTS
|
|
</Text>
|
|
<View
|
|
style={{
|
|
backgroundColor: '#ffffff',
|
|
borderWidth: 1,
|
|
borderColor: '#e5e5e5',
|
|
borderRadius: 14,
|
|
padding: 16,
|
|
alignItems: 'center',
|
|
}}
|
|
>
|
|
<Text
|
|
style={{
|
|
fontSize: 12,
|
|
color: colors.textMuted,
|
|
fontFamily: 'Nunito_400Regular',
|
|
textAlign: 'center',
|
|
}}
|
|
>
|
|
Posts-Liste folgt in Phase C
|
|
</Text>
|
|
</View>
|
|
</View>
|
|
</ScrollView>
|
|
</View>
|
|
);
|
|
}
|