1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +05:30
yattee/Shared/Navigation/AppTabNavigation.swift

70 lines
2.1 KiB
Swift
Raw Normal View History

2021-07-12 02:22:49 +05:30
import Defaults
import SwiftUI
struct AppTabNavigation: View {
@EnvironmentObject<NavigationState> private var navigationState
2021-07-12 02:22:49 +05:30
var body: some View {
TabView(selection: $navigationState.tabSelection) {
2021-07-12 02:22:49 +05:30
NavigationView {
SubscriptionsView()
}
.tabItem {
2021-08-26 03:42:59 +05:30
Label("Subscriptions", systemImage: "star.circle.fill")
2021-07-12 02:22:49 +05:30
.accessibility(label: Text("Subscriptions"))
}
.tag(TabSelection.subscriptions)
NavigationView {
2021-07-28 04:10:04 +05:30
PopularView()
2021-07-12 02:22:49 +05:30
}
.tabItem {
Label("Popular", systemImage: "chart.bar")
.accessibility(label: Text("Popular"))
}
.tag(TabSelection.popular)
NavigationView {
TrendingView()
}
.tabItem {
Label("Trending", systemImage: "chart.line.uptrend.xyaxis")
.accessibility(label: Text("Trending"))
}
.tag(TabSelection.trending)
NavigationView {
PlaylistsView()
}
.tabItem {
Label("Playlists", systemImage: "list.and.film")
.accessibility(label: Text("Playlists"))
}
.tag(TabSelection.playlists)
NavigationView {
SearchView()
}
.tabItem {
Label("Search", systemImage: "magnifyingglass")
.accessibility(label: Text("Search"))
}
.tag(TabSelection.search)
}
.sheet(isPresented: $navigationState.isChannelOpen, onDismiss: {
navigationState.closeChannel(presentedChannel)
}) {
if presentedChannel != nil {
NavigationView {
ChannelVideosView(presentedChannel)
.environment(\.inNavigationView, true)
}
}
}
}
fileprivate var presentedChannel: Channel! {
navigationState.openChannels.first
2021-07-12 02:22:49 +05:30
}
}