Code cleanup

This commit is contained in:
VincentMeilinger
2024-02-03 17:51:51 +01:00
parent d1d498cf2d
commit a6bd25ce3b
11 changed files with 163 additions and 60 deletions

View File

@@ -15,22 +15,33 @@ struct CategoryDetailView: View {
@State var searchText: String = ""
@ObservedObject var viewModel: AppState
@Binding var showEditView: Bool
@State var selectedRecipe: Recipe? = nil
@State var presentRecipeView: Bool = false
var body: some View {
ScrollView(showsIndicators: false) {
LazyVStack {
ForEach(recipesFiltered(), id: \.recipe_id) { recipe in
NavigationLink(value: recipe) {
//NavigationLink(value: recipe) {
RecipeCardView(viewModel: viewModel, recipe: recipe)
.shadow(radius: 2)
//}
//.buttonStyle(.plain)
.onTapGesture {
selectedRecipe = recipe
presentRecipeView = true
}
.buttonStyle(.plain)
}
}
}
.fullScreenCover(isPresented: $presentRecipeView) {
RecipeDetailView(viewModel: viewModel, recipe: selectedRecipe!)
}
/*
.navigationDestination(for: Recipe.self) { recipe in
RecipeDetailView(viewModel: viewModel, recipe: recipe)
}
}*/
.navigationTitle(categoryName == "*" ? String(localized: "Other") : categoryName)
.toolbar {
ToolbarItem(placement: .topBarTrailing) {