IceCubes/IceCubesApp/App/Tabs/TimelineTab.swift
2022-12-24 11:50:05 +01:00

37 lines
982 B
Swift

import SwiftUI
import Timeline
import Env
import Network
import Combine
struct TimelineTab: View {
@EnvironmentObject private var client: Client
@StateObject private var routeurPath = RouterPath()
@Binding var popToRootTab: IceCubesApp.Tab
var body: some View {
NavigationStack(path: $routeurPath.path) {
TimelineView()
.withAppRouteur()
.withSheetDestinations(sheetDestinations: $routeurPath.presentedSheet)
.toolbar {
if client.isAuth {
ToolbarItem(placement: .navigationBarLeading) {
Button {
routeurPath.presentedSheet = .statusEditor(replyToStatus: nil)
} label: {
Image(systemName: "square.and.pencil")
}
}
}
}
}
.environmentObject(routeurPath)
.onChange(of: $popToRootTab.wrappedValue) { popToRootTab in
if popToRootTab == .timeline {
routeurPath.path = []
}
}
}
}