From ae17fc27bc327911f4fef9ec7096fbe3c2460ac2 Mon Sep 17 00:00:00 2001 From: Joe Ward Date: Sun, 16 Aug 2026 19:23:54 +0100 Subject: [PATCH] fix(ui): disable routine save until name and exercises are set Prevent saving empty or unnamed routines that previously fell back to "Unnamed Routine" and produced unusable entries (audit 01-F-002). Co-authored-by: Cursor --- .../presentation/screen/RoutineEditorScreen.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shared/src/commonMain/kotlin/com/devil/phoenixproject/presentation/screen/RoutineEditorScreen.kt b/shared/src/commonMain/kotlin/com/devil/phoenixproject/presentation/screen/RoutineEditorScreen.kt index d6e428c86..e754ed36e 100644 --- a/shared/src/commonMain/kotlin/com/devil/phoenixproject/presentation/screen/RoutineEditorScreen.kt +++ b/shared/src/commonMain/kotlin/com/devil/phoenixproject/presentation/screen/RoutineEditorScreen.kt @@ -259,6 +259,7 @@ fun RoutineEditorScreen( state.exercises != snapshotExercises || state.supersets != snapshotSupersets ) + val canSaveRoutine = state.exercises.isNotEmpty() && state.routineName.isNotBlank() // Drag and Drop State val lazyListState = rememberLazyListState() @@ -504,18 +505,19 @@ fun RoutineEditorScreen( val routineToSave = if (base != null) { base.copy( id = finalRoutineId, - name = state.routineName.ifBlank { "Unnamed Routine" }, + name = state.routineName.trim(), supersets = base.supersets.map { it.copy(routineId = finalRoutineId) }, ) } else { Routine( id = finalRoutineId, - name = state.routineName.ifBlank { "Unnamed Routine" }, + name = state.routineName.trim(), ) } viewModel.saveRoutine(routineToSave) navController.popBackStack() }, + enabled = canSaveRoutine, ) { Text(stringResource(Res.string.action_save)) }