fix(native): domains-section flat, mails-section collapsible only

DomainSection bekommt collapsible-Prop (default false).
Domains-Section: kein Chevron, kein useState, Content immer sichtbar.
Mails-Section: collapsible={true} + open/onToggle wie bisher.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-05-16 02:20:38 +02:00
parent f4da81f551
commit e370842072

View File

@ -61,8 +61,6 @@ export default function BlockerScreen() {
}, [refreshDomains, syncBlocklist, refresh]); }, [refreshDomains, syncBlocklist, refresh]);
useDomainSubmissionRealtime(onDomainChange, true); useDomainSubmissionRealtime(onDomainChange, true);
// Section collapse state — beide Sections starten offen
const [webOpen, setWebOpen] = useState(true);
const [mailOpen, setMailOpen] = useState(true); const [mailOpen, setMailOpen] = useState(true);
// AddSheet state: tracks which section opened it // AddSheet state: tracks which section opened it
@ -369,8 +367,6 @@ export default function BlockerScreen() {
title={t('blocker.section_domains')} title={t('blocker.section_domains')}
count={countsByType.web} count={countsByType.web}
max={limits.web} max={limits.web}
open={webOpen}
onToggle={() => setWebOpen((v) => !v)}
onAdd={() => openAddSheet('web')} onAdd={() => openAddSheet('web')}
atLimit={countsByType.web >= limits.web} atLimit={countsByType.web >= limits.web}
> >
@ -388,6 +384,7 @@ export default function BlockerScreen() {
title={t('blocker.section_mails')} title={t('blocker.section_mails')}
count={countsByType.mail} count={countsByType.mail}
max={limits.mail} max={limits.mail}
collapsible
open={mailOpen} open={mailOpen}
onToggle={() => setMailOpen((v) => !v)} onToggle={() => setMailOpen((v) => !v)}
onAdd={() => openAddSheet('mail')} onAdd={() => openAddSheet('mail')}
@ -448,7 +445,8 @@ function DomainSection({
title, title,
count, count,
max, max,
open, collapsible = false,
open = true,
onToggle, onToggle,
onAdd, onAdd,
atLimit, atLimit,
@ -457,8 +455,9 @@ function DomainSection({
title: string; title: string;
count: number; count: number;
max: number; max: number;
open: boolean; collapsible?: boolean;
onToggle: () => void; open?: boolean;
onToggle?: () => void;
onAdd: () => void; onAdd: () => void;
atLimit: boolean; atLimit: boolean;
children: React.ReactNode; children: React.ReactNode;
@ -496,8 +495,8 @@ function DomainSection({
> >
{/* Section Header */} {/* Section Header */}
<TouchableOpacity <TouchableOpacity
onPress={onToggle} onPress={collapsible ? onToggle : undefined}
activeOpacity={0.7} activeOpacity={collapsible ? 0.7 : 1}
style={{ style={{
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
@ -521,14 +520,16 @@ function DomainSection({
{t('blocker.count_label', { count, max })} {t('blocker.count_label', { count, max })}
</Text> </Text>
</View> </View>
<Ionicons {collapsible && (
name={open ? 'chevron-up' : 'chevron-down'} <Ionicons
size={16} name={open ? 'chevron-up' : 'chevron-down'}
color={colors.textMuted} size={16}
/> color={colors.textMuted}
/>
)}
</TouchableOpacity> </TouchableOpacity>
{open && ( {(!collapsible || open) && (
<View style={{ paddingHorizontal: 14, paddingBottom: 14, gap: 12 }}> <View style={{ paddingHorizontal: 14, paddingBottom: 14, gap: 12 }}>
{/* Progressbar */} {/* Progressbar */}
<View <View