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).
107 lines
2.4 KiB
TypeScript
107 lines
2.4 KiB
TypeScript
// RN-Port von apps/rebreak/app/components/StarRating.vue
|
|
// Unterstützt fractional values (z.B. 3.7) via width-clipping.
|
|
import { View, Pressable } from 'react-native';
|
|
import { Ionicons } from '@expo/vector-icons';
|
|
import { useState } from 'react';
|
|
|
|
export type StarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
|
|
const sizeMap: Record<StarSize, number> = {
|
|
xs: 14,
|
|
sm: 18,
|
|
md: 20,
|
|
lg: 28,
|
|
xl: 40,
|
|
};
|
|
|
|
export interface StarRatingProps {
|
|
value?: number;
|
|
max?: number;
|
|
size?: StarSize;
|
|
interactive?: boolean;
|
|
filledColor?: string;
|
|
emptyColor?: string;
|
|
onChange?: (value: number) => void;
|
|
}
|
|
|
|
export function StarRating({
|
|
value = 0,
|
|
max = 5,
|
|
size = 'md',
|
|
interactive = false,
|
|
filledColor = '#facc15',
|
|
emptyColor = '#e5e7eb',
|
|
onChange,
|
|
}: StarRatingProps) {
|
|
const [hover, setHover] = useState(0);
|
|
const px = sizeMap[size];
|
|
const display = interactive ? hover || value : value;
|
|
|
|
const stars = [];
|
|
for (let i = 1; i <= max; i++) {
|
|
const filledRatio = Math.min(Math.max(display - (i - 1), 0), 1);
|
|
const filledWidth = filledRatio * px;
|
|
|
|
const star = (
|
|
<View
|
|
key={`star-${i}`}
|
|
style={{
|
|
width: px,
|
|
height: px,
|
|
position: 'relative',
|
|
}}
|
|
>
|
|
{/* Empty star (background) */}
|
|
<Ionicons
|
|
name="star"
|
|
size={px}
|
|
color={emptyColor}
|
|
style={{ position: 'absolute', top: 0, left: 0 }}
|
|
/>
|
|
{/* Filled star clipped to filledWidth */}
|
|
{filledRatio > 0 ? (
|
|
<View
|
|
style={{
|
|
position: 'absolute',
|
|
top: 0,
|
|
left: 0,
|
|
width: filledWidth,
|
|
height: px,
|
|
overflow: 'hidden',
|
|
}}
|
|
>
|
|
<Ionicons
|
|
name="star"
|
|
size={px}
|
|
color={filledColor}
|
|
style={{ position: 'absolute', top: 0, left: 0 }}
|
|
/>
|
|
</View>
|
|
) : null}
|
|
</View>
|
|
);
|
|
|
|
if (interactive) {
|
|
stars.push(
|
|
<Pressable
|
|
key={`press-${i}`}
|
|
onPress={() => onChange?.(i)}
|
|
onHoverIn={() => setHover(i)}
|
|
onHoverOut={() => setHover(0)}
|
|
hitSlop={4}
|
|
>
|
|
{star}
|
|
</Pressable>
|
|
);
|
|
} else {
|
|
stars.push(star);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 2 }}>
|
|
{stars}
|
|
</View>
|
|
);
|
|
}
|