diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift index c4dac6a0b..3477dd7aa 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/LabelsView.swift @@ -11,17 +11,24 @@ struct LabelsView: View { @State private var labelToRemove: LinkedItemLabel? var body: some View { - Group { - #if os(iOS) - Form { - innerBody + List { + ForEach(viewModel.labels, id: \.id) { label in + HStack { + TextChip(feedItemLabel: label).allowsHitTesting(false) + Spacer() + Button( + action: { + labelToRemove = label + showDeleteConfirmation = true + }, + label: { Image(systemName: "trash") } + ) } - #elseif os(macOS) - List { - innerBody - } - #endif + } + createLabelButton } + .listStyle(PlainListStyle()) + .navigationTitle(LocalText.labelsGeneric) .alert("Are you sure you want to delete this label?", isPresented: $showDeleteConfirmation) { Button("Delete Label", role: .destructive) { if let label = labelToRemove { @@ -43,41 +50,26 @@ struct LabelsView: View { .task { await viewModel.loadLabels(dataService: dataService, item: nil) } } - private var innerBody: some View { - Group { - Section(footer: Text(LocalText.labelsPurposeDescription)) { - Button( - action: { viewModel.showCreateLabelModal = true }, - label: { - HStack { - Image(systemName: "plus.circle.fill").foregroundColor(.green) - Text(LocalText.createLabelMessage).foregroundColor(.appGrayTextContrast) - Spacer() - } - } - ) - .disabled(viewModel.isLoading) - } - - if !viewModel.labels.isEmpty { - Section(header: Text(LocalText.labelsGeneric)) { - ForEach(viewModel.labels, id: \.id) { label in - HStack { - TextChip(feedItemLabel: label).allowsHitTesting(false) - Spacer() - Button( - action: { - labelToRemove = label - showDeleteConfirmation = true - }, - label: { Image(systemName: "trash") } - ) - } - } + var createLabelButton: some View { + Button( + action: { viewModel.showCreateLabelModal = true }, + label: { + HStack { + Image(systemName: "tag").foregroundColor(.blue) + Text( + viewModel.labelSearchFilter.count > 0 ? + "Create: \"\(viewModel.labelSearchFilter)\" label" : + LocalText.createLabelMessage + ).foregroundColor(.blue) + .font(Font.system(size: 14)) + Spacer() } } - } - .navigationTitle(LocalText.labelsGeneric) + ) + .buttonStyle(PlainButtonStyle()) + .disabled(viewModel.isLoading) + .listRowSeparator(.hidden, edges: .bottom) + .padding(.vertical, 10) } }