UI bug fixes (regarding recipe servings adjustment)

This commit is contained in:
VincentMeilinger
2024-03-22 14:31:45 +01:00
parent 7b59c79222
commit d201690332
7 changed files with 16 additions and 45 deletions

View File

@@ -68,7 +68,7 @@ class ObservableRecipeDetail: ObservableObject {
recipeInstructions = recipeDetail.recipeInstructions
nutrition = recipeDetail.nutrition
ingredientMultiplier = Double(recipeDetail.recipeYield)
ingredientMultiplier = Double(recipeDetail.recipeYield == 0 ? 1 : recipeDetail.recipeYield)
}
func toRecipeDetail() -> RecipeDetail {

View File

@@ -354,12 +354,6 @@
}
}
}
},
"1,42 (Comma)" : {
},
"1.42 (Point)" : {
},
"A recipe with that name already exists." : {
"localizations" : {
@@ -846,6 +840,9 @@
},
"cl" : {
},
"Comma (e.g. 1,42)" : {
},
"Configure what is stored on your device." : {
"localizations" : {
@@ -1103,9 +1100,6 @@
},
"Decimal number format" : {
},
"Decimal Separator" : {
},
"Delete" : {
"localizations" : {
@@ -2222,6 +2216,9 @@
}
}
}
},
"Marked ingredients could not be adjusted!" : {
},
"mg" : {
@@ -2764,6 +2761,9 @@
}
}
}
},
"Point (e.g. 1.42)" : {
},
"pound" : {
@@ -3885,9 +3885,6 @@
},
"tsp" : {
},
"Unable to adjust some ingredients!" : {
},
"Unable to complete action." : {
"localizations" : {

View File

@@ -67,10 +67,10 @@ struct RecipeIngredientSection: View {
if viewModel.observableRecipeDetail.ingredientMultiplier != Double(viewModel.observableRecipeDetail.recipeYield) {
HStack() {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundStyle(.red)
Text("Unable to adjust some ingredients!")
.foregroundStyle(.secondary)
}
Text("Marked ingredients could not be adjusted!")
.foregroundStyle(.secondary)
}.padding(.top)
}
if viewModel.editMode {

View File

@@ -80,9 +80,9 @@ struct SettingsView: View {
HStack {
Text("Decimal number format")
Spacer()
Picker("Decimal Separator", selection: $userSettings.decimalNumberSeparator) {
Text("1.42 (Point)").tag(".")
Text("1,42 (Comma)").tag(",")
Picker("", selection: $userSettings.decimalNumberSeparator) {
Text("Point (e.g. 1.42)").tag(".")
Text("Comma (e.g. 1,42)").tag(",")
}
.pickerStyle(.menu)
}