Wave 2 = ALLE app-files die in Wave 1 noch hardcoded waren. Komplette App-weit
theme-aware-Migration jetzt durch. Legacy `import { colors }` flat export
vollständig eliminiert.
Migrated this wave:
Top-level Screens:
- app/urge.tsx (makeStyles factory mit ~20 colors)
- app/room.tsx + dm.tsx + games.tsx
- app/(app)/chat.tsx + mail.tsx + coach.tsx + notifications.tsx
- app/profile/[userId].tsx + profile/edit.tsx (INPUT_STYLE in body moved)
- app/debug.tsx + auth/callback.tsx
Blocker (7):
- AddDomainSheet, CooldownBanner, DeactivationExplainerSheet, DomainGrid,
ProtectionCard, ProtectionDetailsSheet, ProtectionLockedCard
Mail (3):
- ConnectMailSheet, EditMailAccountSheet, MailEmptyState
Chat (1):
- ChatBubble, ChatInput
Community/Posts/Notifications:
- PostCard, PostCardSkeleton, ComposeCard, PostCommentsSheet
- NotificationsDropdown
- StreakBadge (Nativewind classes durch inline dynamic styles ersetzt)
Reusable Sheets:
- WheelPickerModal, OptionsBottomSheet, DeviceLimitReachedSheet
Urge subsystem (5):
- InlineRatingDrawer, ShareSuccessDrawer, UrgeStats, SosFeedbackModal,
Breathing
Profile components:
- DigaMissionBanner
Pattern: useColors() hook in component body, makeStyles(colors) factory wo
StyleSheet.create vorher hardcoded war. 11 base-tokens (bg/surface/
surfaceElevated/border/text/textMuted/brandOrange/brandBlue/success/error/
warning) nutzen colors.light vs colors.dark scheme.
Bewusst NICHT migriert (semantic colors):
- DigaMissionBanner amber (#fffbeb, #854d0e) — DiGA-brand, nicht neutral
- Lyra-thinking #3b82f6 in urge.tsx — Lyra-brand-color
- scrollDownBtn #374151 — intentional dark floating-button
TS clean. Test: Settings → Theme → Dark — alle screens sollen jetzt dunkel
werden ohne white-flashes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
81 lines
2.1 KiB
TypeScript
81 lines
2.1 KiB
TypeScript
import { View, Text, Pressable, ActivityIndicator } from 'react-native';
|
|
import { Ionicons } from '@expo/vector-icons';
|
|
import { useState } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useColors } from '../../lib/theme';
|
|
|
|
type Props = {
|
|
remainingFormatted: string; // "23:59:42"
|
|
onCancel: () => Promise<void>;
|
|
};
|
|
|
|
export function CooldownBanner({ remainingFormatted, onCancel }: Props) {
|
|
const { t } = useTranslation();
|
|
const colors = useColors();
|
|
const [cancelling, setCancelling] = useState(false);
|
|
|
|
async function handleCancel() {
|
|
setCancelling(true);
|
|
try {
|
|
await onCancel();
|
|
} finally {
|
|
setCancelling(false);
|
|
}
|
|
}
|
|
|
|
return (
|
|
<View
|
|
style={{
|
|
backgroundColor: '#fef3c7',
|
|
borderWidth: 1,
|
|
borderColor: '#fcd34d',
|
|
borderRadius: 14,
|
|
padding: 12,
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
gap: 12,
|
|
}}
|
|
>
|
|
<Ionicons name="time-outline" size={20} color="#d97706" />
|
|
<View style={{ flex: 1 }}>
|
|
<Text style={{ fontSize: 11, fontFamily: 'Nunito_400Regular', color: '#92400e' }}>
|
|
{t('blocker.cooldown_banner_title')}
|
|
</Text>
|
|
<Text
|
|
style={{
|
|
fontSize: 18,
|
|
fontFamily: 'Nunito_700Bold',
|
|
color: '#92400e',
|
|
fontVariant: ['tabular-nums'],
|
|
}}
|
|
>
|
|
{remainingFormatted}
|
|
</Text>
|
|
</View>
|
|
<Pressable
|
|
onPress={handleCancel}
|
|
disabled={cancelling}
|
|
hitSlop={8}
|
|
style={({ pressed }) => ({
|
|
opacity: pressed || cancelling ? 0.7 : 1,
|
|
})}
|
|
>
|
|
<View style={{
|
|
paddingHorizontal: 12,
|
|
paddingVertical: 8,
|
|
borderRadius: 12,
|
|
backgroundColor: '#16a34a',
|
|
}}>
|
|
{cancelling ? (
|
|
<ActivityIndicator size="small" color="#fff" />
|
|
) : (
|
|
<Text style={{ fontSize: 12, fontFamily: 'Nunito_600SemiBold', color: '#fff' }}>
|
|
{t('common.cancel')}
|
|
</Text>
|
|
)}
|
|
</View>
|
|
</Pressable>
|
|
</View>
|
|
);
|
|
}
|