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>
136 lines
3.8 KiB
TypeScript
136 lines
3.8 KiB
TypeScript
import { useState } from 'react';
|
|
import { View, Text, Pressable, LayoutAnimation, Platform, UIManager } from 'react-native';
|
|
import { Ionicons } from '@expo/vector-icons';
|
|
import { useColors } from '../../lib/theme';
|
|
|
|
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
}
|
|
|
|
export type ApprovedDomain = {
|
|
domain: string;
|
|
approvedAt: string;
|
|
};
|
|
|
|
type Props = {
|
|
domains: ApprovedDomain[];
|
|
loading?: boolean;
|
|
};
|
|
|
|
export function ApprovedDomainsList({ domains, loading }: Props) {
|
|
const colors = useColors();
|
|
const [expanded, setExpanded] = useState(false);
|
|
|
|
function toggle() {
|
|
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
setExpanded((v) => !v);
|
|
}
|
|
|
|
return (
|
|
<View style={{ marginHorizontal: 16, marginTop: 12 }}>
|
|
<Pressable
|
|
onPress={toggle}
|
|
style={({ pressed }) => ({ opacity: pressed ? 0.7 : 1 })}
|
|
>
|
|
<View
|
|
style={{
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
backgroundColor: colors.surface,
|
|
borderWidth: 1,
|
|
borderColor: colors.border,
|
|
borderRadius: 14,
|
|
padding: 16,
|
|
}}
|
|
>
|
|
<View style={{ flex: 1 }}>
|
|
<Text style={{ fontSize: 13, color: colors.text, fontFamily: 'Nunito_600SemiBold' }}>
|
|
Approved Domains{' '}
|
|
<Text style={{ color: colors.textMuted, fontFamily: 'Nunito_400Regular' }}>
|
|
({domains.length})
|
|
</Text>
|
|
</Text>
|
|
</View>
|
|
<Ionicons
|
|
name={expanded ? 'chevron-up' : 'chevron-down'}
|
|
size={18}
|
|
color={colors.textMuted}
|
|
/>
|
|
</View>
|
|
</Pressable>
|
|
|
|
{expanded ? (
|
|
<View
|
|
style={{
|
|
marginTop: 6,
|
|
backgroundColor: colors.surface,
|
|
borderWidth: 1,
|
|
borderColor: colors.border,
|
|
borderRadius: 12,
|
|
paddingVertical: 4,
|
|
}}
|
|
>
|
|
{loading ? (
|
|
<View style={{ padding: 16 }}>
|
|
<SkeletonRow />
|
|
<SkeletonRow />
|
|
<SkeletonRow />
|
|
</View>
|
|
) : domains.length === 0 ? (
|
|
<Text
|
|
style={{
|
|
paddingVertical: 16,
|
|
paddingHorizontal: 14,
|
|
fontSize: 12,
|
|
color: colors.textMuted,
|
|
fontFamily: 'Nunito_400Regular',
|
|
}}
|
|
>
|
|
Noch keine approved Domains. Submit deine erste in der Community.
|
|
</Text>
|
|
) : (
|
|
domains.map((d, idx) => (
|
|
<View
|
|
key={d.domain}
|
|
style={{
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
justifyContent: 'space-between',
|
|
paddingVertical: 10,
|
|
paddingHorizontal: 14,
|
|
borderTopWidth: idx === 0 ? 0 : 1,
|
|
borderTopColor: colors.border,
|
|
}}
|
|
>
|
|
<Text style={{ fontSize: 13, color: colors.text, fontFamily: 'Nunito_600SemiBold' }}>
|
|
{d.domain}
|
|
</Text>
|
|
<Text
|
|
style={{ fontSize: 11, color: colors.textMuted, fontFamily: 'Nunito_400Regular' }}
|
|
>
|
|
{d.approvedAt}
|
|
</Text>
|
|
</View>
|
|
))
|
|
)}
|
|
</View>
|
|
) : null}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function SkeletonRow() {
|
|
const colors = useColors();
|
|
return (
|
|
<View
|
|
style={{
|
|
height: 14,
|
|
backgroundColor: colors.surfaceElevated,
|
|
borderRadius: 4,
|
|
marginVertical: 6,
|
|
}}
|
|
/>
|
|
);
|
|
}
|