IceCubesApp/IceCubesApp/App/Tabs/Tabs.swift

59 lines
1.3 KiB
Swift
Raw Normal View History

2022-12-27 08:25:26 +00:00
import Foundation
import Status
import Account
import Explore
import SwiftUI
enum Tab: Int, Identifiable, Hashable {
case timeline, notifications, explore, messages, settings, other
2022-12-27 08:25:26 +00:00
var id: Int {
rawValue
}
static func loggedOutTab() -> [Tab] {
[.timeline, .settings]
}
static func loggedInTabs() -> [Tab] {
[.timeline, .notifications, .explore, .messages, .settings]
2022-12-27 08:25:26 +00:00
}
@ViewBuilder
func makeContentView(popToRootTab: Binding<Tab>) -> some View {
switch self {
case .timeline:
TimelineTab(popToRootTab: popToRootTab)
case .notifications:
NotificationsTab(popToRootTab: popToRootTab)
case .explore:
ExploreTab(popToRootTab: popToRootTab)
case .messages:
MessagesTab(popToRootTab: popToRootTab)
2022-12-27 08:25:26 +00:00
case .settings:
2023-01-10 05:58:50 +00:00
SettingsTabs(popToRootTab: popToRootTab)
2022-12-27 08:25:26 +00:00
case .other:
EmptyView()
}
}
@ViewBuilder
var label: some View {
switch self {
case .timeline:
Label("Timeline", systemImage: "rectangle.on.rectangle")
case .notifications:
Label("Notifications", systemImage: "bell")
case .explore:
Label("Explore", systemImage: "magnifyingglass")
case .messages:
Label("Messages", systemImage: "tray")
2022-12-27 08:25:26 +00:00
case .settings:
Label("Settings", systemImage: "gear")
case .other:
EmptyView()
}
}
}