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>
61 lines
1.4 KiB
Swift
61 lines
1.4 KiB
Swift
//
|
|
// RecipeToolSection.swift
|
|
// Nextcloud Cookbook iOS Client
|
|
//
|
|
// Created by Vincent Meilinger on 01.03.24.
|
|
//
|
|
|
|
import Foundation
|
|
import SwiftUI
|
|
|
|
// MARK: - RecipeView Tool Section
|
|
|
|
struct RecipeToolSection: View {
|
|
@ObservedObject var viewModel: RecipeView.ViewModel
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading) {
|
|
HStack {
|
|
SecondaryLabel(text: "Tools")
|
|
Spacer()
|
|
}
|
|
|
|
RecipeListSection(list: $viewModel.observableRecipeDetail.tool)
|
|
}.padding()
|
|
}
|
|
|
|
|
|
}
|
|
|
|
// MARK: - Recipe Edit Tool Section (Form-based)
|
|
|
|
struct RecipeEditToolSection: View {
|
|
@Binding var tools: [String]
|
|
|
|
var body: some View {
|
|
Section {
|
|
ForEach(tools.indices, id: \.self) { index in
|
|
HStack {
|
|
TextField("Tool", text: $tools[index])
|
|
Image(systemName: "line.3.horizontal")
|
|
.foregroundStyle(.tertiary)
|
|
}
|
|
}
|
|
.onDelete { indexSet in
|
|
tools.remove(atOffsets: indexSet)
|
|
}
|
|
.onMove { from, to in
|
|
tools.move(fromOffsets: from, toOffset: to)
|
|
}
|
|
|
|
Button {
|
|
tools.append("")
|
|
} label: {
|
|
Label("Add Tool", systemImage: "plus.circle.fill")
|
|
}
|
|
} header: {
|
|
Text("Tools")
|
|
}
|
|
}
|
|
}
|