Remove items from secondary navigation when browsing

This commit is contained in:
Justin Mazzocchi 2021-01-31 06:25:31 -08:00
parent b0132640ab
commit 15cc811102
No known key found for this signature in database
GPG Key ID: E223E6937AAFB01C
1 changed files with 28 additions and 26 deletions

View File

@ -29,35 +29,37 @@ struct SecondaryNavigationView: View {
Label("secondary-navigation.accounts", systemImage: "rectangle.stack.person.crop") Label("secondary-navigation.accounts", systemImage: "rectangle.stack.person.crop")
} }
} }
Section { if viewModel.identityContext.identity.authenticated && !viewModel.identityContext.identity.pending {
NavigationLink(destination: ListsView(viewModel: .init(identityContext: viewModel.identityContext)) Section {
.environmentObject(rootViewModel)) { NavigationLink(destination: ListsView(viewModel: .init(identityContext: viewModel.identityContext))
Label("secondary-navigation.lists", systemImage: "scroll") .environmentObject(rootViewModel)) {
} Label("secondary-navigation.lists", systemImage: "scroll")
ForEach([Timeline.favorites, Timeline.bookmarks]) { timeline in }
Button { ForEach([Timeline.favorites, Timeline.bookmarks]) { timeline in
viewModel.navigate(timeline: timeline) Button {
} label: { viewModel.navigate(timeline: timeline)
Label { } label: {
Text(timeline.title).foregroundColor(.primary) Label {
} icon: { Text(timeline.title).foregroundColor(.primary)
Image(systemName: timeline.systemImageName) } icon: {
Image(systemName: timeline.systemImageName)
}
} }
} }
} if let followRequestCount = viewModel.identityContext.identity.account?.followRequestCount,
if let followRequestCount = viewModel.identityContext.identity.account?.followRequestCount, followRequestCount > 0 {
followRequestCount > 0 { Button {
Button { viewModel.navigateToFollowerRequests()
viewModel.navigateToFollowerRequests() } label: {
} label: { Label {
Label { HStack {
HStack { Text("follow-requests").foregroundColor(.primary)
Text("follow-requests").foregroundColor(.primary) Spacer()
Spacer() Text(verbatim: String(followRequestCount))
Text(verbatim: String(followRequestCount)) }
} icon: {
Image(systemName: "person.badge.plus")
} }
} icon: {
Image(systemName: "person.badge.plus")
} }
} }
} }