import React, { useState } from 'react'; import { View, StyleSheet, Linking, Alert } from 'react-native'; import { useRouter } from 'expo-router'; import Button from '../atoms/Button'; import Text from '../atoms/Text'; import { ParentalGate } from '../../src/components/ParentalGate'; import { useParentalGate } from '../../src/hooks/useParentalGate'; interface AccountSectionProps { email?: string; onLogout: () => void; isWideScreen?: boolean; } export default function AccountSection({ email, onLogout, isWideScreen = false }: AccountSectionProps) { const router = useRouter(); const { isVisible, config, setIsVisible, openEmailWithGate, openExternalLinkWithGate } = useParentalGate(); const dynamicStyles = { userInfo: { padding: isWideScreen ? 20 : 16, marginBottom: isWideScreen ? 20 : 16, }, button: { marginBottom: isWideScreen ? 12 : 8, }, }; const handleContactPress = () => { openEmailWithGate('kontakt@memoro.ai'); }; const handleFeedbackPress = () => { router.push('/feedback'); }; const handlePrivacyPress = () => { openExternalLinkWithGate('https://märchen-zauber.de/privacy', { title: 'Datenschutzerklärung öffnen', message: 'Um die Datenschutzerklärung zu öffnen, löse bitte diese Rechenaufgabe:', }); }; const handleTermsPress = () => { openExternalLinkWithGate('https://märchen-zauber.de/terms', { title: 'AGB öffnen', message: 'Um die AGB zu öffnen, löse bitte diese Rechenaufgabe:', }); }; const handleDeleteAccount = () => { Alert.alert( 'Account löschen', 'Möchtest du deinen Account wirklich löschen? Alle deine Geschichten und Charaktere werden dauerhaft gelöscht.\n\nBitte kontaktiere unseren Support, um dein Konto zu löschen.', [ { text: 'Abbrechen', style: 'cancel', }, { text: 'Support kontaktieren', style: 'destructive', onPress: () => { openEmailWithGate( 'kontakt@memoro.ai', 'Account Deletion Request', `Hallo,\n\nIch möchte meinen Account löschen.\n\nE-Mail: ${email}\n\nBitte löscht alle meine Daten gemäß DSGVO.\n\nVielen Dank` ); }, }, ] ); }; return ( { setIsVisible(false); config.onSuccess?.(); }} onCancel={() => setIsVisible(false)} title={config.title} message={config.message} /> E-Mail {email}