2022-12-27 09:25:26 +01:00
|
|
|
import Foundation
|
|
|
|
import Status
|
|
|
|
import Account
|
|
|
|
import Explore
|
|
|
|
import SwiftUI
|
|
|
|
|
2023-01-04 12:50:57 +01:00
|
|
|
enum Tab: Int, Identifiable, Hashable {
|
2023-01-05 12:21:54 +01:00
|
|
|
case timeline, notifications, explore, messages, settings, other
|
2022-12-27 09:25:26 +01:00
|
|
|
|
|
|
|
var id: Int {
|
|
|
|
rawValue
|
|
|
|
}
|
|
|
|
|
|
|
|
static func loggedOutTab() -> [Tab] {
|
|
|
|
[.timeline, .settings]
|
|
|
|
}
|
|
|
|
|
|
|
|
static func loggedInTabs() -> [Tab] {
|
2023-01-05 12:21:54 +01:00
|
|
|
[.timeline, .notifications, .explore, .messages, .settings]
|
2022-12-27 09:25:26 +01: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)
|
2023-01-05 12:21:54 +01:00
|
|
|
case .messages:
|
|
|
|
MessagesTab(popToRootTab: popToRootTab)
|
2022-12-27 09:25:26 +01:00
|
|
|
case .settings:
|
|
|
|
SettingsTabs()
|
|
|
|
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")
|
2023-01-05 12:21:54 +01:00
|
|
|
case .messages:
|
|
|
|
Label("Messages", systemImage: "tray")
|
2022-12-27 09:25:26 +01:00
|
|
|
case .settings:
|
|
|
|
Label("Settings", systemImage: "gear")
|
|
|
|
case .other:
|
|
|
|
EmptyView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|