diff --git a/RsyncUI/Views/InspectorViews/Add/AddTaskContentView.swift b/RsyncUI/Views/InspectorViews/Add/AddTaskContentView.swift deleted file mode 100644 index 9561493b..00000000 --- a/RsyncUI/Views/InspectorViews/Add/AddTaskContentView.swift +++ /dev/null @@ -1,34 +0,0 @@ -import SwiftUI - -struct AddTaskContentView: View { - @ViewBuilder let updateButton: UpdateButton - @ViewBuilder let trailingslash: TrailingSlash - @ViewBuilder let synchronizeID: SyncID - @ViewBuilder let catalogSectionView: CatalogSection - @ViewBuilder let remoteuserandserver: Remote - @ViewBuilder let snapshotView: Snapshot - @ViewBuilder let saveURLSection: SaveURL - - let showSnapshot: Bool - - var body: some View { - VStack(alignment: .leading, spacing: 12) { - HStack { - updateButton - trailingslash - } - - synchronizeID - catalogSectionView - - VStack(alignment: .leading) { remoteuserandserver } - - if showSnapshot { - VStack(alignment: .leading) { snapshotView } - } - - saveURLSection - } - .padding() - } -} diff --git a/RsyncUI/Views/InspectorViews/Add/AddTaskSectionHeader.swift b/RsyncUI/Views/InspectorViews/Add/AddTaskSectionHeader.swift deleted file mode 100644 index 39ee939f..00000000 --- a/RsyncUI/Views/InspectorViews/Add/AddTaskSectionHeader.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// AddTaskSectionHeader.swift -// RsyncUI -// -// Created by Codex on 11/05/2026. -// - -import SwiftUI - -struct AddTaskSectionHeader: View { - let title: String - - var body: some View { - Text(title.uppercased()) - .font(.caption) - .bold() - .foregroundStyle(.secondary) - .tracking(0.5) - .padding(.top, 4) - } -} diff --git a/RsyncUI/Views/InspectorViews/Add/AddTaskView.swift b/RsyncUI/Views/InspectorViews/Add/AddTaskView.swift index 07b30025..4b72abac 100644 --- a/RsyncUI/Views/InspectorViews/Add/AddTaskView.swift +++ b/RsyncUI/Views/InspectorViews/Add/AddTaskView.swift @@ -46,25 +46,39 @@ struct AddTaskView: View { @State var presentglobaltaskview: Bool = false + var showSnapshot: Bool { + selectedconfig?.task == SharedReference.shared.snapshot + } + var body: some View { - AddTaskContentView(updateButton: { updateButton }, - trailingslash: { trailingslash }, - synchronizeID: { synchronizeID }, - catalogSectionView: { catalogSectionView }, - remoteuserandserver: { remoteuserandserver }, - snapshotView: { snapshotnum }, - saveURLSection: { saveURLSection }, - showSnapshot: selectedconfig?.task == SharedReference.shared.snapshot) - .onAppear { handleSelectionChange() } - .onSubmit { handleSubmit() } - .onChange(of: rsyncUIdata.profile) { handleProfileChange() } - .onChange(of: selecteduuids) { handleSelectionChange() } - .onChange(of: showAddPopover) { _, isPresented in - if isPresented { - newdata.resetForm() - selectedconfig = nil - } + Form { + trailingslash + + synchronizeID + catalogSectionView + + remoteuserandserver + + if showSnapshot { + snapshotnum + } + + saveURLSection + + updateButton + } + .formStyle(.grouped) + .padding() + .onAppear { handleSelectionChange() } + .onSubmit { handleSubmit() } + .onChange(of: rsyncUIdata.profile) { handleProfileChange() } + .onChange(of: selecteduuids) { handleSelectionChange() } + .onChange(of: showAddPopover) { _, isPresented in + if isPresented { + newdata.resetForm() + selectedconfig = nil } - .sheet(isPresented: $showAddPopover) { addTaskSheetView } + } + .sheet(isPresented: $showAddPopover) { addTaskSheetView } } } diff --git a/RsyncUI/Views/InspectorViews/Add/OpencatalogView.swift b/RsyncUI/Views/InspectorViews/Add/OpencatalogView.swift index 94f11d16..ccbf500f 100644 --- a/RsyncUI/Views/InspectorViews/Add/OpencatalogView.swift +++ b/RsyncUI/Views/InspectorViews/Add/OpencatalogView.swift @@ -19,8 +19,6 @@ struct OpencatalogView: View { } label: { Label("Browse", systemImage: catalogs ? "folder" : "doc") .labelStyle(.iconOnly) - .font(.system(size: 12)) - .frame(width: 28, height: 22) } .buttonStyle(.bordered) .help("Browse...") diff --git a/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+FormFields.swift b/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+FormFields.swift index a19a7709..7d6bda42 100644 --- a/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+FormFields.swift +++ b/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+FormFields.swift @@ -11,13 +11,13 @@ import SwiftUI extension AddTaskView { var synchronizeID: some View { - Section(header: AddTaskSectionHeader(title: "Synchronize ID")) { + Section("Synchronize ID") { if newdata.selectedconfig == nil { - EditValueScheme(400, "Add synchronize ID", $newdata.backupID) + TextField("Synchronize ID", text: $newdata.backupID) .focused($focusField, equals: .synchronizeIDField) .textContentType(.none).submitLabel(.continue) } else { - EditValueScheme(400, nil, $newdata.backupID) + TextField("Synchronize ID", text: $newdata.backupID) .focused($focusField, equals: .synchronizeIDField) .textContentType(.none).submitLabel(.continue) .onAppear { if let id = newdata.selectedconfig?.backupID { newdata.backupID = id } } @@ -26,7 +26,7 @@ extension AddTaskView { } var snapshotnum: some View { - Section(header: Text("Snapshot Number").modifier(FixedTag(200, .leading))) { + Section("Snapshot Number") { EditValueScheme(400, nil, $newdata.snapshotnum) .focused($focusField, equals: .snapshotnumField) .textContentType(.none).submitLabel(.return) @@ -36,13 +36,13 @@ extension AddTaskView { } var localandremotecatalog: some View { - Section(header: AddTaskSectionHeader(title: "Folders")) { + Section("Folders") { catalogField(catalog: $newdata.localcatalog, - placeholder: "Add Source folder - required", + placeholder: "Source folder (required)", focus: .localcatalogField, selectedValue: newdata.selectedconfig?.localCatalog) catalogField(catalog: $newdata.remotecatalog, - placeholder: "Add Destination folder - required", + placeholder: "Destination folder (required)", focus: .remotecatalogField, selectedValue: newdata.selectedconfig?.offsiteCatalog, showErrorBorder: !newdata.localcatalog.isEmpty && newdata.remotecatalog.isEmpty || @@ -51,13 +51,13 @@ extension AddTaskView { } var localandremotecatalogsyncremote: some View { - Section(header: AddTaskSectionHeader(title: "Folders")) { + Section("Folders") { catalogField(catalog: $newdata.remotecatalog, - placeholder: "Add Source folder - required", + placeholder: "Source Folder (required)", focus: .remotecatalogField, selectedValue: newdata.selectedconfig?.offsiteCatalog) catalogField(catalog: $newdata.localcatalog, - placeholder: "Add Remote folder - required", + placeholder: "Remote Folder (required)", focus: .localcatalogField, selectedValue: newdata.selectedconfig?.localCatalog, showErrorBorder: !newdata.localcatalog.isEmpty && newdata.remotecatalog.isEmpty || @@ -70,12 +70,12 @@ extension AddTaskView { showErrorBorder: Bool = false) -> some View { HStack { if newdata.selectedconfig == nil { - EditValueScheme(400, placeholder, catalog) + TextField(placeholder, text: catalog) .focused($focusField, equals: focus) .textContentType(.none).submitLabel(.continue) .border(showErrorBorder ? Color.red : Color.clear, width: 2) } else { - EditValueScheme(400, nil, catalog) + TextField(placeholder, text: catalog) .focused($focusField, equals: focus) .textContentType(.none).submitLabel(.continue) .onAppear { if let value = selectedValue { catalog.wrappedValue = value } } @@ -86,17 +86,17 @@ extension AddTaskView { } var remoteuserandserver: some View { - Section(header: AddTaskSectionHeader(title: "Remote")) { + Section("Remote") { remoteField( value: $newdata.remoteuser, - placeholder: "Add remote user", + placeholder: "Remote user", focus: .remoteuserField, selectedValue: newdata.selectedconfig?.offsiteUsername, showErrorBorder: newdata.remoteuser.isEmpty && !newdata.remoteserver.isEmpty ) remoteField( value: $newdata.remoteserver, - placeholder: "Add remote server", + placeholder: "Remote server", focus: .remoteserverField, selectedValue: newdata.selectedconfig?.offsiteServer, submitLabel: .return, @@ -110,12 +110,12 @@ extension AddTaskView { showErrorBorder: Bool = false) -> some View { Group { if newdata.selectedconfig == nil { - EditValueScheme(400, placeholder, value) + TextField(placeholder, text: value) .focused($focusField, equals: focus) .textContentType(.none).submitLabel(submitLabel) .border(showErrorBorder ? Color.red : Color.clear, width: 2) } else { - EditValueScheme(400, nil, value) + TextField(placeholder, text: value) .focused($focusField, equals: focus) .textContentType(.none).submitLabel(submitLabel) .onAppear { if let val = selectedValue { value.wrappedValue = val } } @@ -128,7 +128,7 @@ extension AddTaskView { Picker("Trailing /", selection: $newdata.trailingslashoptions) { ForEach(TrailingSlash.allCases) { Text($0.description).tag($0) } } - .pickerStyle(DefaultPickerStyle()).frame(width: 180) + .pickerStyle(.menu) .onChange(of: newdata.trailingslashoptions) { UserDefaults.standard.set(newdata.trailingslashoptions.rawValue, forKey: "trailingslashoptions") } @@ -139,7 +139,7 @@ extension AddTaskView { Picker("Action", selection: $newdata.selectedrsynccommand) { ForEach(TypeofTask.allCases) { Text($0.description).tag($0) } } - .pickerStyle(DefaultPickerStyle()).frame(width: 180) + .pickerStyle(.menu) .onChange(of: newdata.selectedrsynccommand) { UserDefaults.standard.set(newdata.selectedrsynccommand.rawValue, forKey: "selectedrsynccommand") } diff --git a/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+ViewBuilders.swift b/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+ViewBuilders.swift index b1ff695f..3be354b6 100644 --- a/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+ViewBuilders.swift +++ b/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView+ViewBuilders.swift @@ -13,9 +13,9 @@ extension AddTaskView { var catalogSectionView: some View { Group { if newdata.selectedrsynccommand == .syncremote { - VStack(alignment: .leading) { localandremotecatalogsyncremote } + localandremotecatalogsyncremote } else { - VStack(alignment: .leading) { localandremotecatalog } + localandremotecatalog .disabled(selectedconfig?.task == SharedReference.shared.snapshot) } } @@ -26,17 +26,14 @@ extension AddTaskView { Text("Add Task") .font(.title2) - VStack(alignment: .leading, spacing: 12) { - - HStack { - pickerselecttypeoftask - trailingslash - } - + Form { + pickerselecttypeoftask + trailingslash synchronizeID catalogSectionView remoteuserandserver } + .formStyle(.grouped) } .padding() .frame(minWidth: 600) diff --git a/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView.swift b/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView.swift index 468fd133..55392c51 100644 --- a/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView.swift +++ b/RsyncUI/Views/InspectorViews/Add/extensionAddTaskView.swift @@ -40,25 +40,24 @@ extension AddTaskView { extension AddTaskView { var updateButton: some View { - ConditionalGlassButton(systemImage: "arrow.down", text: "Update", helpText: "Update task") { + Button("Update", systemImage: "arrow.down") { Task { @MainActor in _ = await validateAndUpdate() } } + .help("Update task") } var saveURLSection: some View { - Section(header: Text("Show save URL").font(.title3).fontWeight(.bold)) { - HStack { - Toggle("", isOn: $newdata.showsaveurls).toggleStyle(.switch) - if newdata.showsaveurls { - ConditionalGlassButton(systemImage: "square.and.arrow.down", - text: "URL Estimate", - helpText: "URL Estimate & Synchronize") { - let data = WidgetURLstrings(urletimate: stringestimate) - Task { @MainActor in - await WriteWidgetsURLStringsJSON.write(data) - } + Group { + Toggle("Show save URL", isOn: $newdata.showsaveurls).toggleStyle(.switch) + if newdata.showsaveurls { + ConditionalGlassButton(systemImage: "square.and.arrow.down", + text: "URL Estimate", + helpText: "URL Estimate & Synchronize") { + let data = WidgetURLstrings(urletimate: stringestimate) + Task { @MainActor in + await WriteWidgetsURLStringsJSON.write(data) } } }