This commit is contained in:
2026-03-14 19:45:08 -03:00
parent 9ac83ad823
commit 74adc35b53
23 changed files with 1082 additions and 150 deletions
+19 -1
View File
@@ -6,8 +6,10 @@ import { useRouter } from 'expo-router';
import { Ionicons } from '@expo/vector-icons';
import { SafeAreaView } from 'react-native-safe-area-context';
import { usePresetStore } from '@store/presetStore';
import { useAuthStore } from '@store/authStore';
import { isUserOwnedPreset } from '@domain/SpoolPreset';
import { colors, typography, spacing, radius } from '@shared/theme';
import { deletePresetUseCase } from '@infrastructure/container';
/**
* Tela de Presets de Carretéis — M4-0
@@ -22,7 +24,23 @@ export default function ConfigScreen(): React.ReactElement {
`Deseja excluir o preset "${name}"?`,
[
{ text: 'Cancelar', style: 'cancel' },
{ text: 'Excluir', style: 'destructive', onPress: () => removePreset(id) },
{
text: 'Excluir',
style: 'destructive',
onPress: async () => {
try {
const user = useAuthStore.getState().user;
if (!user) {
Alert.alert('Erro', 'Usuário não autenticado');
return;
}
await deletePresetUseCase.execute(id, user.id);
removePreset(id);
} catch (error) {
Alert.alert('Erro', `Falha ao deletar: ${(error as Error).message}`);
}
},
},
],
);
}