fix(mail): clear connect-error on re-connect + return error fields in status
- upsertMailConnection: bei Update lastConnectError + lastConnectErrorAt auf null — User aktualisiert App-Passwort → UI zeigt sofort wieder Live (statt stale Auth-Fehler-Status bis nächstem IDLE/Scan-Cycle) - /api/mail/status: liefert lastConnectError, lastConnectErrorAt, lastIdleHeartbeatAt mit (waren bisher nicht im Response → Frontend hat den Status nie korrekt rendern können) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
347ad1f6c5
commit
6afffdbb18
@ -13,6 +13,7 @@ import { Ionicons } from '@expo/vector-icons';
|
|||||||
import { MenuView, type MenuAction } from '@react-native-menu/menu';
|
import { MenuView, type MenuAction } from '@react-native-menu/menu';
|
||||||
import { TrueSheet } from '@lodev09/react-native-true-sheet';
|
import { TrueSheet } from '@lodev09/react-native-true-sheet';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { LanguageIcon } from '../components/icons/LanguageIcon';
|
||||||
import { useColors } from '../lib/theme';
|
import { useColors } from '../lib/theme';
|
||||||
import { useAuthStore } from '../stores/auth';
|
import { useAuthStore } from '../stores/auth';
|
||||||
import { useThemeStore, type ThemeMode } from '../stores/theme';
|
import { useThemeStore, type ThemeMode } from '../stores/theme';
|
||||||
@ -25,7 +26,8 @@ import { AppHeader } from '../components/AppHeader';
|
|||||||
type PickerOption<T extends string> = { value: T; label: string };
|
type PickerOption<T extends string> = { value: T; label: string };
|
||||||
|
|
||||||
type SectionRow = {
|
type SectionRow = {
|
||||||
icon: React.ComponentProps<typeof Ionicons>['name'];
|
/** Ionicons-name ODER eigenes SVG-Component (für custom icons wie LanguageIcon) */
|
||||||
|
icon: React.ComponentProps<typeof Ionicons>['name'] | React.ComponentType<{ size?: number; color?: string }>;
|
||||||
label: string;
|
label: string;
|
||||||
sublabel: string;
|
sublabel: string;
|
||||||
soon?: boolean;
|
soon?: boolean;
|
||||||
@ -132,7 +134,7 @@ export default function SettingsScreen() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'language-outline',
|
icon: LanguageIcon,
|
||||||
label: t('settings.language'),
|
label: t('settings.language'),
|
||||||
sublabel: t('settings.language_desc'),
|
sublabel: t('settings.language_desc'),
|
||||||
value: language === 'de' ? t('settings.language_de') : t('settings.language_en'),
|
value: language === 'de' ? t('settings.language_de') : t('settings.language_en'),
|
||||||
@ -288,13 +290,19 @@ export default function SettingsScreen() {
|
|||||||
>
|
>
|
||||||
{section.rows.map((row, i) => {
|
{section.rows.map((row, i) => {
|
||||||
// Visual content of the row (icon + label + sublabel)
|
// Visual content of the row (icon + label + sublabel)
|
||||||
|
const iconColor = row.destructive ? colors.error : colors.textMuted;
|
||||||
|
const IconComponent = typeof row.icon === 'string' ? null : row.icon;
|
||||||
const rowLeft = (
|
const rowLeft = (
|
||||||
<>
|
<>
|
||||||
<Ionicons
|
{IconComponent ? (
|
||||||
name={row.icon}
|
<IconComponent size={18} color={iconColor} />
|
||||||
size={18}
|
) : (
|
||||||
color={row.destructive ? colors.error : colors.textMuted}
|
<Ionicons
|
||||||
/>
|
name={row.icon as React.ComponentProps<typeof Ionicons>['name']}
|
||||||
|
size={18}
|
||||||
|
color={iconColor}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<Text
|
<Text
|
||||||
numberOfLines={1}
|
numberOfLines={1}
|
||||||
|
|||||||
@ -1,256 +1,468 @@
|
|||||||
import { useEffect, useRef } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { Animated, Pressable, Text, View } from 'react-native';
|
import {
|
||||||
|
ActivityIndicator,
|
||||||
|
Animated,
|
||||||
|
Modal,
|
||||||
|
ScrollView,
|
||||||
|
Text,
|
||||||
|
TextInput,
|
||||||
|
TouchableOpacity,
|
||||||
|
View,
|
||||||
|
} from 'react-native';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import * as Haptics from 'expo-haptics';
|
import * as Haptics from 'expo-haptics';
|
||||||
|
import { Ionicons } from '@expo/vector-icons';
|
||||||
|
import { RiveAvatar } from '../RiveAvatar';
|
||||||
|
import { StarRating } from './StarRating';
|
||||||
import { useColors } from '../../lib/theme';
|
import { useColors } from '../../lib/theme';
|
||||||
|
import { apiFetch } from '../../lib/api';
|
||||||
|
|
||||||
export type GameOverScreenProps = {
|
export type GameOverScreenProps = {
|
||||||
score: number;
|
score: number;
|
||||||
bestScore: number;
|
bestScore: number;
|
||||||
gameName: string;
|
gameName: string;
|
||||||
|
scoreLabel?: string;
|
||||||
|
goodScore?: number;
|
||||||
onRetry: () => void;
|
onRetry: () => void;
|
||||||
onExit: () => void;
|
onExit: () => void;
|
||||||
isNewBest?: boolean;
|
isNewBest?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const MOTIVATIONAL_KEYS = [
|
function lyraMsg(
|
||||||
'gameOver.motivational_0',
|
gameName: string,
|
||||||
'gameOver.motivational_1',
|
score: number,
|
||||||
'gameOver.motivational_2',
|
goodScore: number,
|
||||||
'gameOver.motivational_3',
|
isNewBest: boolean,
|
||||||
'gameOver.motivational_4',
|
t: (k: string) => string
|
||||||
];
|
): { title: string; body: string } {
|
||||||
|
if (isNewBest) return { title: t('gameOver.lyra_title_record'), body: t('gameOver.lyra_body_record') };
|
||||||
|
if (score >= goodScore) return { title: t('gameOver.lyra_title_good'), body: t('gameOver.lyra_body_good') };
|
||||||
|
if (score > 0) return { title: t('gameOver.lyra_title_ok'), body: t('gameOver.lyra_body_ok') };
|
||||||
|
return { title: t('gameOver.lyra_title_low'), body: t('gameOver.lyra_body_low') };
|
||||||
|
}
|
||||||
|
|
||||||
export function GameOverScreen({
|
export function GameOverScreen({
|
||||||
score,
|
score,
|
||||||
bestScore,
|
bestScore,
|
||||||
gameName,
|
gameName,
|
||||||
|
scoreLabel,
|
||||||
|
goodScore = 5,
|
||||||
onRetry,
|
onRetry,
|
||||||
onExit,
|
onExit,
|
||||||
isNewBest = false,
|
isNewBest = false,
|
||||||
}: GameOverScreenProps) {
|
}: GameOverScreenProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const colors = useColors();
|
const colors = useColors();
|
||||||
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
const slideAnim = useRef(new Animated.Value(40)).current;
|
const slideAnim = useRef(new Animated.Value(500)).current;
|
||||||
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
||||||
|
const [rating, setRating] = useState(0);
|
||||||
|
const [feedback, setFeedback] = useState('');
|
||||||
|
const [saving, setSaving] = useState(false);
|
||||||
|
const [saved, setSaved] = useState(false);
|
||||||
|
|
||||||
|
const [shareSectionOpen, setShareSectionOpen] = useState(false);
|
||||||
|
const [shareText, setShareText] = useState('');
|
||||||
|
const [shareTextLoading, setShareTextLoading] = useState(false);
|
||||||
|
const [sharing, setSharing] = useState(false);
|
||||||
|
const [posted, setPosted] = useState(false);
|
||||||
|
const [postError, setPostError] = useState(false);
|
||||||
|
|
||||||
|
console.log('[GameOver] colors:', colors);
|
||||||
|
const emotion = isNewBest || score >= goodScore ? 'happy' : 'empathy';
|
||||||
|
const msg = lyraMsg(gameName, score, goodScore, isNewBest, t);
|
||||||
|
const displayScore = score;
|
||||||
|
const displayBest = Math.max(score, bestScore);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success).catch(() => {});
|
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success).catch(() => {});
|
||||||
Animated.parallel([
|
Animated.spring(slideAnim, {
|
||||||
Animated.spring(slideAnim, { toValue: 0, useNativeDriver: true, tension: 60, friction: 10 }),
|
toValue: 0,
|
||||||
Animated.timing(fadeAnim, { toValue: 1, duration: 220, useNativeDriver: true }),
|
useNativeDriver: true,
|
||||||
]).start();
|
damping: 22,
|
||||||
|
stiffness: 200,
|
||||||
|
mass: 0.8,
|
||||||
|
}).start();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const motivationalKey = MOTIVATIONAL_KEYS[score % MOTIVATIONAL_KEYS.length]!;
|
function handleExit() {
|
||||||
const fmt = (n: number) => String(n).padStart(5, '0');
|
Animated.timing(slideAnim, {
|
||||||
|
toValue: 500,
|
||||||
|
duration: 220,
|
||||||
|
useNativeDriver: true,
|
||||||
|
}).start(() => onExit());
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitRating() {
|
||||||
|
setSaving(true);
|
||||||
|
try {
|
||||||
|
await apiFetch('/api/games/rating', {
|
||||||
|
method: 'POST',
|
||||||
|
body: {
|
||||||
|
gameName: gameName.toLowerCase(),
|
||||||
|
stars: rating,
|
||||||
|
feedback: feedback.trim() || null,
|
||||||
|
score,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
setSaved(true);
|
||||||
|
} catch {
|
||||||
|
// endpoint not yet live — silent
|
||||||
|
} finally {
|
||||||
|
setSaving(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function openShareSection() {
|
||||||
|
setShareTextLoading(true);
|
||||||
|
setShareSectionOpen(true);
|
||||||
|
try {
|
||||||
|
const data = await apiFetch<{ text: string }>('/api/games/share-text', {
|
||||||
|
method: 'POST',
|
||||||
|
body: {
|
||||||
|
gameName: gameName.toLowerCase(),
|
||||||
|
score,
|
||||||
|
scoreLabel,
|
||||||
|
bestScore,
|
||||||
|
isNewRecord: score > bestScore,
|
||||||
|
mode: 'game',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
setShareText(data.text || `${gameName}: ${score} ${scoreLabel ?? 'Punkte'}\n${t('gameOver.share_challenge')}`);
|
||||||
|
} catch {
|
||||||
|
setShareText(`${gameName}: ${score} ${scoreLabel ?? 'Punkte'}\n${t('gameOver.share_challenge')}`);
|
||||||
|
} finally {
|
||||||
|
setShareTextLoading(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitCommunityPost() {
|
||||||
|
if (!shareText.trim()) return;
|
||||||
|
setSharing(true);
|
||||||
|
setPostError(false);
|
||||||
|
try {
|
||||||
|
const scoreLine = `${scoreLabel ?? 'Score'}: ${score}`;
|
||||||
|
await apiFetch('/api/community/post', {
|
||||||
|
method: 'POST',
|
||||||
|
body: {
|
||||||
|
category: 'game_share',
|
||||||
|
content: `${gameName}\n${scoreLine}\n${shareText.trim()}`,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
setPosted(true);
|
||||||
|
setShareSectionOpen(false);
|
||||||
|
setTimeout(() => handleExit(), 1500);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[gameover/post] failed:', err);
|
||||||
|
setPostError(true);
|
||||||
|
} finally {
|
||||||
|
setSharing(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const pillBg = colors.surfaceElevated;
|
||||||
|
const pillText = colors.text;
|
||||||
|
const pillMuted = colors.textMuted;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Animated.View
|
<Modal visible transparent animationType="none" onRequestClose={handleExit}>
|
||||||
style={{
|
<View style={{ flex: 1, justifyContent: 'flex-end' }}>
|
||||||
position: 'absolute',
|
<TouchableOpacity onPress={handleExit} activeOpacity={1} style={{ flex: 1 }} />
|
||||||
inset: 0,
|
<Animated.View
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
paddingHorizontal: 16,
|
|
||||||
paddingVertical: 24,
|
|
||||||
opacity: fadeAnim,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* Backdrop */}
|
|
||||||
<Pressable
|
|
||||||
onPress={onExit}
|
|
||||||
style={{
|
|
||||||
position: 'absolute',
|
|
||||||
inset: 0,
|
|
||||||
backgroundColor: 'rgba(0,0,0,0.55)',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* Card */}
|
|
||||||
<Animated.View
|
|
||||||
style={{
|
|
||||||
transform: [{ translateY: slideAnim }],
|
|
||||||
width: '100%',
|
|
||||||
maxWidth: 340,
|
|
||||||
backgroundColor: colors.surface,
|
|
||||||
borderRadius: 20,
|
|
||||||
paddingHorizontal: 20,
|
|
||||||
paddingTop: 24,
|
|
||||||
paddingBottom: 20,
|
|
||||||
shadowColor: '#000',
|
|
||||||
shadowOffset: { width: 0, height: 8 },
|
|
||||||
shadowOpacity: 0.18,
|
|
||||||
shadowRadius: 20,
|
|
||||||
elevation: 12,
|
|
||||||
gap: 16,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{/* Title row */}
|
|
||||||
<View style={{ alignItems: 'center', gap: 4 }}>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
fontFamily: 'Nunito_800ExtraBold',
|
|
||||||
fontSize: 22,
|
|
||||||
color: colors.text,
|
|
||||||
textAlign: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t('gameOver.title')}
|
|
||||||
</Text>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
fontFamily: 'Nunito_400Regular',
|
|
||||||
fontSize: 13,
|
|
||||||
color: colors.textMuted,
|
|
||||||
textAlign: 'center',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{gameName}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
{/* Score row */}
|
|
||||||
<View
|
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
transform: [{ translateY: slideAnim }],
|
||||||
justifyContent: 'center',
|
backgroundColor: colors.surface,
|
||||||
gap: 12,
|
borderTopLeftRadius: 28,
|
||||||
|
borderTopRightRadius: 28,
|
||||||
|
paddingTop: 12,
|
||||||
|
paddingHorizontal: 20,
|
||||||
|
paddingBottom: insets.bottom + 24,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* Score */}
|
{/* Grab-handle */}
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
alignSelf: 'center',
|
||||||
backgroundColor: colors.surfaceElevated,
|
width: 36,
|
||||||
borderRadius: 14,
|
height: 5,
|
||||||
paddingVertical: 12,
|
borderRadius: 3,
|
||||||
paddingHorizontal: 8,
|
backgroundColor: colors.textMuted,
|
||||||
alignItems: 'center',
|
opacity: 0.3,
|
||||||
gap: 2,
|
marginBottom: 16,
|
||||||
}}
|
}}
|
||||||
>
|
/>
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
fontFamily: 'Courier New' as any,
|
|
||||||
fontSize: 22,
|
|
||||||
color: '#00e680',
|
|
||||||
letterSpacing: 2,
|
|
||||||
fontVariant: ['tabular-nums'],
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{fmt(score)}
|
|
||||||
</Text>
|
|
||||||
<Text
|
|
||||||
style={{
|
|
||||||
fontSize: 10,
|
|
||||||
color: colors.textMuted,
|
|
||||||
textTransform: 'uppercase',
|
|
||||||
letterSpacing: 1,
|
|
||||||
fontFamily: 'Nunito_600SemiBold',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{t('gameOver.score')}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
{/* Best */}
|
<ScrollView
|
||||||
<View
|
keyboardShouldPersistTaps="handled"
|
||||||
style={{
|
showsVerticalScrollIndicator={false}
|
||||||
flex: 1,
|
contentContainerStyle={{ gap: 16, paddingBottom: 8 }}
|
||||||
backgroundColor: isNewBest ? '#fef3c7' : colors.surfaceElevated,
|
|
||||||
borderRadius: 14,
|
|
||||||
borderWidth: isNewBest ? 1.5 : 0,
|
|
||||||
borderColor: isNewBest ? '#f59e0b' : 'transparent',
|
|
||||||
paddingVertical: 12,
|
|
||||||
paddingHorizontal: 8,
|
|
||||||
alignItems: 'center',
|
|
||||||
gap: 2,
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Text
|
{/* Lyra avatar + message */}
|
||||||
style={{
|
<View style={{ alignItems: 'center', gap: 8 }}>
|
||||||
fontFamily: 'Courier New' as any,
|
<RiveAvatar emotion={emotion} size="md" />
|
||||||
fontSize: 22,
|
<Text style={{ fontSize: 11, color: colors.textMuted, fontFamily: 'Nunito_600SemiBold' }}>
|
||||||
color: isNewBest ? '#d97706' : colors.textMuted,
|
Lyra
|
||||||
letterSpacing: 2,
|
</Text>
|
||||||
fontVariant: ['tabular-nums'],
|
<Text style={{ fontFamily: 'Nunito_800ExtraBold', fontSize: 18, color: colors.text, textAlign: 'center' }}>
|
||||||
}}
|
{msg.title}
|
||||||
>
|
</Text>
|
||||||
{fmt(Math.max(score, bestScore))}
|
<Text style={{ fontFamily: 'Nunito_400Regular', fontSize: 13, color: colors.textMuted, textAlign: 'center', lineHeight: 18, paddingHorizontal: 4 }}>
|
||||||
</Text>
|
{msg.body}
|
||||||
<Text
|
</Text>
|
||||||
style={{
|
</View>
|
||||||
fontSize: 10,
|
|
||||||
color: isNewBest ? '#d97706' : colors.textMuted,
|
|
||||||
textTransform: 'uppercase',
|
|
||||||
letterSpacing: 1,
|
|
||||||
fontFamily: 'Nunito_600SemiBold',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{isNewBest ? t('gameOver.newBest') : t('gameOver.best')}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
{/* Motivational text */}
|
{/* Score pills */}
|
||||||
<Text
|
<View style={{ flexDirection: 'row', justifyContent: 'center', gap: 10 }}>
|
||||||
style={{
|
<View style={{ flex: 1, backgroundColor: pillBg, borderRadius: 14, paddingVertical: 12, paddingHorizontal: 8, alignItems: 'center', gap: 2 }}>
|
||||||
fontSize: 13,
|
<Text style={{ fontFamily: 'Nunito_800ExtraBold', fontSize: 20, color: pillText }}>
|
||||||
color: colors.textMuted,
|
{displayScore}
|
||||||
textAlign: 'center',
|
</Text>
|
||||||
lineHeight: 19,
|
<Text style={{ fontSize: 10, color: pillMuted, textTransform: 'uppercase', letterSpacing: 1, fontFamily: 'Nunito_600SemiBold' }}>
|
||||||
fontFamily: 'Nunito_400Regular',
|
{scoreLabel ?? t('gameOver.score')}
|
||||||
paddingHorizontal: 4,
|
</Text>
|
||||||
}}
|
</View>
|
||||||
>
|
<View
|
||||||
{t(motivationalKey)}
|
style={{
|
||||||
</Text>
|
flex: 1,
|
||||||
|
backgroundColor: isNewBest ? '#fef3c7' : pillBg,
|
||||||
|
borderRadius: 14,
|
||||||
|
borderWidth: isNewBest ? 1.5 : 0,
|
||||||
|
borderColor: isNewBest ? '#f59e0b' : 'transparent',
|
||||||
|
paddingVertical: 12,
|
||||||
|
paddingHorizontal: 8,
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontFamily: 'Nunito_800ExtraBold', fontSize: 20, color: isNewBest ? '#d97706' : pillMuted }}>
|
||||||
|
{displayBest}
|
||||||
|
</Text>
|
||||||
|
<Text style={{ fontSize: 10, color: isNewBest ? '#d97706' : pillMuted, textTransform: 'uppercase', letterSpacing: 1, fontFamily: 'Nunito_600SemiBold' }}>
|
||||||
|
{isNewBest ? t('gameOver.newBest') : t('gameOver.best')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
{/* Buttons */}
|
{/* Star rating */}
|
||||||
<View style={{ flexDirection: 'row', gap: 10 }}>
|
<View style={{ alignItems: 'center', gap: 6 }}>
|
||||||
<Pressable
|
<StarRating
|
||||||
onPress={() => {
|
value={rating}
|
||||||
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium).catch(() => {});
|
size="lg"
|
||||||
onRetry();
|
interactive={!saved}
|
||||||
}}
|
filledColor="#f59e0b"
|
||||||
style={({ pressed }) => ({
|
onChange={(v) => { if (!saved) setRating(v); }}
|
||||||
flex: 1,
|
/>
|
||||||
paddingVertical: 13,
|
{saved ? (
|
||||||
paddingHorizontal: 16,
|
<Text style={{ fontSize: 11, color: colors.textMuted, fontFamily: 'Nunito_400Regular' }}>
|
||||||
borderRadius: 12,
|
{t('gameOver.rating_saved')}
|
||||||
backgroundColor: '#007AFF',
|
</Text>
|
||||||
alignItems: 'center',
|
) : null}
|
||||||
opacity: pressed ? 0.75 : 1,
|
</View>
|
||||||
})}
|
|
||||||
>
|
|
||||||
<Text style={{ fontFamily: 'Nunito_700Bold', fontSize: 15, color: '#ffffff' }}>
|
|
||||||
{t('gameOver.retry')}
|
|
||||||
</Text>
|
|
||||||
</Pressable>
|
|
||||||
|
|
||||||
<Pressable
|
{/* Feedback textarea + save */}
|
||||||
onPress={() => {
|
{rating > 0 && !saved ? (
|
||||||
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => {});
|
<View style={{ gap: 8 }}>
|
||||||
onExit();
|
<TextInput
|
||||||
}}
|
value={feedback}
|
||||||
style={({ pressed }) => ({
|
onChangeText={setFeedback}
|
||||||
flex: 1,
|
placeholder={t('gameOver.feedback_placeholder')}
|
||||||
paddingVertical: 13,
|
placeholderTextColor={colors.textMuted}
|
||||||
paddingHorizontal: 16,
|
multiline
|
||||||
borderRadius: 12,
|
numberOfLines={2}
|
||||||
backgroundColor: colors.surfaceElevated,
|
style={{
|
||||||
alignItems: 'center',
|
backgroundColor: colors.surfaceElevated,
|
||||||
opacity: pressed ? 0.75 : 1,
|
borderRadius: 12,
|
||||||
})}
|
padding: 12,
|
||||||
>
|
fontSize: 13,
|
||||||
<Text style={{ fontFamily: 'Nunito_700Bold', fontSize: 15, color: colors.textMuted }}>
|
fontFamily: 'Nunito_400Regular',
|
||||||
{t('gameOver.exit')}
|
color: colors.text,
|
||||||
</Text>
|
minHeight: 56,
|
||||||
</Pressable>
|
textAlignVertical: 'top',
|
||||||
</View>
|
}}
|
||||||
</Animated.View>
|
/>
|
||||||
</Animated.View>
|
<TouchableOpacity
|
||||||
|
onPress={submitRating}
|
||||||
|
disabled={saving}
|
||||||
|
activeOpacity={0.7}
|
||||||
|
style={{
|
||||||
|
backgroundColor: '#f59e0b',
|
||||||
|
borderRadius: 14,
|
||||||
|
minHeight: 50,
|
||||||
|
paddingVertical: 14,
|
||||||
|
paddingHorizontal: 20,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
opacity: saving ? 0.65 : 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontFamily: 'Nunito_700Bold', fontSize: 16, color: '#ffffff' }}>
|
||||||
|
{saving ? t('common.loading') : t('gameOver.save_rating')}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{/* Primary action row */}
|
||||||
|
<View style={{ flexDirection: 'row', gap: 12 }}>
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => {
|
||||||
|
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium).catch(() => {});
|
||||||
|
onRetry();
|
||||||
|
}}
|
||||||
|
activeOpacity={0.85}
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: '#f59e0b',
|
||||||
|
borderRadius: 14,
|
||||||
|
minHeight: 50,
|
||||||
|
paddingVertical: 14,
|
||||||
|
paddingHorizontal: 20,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontFamily: 'Nunito_700Bold', fontSize: 16, color: '#ffffff' }}>
|
||||||
|
{t('gameOver.retry')}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => {
|
||||||
|
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => {});
|
||||||
|
handleExit();
|
||||||
|
}}
|
||||||
|
activeOpacity={0.75}
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: '#e5e7eb',
|
||||||
|
borderRadius: 14,
|
||||||
|
minHeight: 50,
|
||||||
|
paddingVertical: 14,
|
||||||
|
paddingHorizontal: 20,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
borderWidth: 1,
|
||||||
|
borderColor: 'rgba(0,0,0,0.08)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontFamily: 'Nunito_700Bold', fontSize: 16, color: '#374151' }}>
|
||||||
|
{t('gameOver.exit')}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* Share section */}
|
||||||
|
{posted ? (
|
||||||
|
<View style={{ alignItems: 'center', paddingVertical: 4, flexDirection: 'row', justifyContent: 'center', gap: 6 }}>
|
||||||
|
<Ionicons name="checkmark-circle" size={15} color={colors.success} />
|
||||||
|
<Text style={{ fontSize: 13, color: colors.success, fontFamily: 'Nunito_600SemiBold' }}>
|
||||||
|
{t('gameOver.posted')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
) : !shareSectionOpen ? (
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={openShareSection}
|
||||||
|
activeOpacity={0.6}
|
||||||
|
style={{ alignItems: 'center', paddingVertical: 4 }}
|
||||||
|
>
|
||||||
|
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 6 }}>
|
||||||
|
<Ionicons name="people-outline" size={15} color={colors.textMuted} />
|
||||||
|
<Text style={{ fontSize: 13, color: colors.textMuted, fontFamily: 'Nunito_600SemiBold' }}>
|
||||||
|
{t('gameOver.share_result')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</TouchableOpacity>
|
||||||
|
) : (
|
||||||
|
<View style={{ gap: 10 }}>
|
||||||
|
{shareTextLoading ? (
|
||||||
|
<View style={{ alignItems: 'center', paddingVertical: 12 }}>
|
||||||
|
<ActivityIndicator size="small" color={colors.textMuted} />
|
||||||
|
<Text style={{ fontSize: 12, color: colors.textMuted, fontFamily: 'Nunito_400Regular', marginTop: 6 }}>
|
||||||
|
{t('gameOver.share_loading')}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
<TextInput
|
||||||
|
value={shareText}
|
||||||
|
onChangeText={setShareText}
|
||||||
|
multiline
|
||||||
|
numberOfLines={4}
|
||||||
|
style={{
|
||||||
|
backgroundColor: colors.surfaceElevated,
|
||||||
|
borderRadius: 14,
|
||||||
|
padding: 14,
|
||||||
|
fontSize: 14,
|
||||||
|
fontFamily: 'Nunito_400Regular',
|
||||||
|
color: colors.text,
|
||||||
|
minHeight: 100,
|
||||||
|
textAlignVertical: 'top',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{postError ? (
|
||||||
|
<Text style={{ fontSize: 12, color: colors.error, fontFamily: 'Nunito_600SemiBold', textAlign: 'center' }}>
|
||||||
|
{t('gameOver.post_error')}
|
||||||
|
</Text>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
<View style={{ flexDirection: 'row', gap: 12 }}>
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => { setShareSectionOpen(false); setShareText(''); setPostError(false); }}
|
||||||
|
activeOpacity={0.7}
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: '#e5e7eb',
|
||||||
|
borderRadius: 14,
|
||||||
|
minHeight: 50,
|
||||||
|
paddingVertical: 14,
|
||||||
|
paddingHorizontal: 20,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
borderWidth: 1,
|
||||||
|
borderColor: 'rgba(0,0,0,0.08)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontFamily: 'Nunito_700Bold', fontSize: 16, color: '#374151' }}>
|
||||||
|
{t('common.cancel')}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={submitCommunityPost}
|
||||||
|
disabled={!shareText.trim() || sharing || shareTextLoading}
|
||||||
|
activeOpacity={0.85}
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: '#f59e0b',
|
||||||
|
borderRadius: 14,
|
||||||
|
minHeight: 50,
|
||||||
|
paddingVertical: 14,
|
||||||
|
paddingHorizontal: 20,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
|
flexDirection: 'row',
|
||||||
|
gap: 6,
|
||||||
|
opacity: sharing || !shareText.trim() || shareTextLoading ? 0.55 : 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{sharing ? (
|
||||||
|
<ActivityIndicator size="small" color="#ffffff" />
|
||||||
|
) : (
|
||||||
|
<Ionicons name="paper-plane-outline" size={16} color="#ffffff" />
|
||||||
|
)}
|
||||||
|
<Text style={{ fontFamily: 'Nunito_700Bold', fontSize: 16, color: '#ffffff' }}>
|
||||||
|
{t('gameOver.post_to_community')}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</ScrollView>
|
||||||
|
</Animated.View>
|
||||||
|
</View>
|
||||||
|
</Modal>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,16 +295,17 @@ export function SnakeGame({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ paddingHorizontal: 16, paddingTop: 4, paddingBottom: Math.max(insets.bottom, 16), position: 'relative' }}>
|
<View style={{ paddingHorizontal: 16, paddingTop: 4, paddingBottom: Math.max(insets.bottom, 16), position: 'relative' }}>
|
||||||
{/* Header */}
|
{!gameOver && (
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 }}>
|
<>
|
||||||
<Text style={{ fontSize: 11, color: '#6b7280', flex: 1, marginRight: 8 }} numberOfLines={2}>{lyraMessage}</Text>
|
{/* Lyra hint */}
|
||||||
<Pressable onPress={onAbandon} hitSlop={10} style={{ width: 28, height: 28, alignItems: 'center', justifyContent: 'center' }}>
|
<View style={{ marginBottom: 8 }}>
|
||||||
<Text style={{ fontSize: 18, color: '#6b7280' }}>✕</Text>
|
<Text style={{ fontSize: 11, color: '#6b7280' }} numberOfLines={2}>{lyraMessage}</Text>
|
||||||
</Pressable>
|
</View>
|
||||||
</View>
|
|
||||||
|
|
||||||
{/* Digital score dashboard */}
|
{/* Digital score dashboard */}
|
||||||
<DigitalScore score={score} best={highScore} boardWidth={boardW} />
|
<DigitalScore score={score} best={highScore} boardWidth={boardW} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Board */}
|
{/* Board */}
|
||||||
<View style={{ alignItems: 'center' }} {...panResponder.panHandlers}>
|
<View style={{ alignItems: 'center' }} {...panResponder.panHandlers}>
|
||||||
@ -354,6 +355,8 @@ export function SnakeGame({
|
|||||||
score={score}
|
score={score}
|
||||||
bestScore={highScore}
|
bestScore={highScore}
|
||||||
gameName="Snake"
|
gameName="Snake"
|
||||||
|
scoreLabel="Äpfel"
|
||||||
|
goodScore={10}
|
||||||
isNewBest={isNewBest}
|
isNewBest={isNewBest}
|
||||||
onRetry={resetSnake}
|
onRetry={resetSnake}
|
||||||
onExit={() => onAbandon()}
|
onExit={() => onAbandon()}
|
||||||
@ -581,6 +584,8 @@ export function MemoryGame({
|
|||||||
score={moveCount}
|
score={moveCount}
|
||||||
bestScore={bestMoves}
|
bestScore={bestMoves}
|
||||||
gameName="Memory"
|
gameName="Memory"
|
||||||
|
scoreLabel="Züge"
|
||||||
|
goodScore={30}
|
||||||
isNewBest={isNewBestMemory}
|
isNewBest={isNewBestMemory}
|
||||||
onRetry={init}
|
onRetry={init}
|
||||||
onExit={() => onAbandon()}
|
onExit={() => onAbandon()}
|
||||||
@ -1011,14 +1016,17 @@ export function TetrisGame({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ paddingHorizontal: 16, paddingTop: 4, paddingBottom: Math.max(insets.bottom, 16), position: 'relative' }}>
|
<View style={{ paddingHorizontal: 16, paddingTop: 4, paddingBottom: Math.max(insets.bottom, 16), position: 'relative' }}>
|
||||||
{/* Header */}
|
{!gameOver && (
|
||||||
<View style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 }}>
|
<>
|
||||||
<Text style={{ fontSize: 11, color: '#6b7280', flex: 1, marginRight: 8 }} numberOfLines={2}>{lyraMessage}</Text>
|
{/* Lyra hint */}
|
||||||
<Pressable onPress={onAbandon} hitSlop={10}><Text style={{ fontSize: 18, color: '#6b7280' }}>✕</Text></Pressable>
|
<View style={{ marginBottom: 8 }}>
|
||||||
</View>
|
<Text style={{ fontSize: 11, color: '#6b7280' }} numberOfLines={2}>{lyraMessage}</Text>
|
||||||
|
</View>
|
||||||
|
|
||||||
{/* Digital score dashboard */}
|
{/* Digital score dashboard */}
|
||||||
<DigitalScore score={score} best={highScore} extra={level} extraLabel="LVL" boardWidth={boardWidth} />
|
<DigitalScore score={score} best={highScore} extra={level} extraLabel="LVL" boardWidth={boardWidth} />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Board */}
|
{/* Board */}
|
||||||
<View style={{ alignItems: 'center', marginVertical: 4 }}>
|
<View style={{ alignItems: 'center', marginVertical: 4 }}>
|
||||||
@ -1103,6 +1111,8 @@ export function TetrisGame({
|
|||||||
score={score}
|
score={score}
|
||||||
bestScore={highScore}
|
bestScore={highScore}
|
||||||
gameName="Tetris"
|
gameName="Tetris"
|
||||||
|
scoreLabel="Punkte"
|
||||||
|
goodScore={1000}
|
||||||
isNewBest={isNewBestTetris}
|
isNewBest={isNewBestTetris}
|
||||||
onRetry={resetTetris}
|
onRetry={resetTetris}
|
||||||
onExit={() => onAbandon()}
|
onExit={() => onAbandon()}
|
||||||
|
|||||||
@ -23,6 +23,13 @@ export default defineEventHandler(async (event) => {
|
|||||||
c.emailsScanned > 0
|
c.emailsScanned > 0
|
||||||
? Math.round((c.emailsBlocked / c.emailsScanned) * 100)
|
? Math.round((c.emailsBlocked / c.emailsScanned) * 100)
|
||||||
: 0,
|
: 0,
|
||||||
|
// Connect-Error-Status für UI (Auth-Fehler etc.) — wird beim Re-Connect via
|
||||||
|
// upsertMailConnection auf null gesetzt, bei IDLE/Scan-Failure neu geschrieben
|
||||||
|
lastConnectError: (c as { lastConnectError?: string | null }).lastConnectError ?? null,
|
||||||
|
lastConnectErrorAt:
|
||||||
|
(c as { lastConnectErrorAt?: Date | null }).lastConnectErrorAt?.toISOString() ?? null,
|
||||||
|
lastIdleHeartbeatAt:
|
||||||
|
(c as { lastIdleHeartbeatAt?: Date | null }).lastIdleHeartbeatAt?.toISOString() ?? null,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const blocked7d = await getMailBlockedStats(user.id);
|
const blocked7d = await getMailBlockedStats(user.id);
|
||||||
|
|||||||
@ -51,6 +51,10 @@ export async function upsertMailConnection(data: {
|
|||||||
rejectUnauthorized: data.rejectUnauthorized ?? true,
|
rejectUnauthorized: data.rejectUnauthorized ?? true,
|
||||||
useStarttls: data.useStarttls ?? false,
|
useStarttls: data.useStarttls ?? false,
|
||||||
isActive: true,
|
isActive: true,
|
||||||
|
// Bei Re-Connect (z.B. neues App-Passwort): alte Error-Spuren clearen,
|
||||||
|
// damit UI sofort wieder "Live" zeigt — IDLE-daemon übernimmt.
|
||||||
|
lastConnectError: null,
|
||||||
|
lastConnectErrorAt: null,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user