Theme-switch in Settings (System/Light/Dark) jetzt App-weit wirksam für die
Core-Screens. Wave 2 dokumentiert (siehe unten).
Color-System:
- lib/theme.ts: refactored zu colors.light + colors.dark (gleiche keys)
Light: bg #fff, surface #fafafa, surfaceElevated #f5f5f5, border #e5e5e5,
text #0a0a0a, textMuted #737373
Dark: bg #000, surface #1c1c1e, surfaceElevated #2c2c2e, border #38383a,
text #fff, textMuted #8e8e93
brandOrange unverändert #007AFF (iOS system blue)
success/error variieren (light: #16a34a/#dc2626, dark: #30d158/#ff453a)
- legacy `colors` export bleibt als Light-Fallback für nicht-migrierte Files
- new `useColors()` hook → liest aktiven scheme aus useThemeStore
stores/theme.ts:
- Appearance.addChangeListener für live System-Theme-Updates (User schaltet
iOS Dark/Light → App reagiert sofort ohne Reload)
Wave 1 — migrated Files (Core Screens):
- app/_layout.tsx + app/(app)/_layout.tsx + app/(app)/index.tsx (root + home)
- app/settings.tsx (full theme-aware inkl. TrueSheet)
- app/profile/index.tsx (bg + dividers)
- app/devices.tsx (bg, surface, border, icons)
- app/lyra.tsx (chat container, backdrop, bubbles, ThinkingDots, LoadingPulse)
- components/AppHeader (Nativewind classes ersetzt durch theme-aware Styles)
- components/header/HeaderDropdownMenu
- components/profile/* (ProfileHeader, StatsBar, StreakSection, UrgeStatsCard,
ApprovedDomainsList, DemographicsAccordion)
Wave 2 (TODOs für separate Session):
- app/urge.tsx (~20 hardcoded colors, größter Screen)
- app/room.tsx, app/dm.tsx, app/(app)/chat.tsx, app/(app)/mail.tsx, app/(app)/coach.tsx
- app/games.tsx, app/profile/[userId].tsx
- Nativewind classes in PostCard, ComposeCard, PostCardSkeleton, NotificationsDropdown
StatusBar style dynamisch synchronisiert (light bei dark-mode, dark bei light).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
211 lines
6.1 KiB
TypeScript
211 lines
6.1 KiB
TypeScript
import { View, Text } from 'react-native';
|
|
import { Ionicons } from '@expo/vector-icons';
|
|
import { useColors } 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 colors = useColors();
|
|
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: colors.surface,
|
|
borderWidth: 1,
|
|
borderColor: colors.border,
|
|
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: colors.surfaceElevated,
|
|
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: colors.surfaceElevated,
|
|
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>
|
|
);
|
|
}
|