From cf82f05a931c48ac571759bc054caebdbf4b181c Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Wed, 5 Jul 2023 14:41:02 -0700 Subject: [PATCH] Improve layout of the feature card block --- .../App/Views/Home/HomeFeedViewIOS.swift | 85 +++++++++++-------- .../Sources/App/Views/LibraryTabView.swift | 18 ++-- .../App/Views/LinkItemDetailView.swift | 5 +- .../thLibrarySeparator.colorset/Contents.json | 38 +++++++++ 4 files changed, 96 insertions(+), 50 deletions(-) create mode 100644 apple/OmnivoreKit/Sources/Views/Colors/Colors.xcassets/thLibrarySeparator.colorset/Contents.json diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index b891df777..b88006d12 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -98,8 +98,8 @@ struct AnimatingCellHeight: AnimatableModifier { let title = (LinkedItemFilter(rawValue: viewModel.appliedFilter) ?? LinkedItemFilter.inbox).displayName Text(title) .font(Font.system(size: 18, weight: .semibold)) - Image(systemName: "chevron.down") - .font(Font.system(size: 13, weight: .regular)) +// Image(systemName: "chevron.down") +// .font(Font.system(size: 13, weight: .regular)) }.frame(maxWidth: .infinity, alignment: .leading) }) } @@ -361,38 +361,45 @@ struct AnimatingCellHeight: AnimatableModifier { var featureCard: some View { VStack { + Color.thBorderColor.frame(maxWidth: .infinity, maxHeight: 0.5) + VStack(alignment: .leading, spacing: 15) { - Menu(content: { - Button(action: { - viewModel.updateFeatureFilter(dataService: dataService, filter: .continueReading) + HStack { + Menu(content: { + Button(action: { + viewModel.updateFeatureFilter(dataService: dataService, filter: .continueReading) + }, label: { + Text("Continue Reading") + }) + Button(action: { + viewModel.updateFeatureFilter(dataService: dataService, filter: .pinned) + }, label: { + Text("Pinned") + }) + Button(action: { + viewModel.updateFeatureFilter(dataService: dataService, filter: .newsletters) + }, label: { + Text("Newsletters") + }) + Button(action: { + showHideFeatureAlert = true + }, label: { + Text("Hide this Section") + }) }, label: { - Text("Continue Reading") - }) - Button(action: { - viewModel.updateFeatureFilter(dataService: dataService, filter: .pinned) - }, label: { - Text("Pinned") - }) - Button(action: { - viewModel.updateFeatureFilter(dataService: dataService, filter: .newsletters) - }, label: { - Text("Newsletters") - }) - Button(action: { - showHideFeatureAlert = true - }, label: { - Text("Hide this Section") - }) - }, label: { - HStack(alignment: .center) { - Text((FeaturedItemFilter(rawValue: viewModel.featureFilter) ?? .continueReading).title) - .font(Font.system(size: 13, weight: .medium)) - Image(systemName: "chevron.down") - .font(Font.system(size: 13, weight: .regular)) - }.frame(maxWidth: .infinity, alignment: .leading) + HStack(alignment: .center) { + Text((FeaturedItemFilter(rawValue: viewModel.featureFilter) ?? .continueReading).title) + .font(Font.system(size: 13, weight: .medium)) + Image(systemName: "chevron.down") + .font(Font.system(size: 13, weight: .regular)) + } .tint(Color(hex: "#007AFF")) - }) - .padding(.top, 15) + .frame(maxWidth: .infinity, alignment: .leading) + }) + Spacer() + } + .padding(.top, 10) + .padding(.horizontal, 15) GeometryReader { geo in ScrollView(.horizontal, showsIndicators: false) { @@ -412,13 +419,11 @@ struct AnimatingCellHeight: AnimatableModifier { .fixedSize(horizontal: false, vertical: true) } } - } + }.padding(.horizontal, 15) + Color.thBorderColor.frame(maxWidth: .infinity, maxHeight: 0.5) } - .padding(.horizontal, 20) - - Color.thFeatureSeparator - .frame(maxWidth: .infinity, maxHeight: 10) } + .background(Color.systemGray6) } var body: some View { @@ -430,14 +435,20 @@ struct AnimatingCellHeight: AnimatableModifier { } List { + filtersHeader + .listRowSeparator(.hidden, edges: .all) + .listRowInsets(.init(top: 0, leading: 10, bottom: 0, trailing: 10)) + if viewModel.listConfig.hasFeatureCards, !viewModel.hideFeatureSection, viewModel.items.count > 0, - viewModel.searchTerm.isEmpty, viewModel.selectedLabels.isEmpty, + viewModel.searchTerm.isEmpty, + viewModel.selectedLabels.isEmpty, viewModel.negatedLabels.isEmpty { featureCard .listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0)) + .listRowSeparator(.hidden, edges: .all) .modifier(AnimatingCellHeight(height: viewModel.featureItems.count > 0 ? 200 : 130)) } diff --git a/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift b/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift index 08347b872..530b8c25a 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift @@ -47,14 +47,14 @@ struct LibraryTabView: View { EmptyView() } TabView { - HomeView(viewModel: subViewModel) - .tabItem { - Label { - Text("Subscriptions") - } icon: { - Image.tabSubscriptions - } - } +// HomeView(viewModel: subViewModel) +// .tabItem { +// Label { +// Text("Subscriptions") +// } icon: { +// Image.tabSubscriptions +// } +// } HomeView(viewModel: libraryViewModel) .tabItem { Label { @@ -71,7 +71,7 @@ struct LibraryTabView: View { Image.tabHighlights } } - } + }.ignoresSafeArea() } } .navigationViewStyle(.stack) diff --git a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift index 888650c02..4237d1e0c 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LinkItemDetailView.swift @@ -112,10 +112,7 @@ struct LinkItemDetailView: View { if isPDF { pdfContainerView } else if let item = viewModel.item { - GeometryReader { geo in - let foo = print("READER", geo.size) - WebReaderContainerView(item: item) - } + WebReaderContainerView(item: item) } } .task { diff --git a/apple/OmnivoreKit/Sources/Views/Colors/Colors.xcassets/thLibrarySeparator.colorset/Contents.json b/apple/OmnivoreKit/Sources/Views/Colors/Colors.xcassets/thLibrarySeparator.colorset/Contents.json new file mode 100644 index 000000000..fb0d6b4ba --- /dev/null +++ b/apple/OmnivoreKit/Sources/Views/Colors/Colors.xcassets/thLibrarySeparator.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xEB", + "green" : "0xEB", + "red" : "0xEB" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x2A", + "green" : "0x2A", + "red" : "0x2A" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +}