import { View, Text, Pressable } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { useTranslation } from 'react-i18next';
import type { ProtectionState } from '../../lib/protection';
type Props = {
state: ProtectionState;
/** Click-1 of 3-Click-Cooldown-Trigger — öffnet ProtectionDetailsSheet. */
onPressSettings: () => void;
};
/**
* Wird gezeigt sobald Family Controls aktiv ist — der Schutz ist dann
* "locked in" und kann nur über den Cooldown-Flow deaktiviert werden.
* Daher: KEINE Switches mehr, nur ein Settings-Icon das den 3-Click-Flow startet.
*/
export function ProtectionLockedCard({ state, onPressSettings }: Props) {
const { t } = useTranslation();
const isCooldown = state.phase === 'cooldownActive';
const cardBg = isCooldown ? '#fef3c7' : '#dcfce7';
const cardBorder = isCooldown ? '#fcd34d' : '#86efac';
const iconBg = isCooldown ? '#fde68a' : '#bbf7d0';
const iconColor = isCooldown ? '#d97706' : '#16a34a';
const subtitle = (() => {
if (isCooldown) return t('blocker.protection_subtitle_cooldown');
if (state.plan === 'legend') {
return t('blocker.protection_subtitle_legend');
}
if (state.plan === 'pro') {
return t('blocker.protection_subtitle_pro');
}
return t('blocker.protection_subtitle_free', { count: state.blocklistCount });
})();
return (
{t('blocker.protection_card_locked_title')}
{subtitle}
({
width: 36,
height: 36,
borderRadius: 18,
backgroundColor: '#ffffff',
alignItems: 'center',
justifyContent: 'center',
opacity: pressed ? 0.6 : 1,
shadowColor: '#000',
shadowOffset: { width: 0, height: 1 },
shadowOpacity: 0.05,
shadowRadius: 2,
})}
accessibilityLabel={t('blocker.protection_settings_a11y')}
>
{/* Stats nur wenn aktiv und kein Cooldown */}
{!isCooldown && (
)}
);
}
function Stat({ label, value, valueColor = '#0a0a0a' }: { label: string; value: string; valueColor?: string }) {
return (
{value}
{label}
);
}
function formatCount(n: number): string {
if (n >= 1000) return `${Math.floor(n / 1000)}k+`;
return String(n);
}