diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/Components/FeedCardNavigationLink.swift b/apple/OmnivoreKit/Sources/App/Views/Home/Components/FeedCardNavigationLink.swift index a19c9936d..15c55a6fb 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/Components/FeedCardNavigationLink.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/Components/FeedCardNavigationLink.swift @@ -74,15 +74,6 @@ struct GridCardNavigationLink: View { @ObservedObject var viewModel: HomeFeedViewModel - func tapAction() { - scale = 0.95 - DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(150)) { - scale = 1.0 - viewModel.selectedItem = item - viewModel.linkIsActive = true - } - } - var body: some View { ZStack { Button { diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index ae91e5150..2e469a697 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -628,6 +628,61 @@ struct AnimatingCellHeight: AnimatableModifier { Task { await viewModel.loadItems(dataService: dataService, isRefresh: isRefresh) } } + var filtersHeader: some View { + GeometryReader { reader in + ScrollView(.horizontal, showsIndicators: false) { + HStack { + if viewModel.searchTerm.count > 0 { + TextChipButton.makeSearchFilterButton(title: viewModel.searchTerm) { + viewModel.searchTerm = "" + }.frame(maxWidth: reader.size.width * 0.66) + } else { + Menu( + content: { + ForEach(LinkedItemFilter.allCases, id: \.self) { filter in + Button(filter.displayName, action: { viewModel.appliedFilter = filter.rawValue }) + } + }, + label: { + TextChipButton.makeMenuButton( + title: LinkedItemFilter(rawValue: viewModel.appliedFilter)?.displayName ?? "Filter" + ) + } + ) + } + Menu( + content: { + ForEach(LinkedItemSort.allCases, id: \.self) { sort in + Button(sort.displayName, action: { viewModel.appliedSort = sort.rawValue }) + } + }, + label: { + TextChipButton.makeMenuButton( + title: LinkedItemSort(rawValue: viewModel.appliedSort)?.displayName ?? "Sort" + ) + } + ) + TextChipButton.makeAddLabelButton { + viewModel.showLabelsSheet = true + } + ForEach(viewModel.selectedLabels, id: \.self) { label in + TextChipButton.makeRemovableLabelButton(feedItemLabel: label, negated: false) { + viewModel.selectedLabels.removeAll { $0.id == label.id } + } + } + ForEach(viewModel.negatedLabels, id: \.self) { label in + TextChipButton.makeRemovableLabelButton(feedItemLabel: label, negated: true) { + viewModel.negatedLabels.removeAll { $0.id == label.id } + } + } + Spacer() + } + .padding(0) + } + .listRowSeparator(.hidden) + } + } + var body: some View { ZStack { ScrollView { @@ -638,7 +693,11 @@ struct AnimatingCellHeight: AnimatableModifier { EmptyView() } - LazyVGrid(columns: [GridItem(.adaptive(minimum: 325), spacing: 16)], spacing: 16) { + filtersHeader + .padding(.leading, 16) + .padding(.bottom, 25) + + LazyVGrid(columns: [GridItem(.adaptive(minimum: 325), spacing: 16)], alignment: .leading, spacing: 16) { ForEach(viewModel.items) { item in GridCardNavigationLink( item: item, @@ -647,7 +706,9 @@ struct AnimatingCellHeight: AnimatableModifier { viewModel: viewModel ) } + Spacer() } + .frame(maxHeight: .infinity) .padding() .background( GeometryReader {