Redesign recipe creation and edit view with Form-based layout and URL import
Replace the single "+" button with a 2-option menu (Create New Recipe / Import from URL) across RecipeTabView, RecipeListView, and AllRecipesListView. Add ImportURLSheet for server-side recipe import with loading and error states. Completely redesign edit mode to use a native Form layout with inline editing for all sections (metadata, duration, ingredients, instructions, tools, nutrition) instead of the previous sheet-based EditableListView approach. Move delete action from edit toolbar to view mode context menu. Add recipe image display to the edit form. Refactor RecipeListView and AllRecipesListView to use closure-based callbacks instead of Binding<Bool> for the create/import actions. Add preloadedRecipeDetail support to RecipeView.ViewModel for imported recipes. Add DE/ES/FR translations for all new UI strings. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,8 @@ struct RecipeListView: View {
|
||||
@EnvironmentObject var groceryList: GroceryListManager
|
||||
@State var categoryName: String
|
||||
@State var searchText: String = ""
|
||||
@Binding var showEditView: Bool
|
||||
var onCreateNew: () -> Void
|
||||
var onImportFromURL: () -> Void
|
||||
@State var selectedRecipe: Recipe? = nil
|
||||
|
||||
private let gridColumns = [GridItem(.adaptive(minimum: 160), spacing: 12)]
|
||||
@@ -80,8 +81,17 @@ struct RecipeListView: View {
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button {
|
||||
showEditView = true
|
||||
Menu {
|
||||
Button {
|
||||
onCreateNew()
|
||||
} label: {
|
||||
Label("Create New Recipe", systemImage: "square.and.pencil")
|
||||
}
|
||||
Button {
|
||||
onImportFromURL()
|
||||
} label: {
|
||||
Label("Import from URL", systemImage: "link")
|
||||
}
|
||||
} label: {
|
||||
Image(systemName: "plus.circle.fill")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user