diff --git a/apple/OmnivoreKit/Sources/App/PrimaryContentCategory.swift b/apple/OmnivoreKit/Sources/App/PrimaryContentCategory.swift index 1a8466bb0..6f9a8e93f 100644 --- a/apple/OmnivoreKit/Sources/App/PrimaryContentCategory.swift +++ b/apple/OmnivoreKit/Sources/App/PrimaryContentCategory.swift @@ -35,11 +35,10 @@ enum PrimaryContentCategory: Identifiable, Hashable, Equatable { Label { Text(title) } icon: { image.renderingMode(.template) } } - @ViewBuilder var destinationView: some View { + @MainActor @ViewBuilder var destinationView: some View { switch self { case .feed: - // HomeView(viewModel: HomeFeedViewModel()) - EmptyView() + LibraryListView() case .profile: ProfileView() } diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/LibraryListView.swift b/apple/OmnivoreKit/Sources/App/Views/Home/LibraryListView.swift new file mode 100644 index 000000000..6cd4a743b --- /dev/null +++ b/apple/OmnivoreKit/Sources/App/Views/Home/LibraryListView.swift @@ -0,0 +1,60 @@ +// +// File.swift +// +// +// Created by Jackson Harper on 6/29/23. +// + +import Foundation +import Models +import SwiftUI + +struct LibraryListView: View { + @StateObject private var subViewModel = HomeFeedViewModel( + listConfig: LibraryListConfig( + hasFeatureCards: false, + leadingSwipeActions: [.moveToInbox], + trailingSwipeActions: [.delete, .archive], + cardStyle: .library + ) + ) + + @StateObject private var libraryViewModel = HomeFeedViewModel( + listConfig: LibraryListConfig( + hasFeatureCards: true, + leadingSwipeActions: [.pin], + trailingSwipeActions: [.delete, .archive], + cardStyle: .library + ) + ) + + @StateObject private var highlightsViewModel = HomeFeedViewModel( + listConfig: LibraryListConfig( + hasFeatureCards: true, + leadingSwipeActions: [.pin], + trailingSwipeActions: [.delete, .archive], + cardStyle: .highlights + ) + ) + + var body: some View { + ZStack { + NavigationLink( + destination: LinkDestination(selectedItem: libraryViewModel.selectedItem), + isActive: $libraryViewModel.linkIsActive + ) { + EmptyView() + } + HomeView(viewModel: libraryViewModel) + .tabItem { + Label { + Text("Library") + } icon: { + Image.tabLibrary + } + } + } + .navigationViewStyle(.stack) + .navigationBarTitleDisplayMode(.inline) + } +} diff --git a/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift b/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift index 852042117..06b49d5ac 100644 --- a/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/LibraryTabView.swift @@ -75,5 +75,6 @@ struct LibraryTabView: View { } } .navigationViewStyle(.stack) + .navigationBarTitleDisplayMode(.inline) } } diff --git a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift index 5749fcb25..d0dcdb5fa 100644 --- a/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/PrimaryContentView.swift @@ -3,7 +3,7 @@ import Services import SwiftUI import Views -public struct PrimaryContentView: View { +@MainActor public struct PrimaryContentView: View { let categories = [ PrimaryContentCategory.feed, PrimaryContentCategory.profile @@ -52,7 +52,7 @@ public struct PrimaryContentView: View { #endif } -struct PrimaryContentSidebar: View { +@MainActor struct PrimaryContentSidebar: View { @State private var selectedCategory: PrimaryContentCategory? let categories: [PrimaryContentCategory]