Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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))
}
Expand Down
Loading