import { Pressable, StyleSheet } from 'react-native'; import { Ionicons } from '@expo/vector-icons'; import { Text } from '@/components/Text'; import { spacing } from '@/theme'; import { useColors } from '@/theme/themed'; import type { EQPreset } from '@/types/audio'; import { EqSheet, EqSheetItem, EqSheetSection } from './EqSheet'; interface PresetSheetProps { presets: EQPreset[]; activePresetId: string | null; onApply: (id: string) => void; onDelete: (id: string) => void; onSaveNew: () => void; onClose: () => void; } /** * Leading row icon telling a custom preset's editor mode apart at a glance. * Built-ins get no icon — they're mode-agnostic and apply in the active mode. */ function modeIcon(preset: EQPreset): 'options-outline' | 'analytics-outline' { return preset.mode === 'graphic' ? 'options-outline' : 'analytics-outline'; } /** Preset hub: pick a built-in or custom preset, delete custom ones, or save a new one. */ export function PresetSheet({ presets, activePresetId, onApply, onDelete, onSaveNew, onClose, }: PresetSheetProps) { const colors = useColors(); const builtIn = presets.filter((p) => !p.isCustom); const custom = presets.filter((p) => p.isCustom); return ( Presets {builtIn.map((p) => ( { onApply(p.id); onClose(); }} /> ))} {custom.length === 0 ? ( No saved presets yet. ) : ( custom.map((p) => ( { onApply(p.id); onClose(); }} trailing={ onDelete(p.id)} style={styles.delete} accessibilityLabel={`Delete preset ${p.name}`} > } /> )) )} { onClose(); onSaveNew(); }} /> ); } const styles = StyleSheet.create({ title: { marginTop: spacing.xs, }, empty: { paddingVertical: spacing.sm, }, delete: { paddingHorizontal: spacing.sm, paddingVertical: spacing.sm, }, }); export default PresetSheet;