diff --git a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/EditLabelsSheet.swift b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/EditLabelsSheet.swift index b8291b19a..efd5b5386 100644 --- a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/EditLabelsSheet.swift +++ b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/EditLabelsSheet.swift @@ -98,7 +98,9 @@ public struct EditLabelsSheet: View { } .listStyle(.plain) .background(Color.extensionBackground) - } + + Spacer() + }.frame(maxHeight: .infinity) } public var body: some View { diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift index de10e2f03..409955170 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/ApplyLabelsView.swift @@ -64,49 +64,60 @@ struct ApplyLabelsView: View { } List { - Section { - ForEach(viewModel.labels.applySearchFilter(viewModel.labelSearchFilter), id: \.self) { label in - Button( - action: { - if isSelected(label) { - if let idx = viewModel.selectedLabels.firstIndex(of: label) { - viewModel.selectedLabels.remove(at: idx) - } - } else { - viewModel.labelSearchFilter = ZWSP - viewModel.selectedLabels.append(label) + ForEach(viewModel.labels.applySearchFilter(viewModel.labelSearchFilter), id: \.self) { label in + Button( + action: { + if isSelected(label) { + if let idx = viewModel.selectedLabels.firstIndex(of: label) { + viewModel.selectedLabels.remove(at: idx) } - }, - label: { - HStack { - TextChip(feedItemLabel: label).allowsHitTesting(false) - Spacer() - if isSelected(label) { - Image(systemName: "checkmark") - } - } - .contentShape(Rectangle()) + } else { + viewModel.labelSearchFilter = ZWSP + viewModel.selectedLabels.append(label) } - ) - .padding(.vertical, 5) - .frame(maxWidth: .infinity, alignment: .leading) - #if os(macOS) - .buttonStyle(PlainButtonStyle()) - #endif - } + }, + label: { + HStack { + TextChip(feedItemLabel: label).allowsHitTesting(false) + Spacer() + if isSelected(label) { + Image(systemName: "checkmark") + } + } + .contentShape(Rectangle()) + } + ) + .padding(.vertical, 5) + .frame(maxWidth: .infinity, alignment: .leading) + #if os(macOS) + .buttonStyle(PlainButtonStyle()) + #endif + } + if !viewModel.labelSearchFilter.isEmpty, viewModel.labelSearchFilter != ZWSP { createLabelButton } } .listStyle(.plain) .background(Color.extensionBackground) - - Spacer() + .frame(maxHeight: .infinity) } .navigationTitle(mode.navTitle) .background(Color.extensionBackground) .sheet(isPresented: $viewModel.showCreateLabelModal) { CreateLabelView(viewModel: viewModel, newLabelName: viewModel.labelSearchFilter) } + .onAppear { + Task { + switch mode { + case let .item(feedItem): + await viewModel.loadLabels(dataService: dataService, item: feedItem) + case let .highlight(highlight): + await viewModel.loadLabels(dataService: dataService, highlight: highlight) + case let .list(labels): + await viewModel.loadLabels(dataService: dataService, initiallySelectedLabels: labels) + } + } + } } var createLabelButton: some View { @@ -160,43 +171,29 @@ struct ApplyLabelsView: View { } var body: some View { - Group { - #if os(iOS) - NavigationView { - innerBody - .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItem(placement: .navigationBarLeading) { - cancelButton - } - ToolbarItem(placement: .navigationBarTrailing) { - saveItemChangesButton - } - } - } - #elseif os(macOS) + #if os(iOS) + NavigationView { innerBody + .navigationBarTitleDisplayMode(.inline) .toolbar { - ToolbarItemGroup { + ToolbarItem(placement: .navigationBarLeading) { cancelButton + } + ToolbarItem(placement: .navigationBarTrailing) { saveItemChangesButton } } - .frame(minWidth: 400, minHeight: 600) - #endif - } - .onAppear { - Task { - switch mode { - case let .item(feedItem): - await viewModel.loadLabels(dataService: dataService, item: feedItem) - case let .highlight(highlight): - await viewModel.loadLabels(dataService: dataService, highlight: highlight) - case let .list(labels): - await viewModel.loadLabels(dataService: dataService, initiallySelectedLabels: labels) - } } - } + #elseif os(macOS) + innerBody + .toolbar { + ToolbarItemGroup { + cancelButton + saveItemChangesButton + } + } + .frame(minWidth: 400, minHeight: 600) + #endif } } diff --git a/apple/OmnivoreKit/Sources/App/Views/LabelsEntryView.swift b/apple/OmnivoreKit/Sources/App/Views/LabelsEntryView.swift index 094ecb559..f9516288b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LabelsEntryView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LabelsEntryView.swift @@ -126,6 +126,8 @@ public struct LabelsEntryView: View { .frame(width: textWidth) .padding(.trailing, 5) .padding(.vertical, 5) + .padding(EdgeInsets(top: 0, leading: 6, bottom: 0, trailing: 6)) + .cornerRadius(5) .accentColor(.blue) .font(Font.system(size: 14)) .multilineTextAlignment(.leading) @@ -162,8 +164,7 @@ public struct LabelsEntryView: View { } #endif } - .submitScope() - ) + .submitScope()) #if os(macOS) if #available(macOS 14.0, *) { @@ -187,23 +188,21 @@ public struct LabelsEntryView: View { } public var body: some View { - Form { - VStack { - GeometryReader { geometry in - self.generateLabelsContent(in: geometry) - } - }.padding(0) - .frame(height: totalHeight) - .background(Color.extensionPanelBackground) - .cornerRadius(8) - .onAppear { - textFieldFocused = true - } - .onTapGesture { - textFieldFocused = true - } - .onChange(of: textFieldFocused) { self.isFocused = $0 } - } + VStack { + GeometryReader { geometry in + self.generateLabelsContent(in: geometry) + } + }.padding(0) + .frame(height: totalHeight) + .background(Color.extensionPanelBackground) + .cornerRadius(8) + .onAppear { + textFieldFocused = true + } + .onTapGesture { + textFieldFocused = true + } + .onChange(of: textFieldFocused) { self.isFocused = $0 } } var partialMatches: [LinkedItemLabel] {