Fix timeline menu titles

This commit is contained in:
Justin Mazzocchi 2020-09-01 01:11:34 -07:00
parent 038385c2c7
commit bc59acd160
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C

View file

@ -2,6 +2,7 @@
import SwiftUI import SwiftUI
import KingfisherSwiftUI import KingfisherSwiftUI
import enum Mastodon.Timeline
import ViewModels import ViewModels
struct TabNavigationView: View { struct TabNavigationView: View {
@ -44,11 +45,11 @@ private extension TabNavigationView {
StatusListView(viewModel: viewModel.viewModel(timeline: viewModel.timeline)) StatusListView(viewModel: viewModel.viewModel(timeline: viewModel.timeline))
.id(viewModel.timeline.id) .id(viewModel.timeline.id)
.edgesIgnoringSafeArea(.all) .edgesIgnoringSafeArea(.all)
.navigationBarTitle(timelineTitle, displayMode: .inline) .navigationBarTitle(viewModel.timeline.title, displayMode: .inline)
.toolbar { .toolbar {
ToolbarItem(placement: .principal) { ToolbarItem(placement: .principal) {
VStack { VStack {
Text(timelineTitle) Text(viewModel.timeline.title)
.font(.headline) .font(.headline)
Text(viewModel.timelineSubtitle) Text(viewModel.timelineSubtitle)
.font(.footnote) .font(.footnote)
@ -63,7 +64,7 @@ private extension TabNavigationView {
Button { Button {
viewModel.timeline = timeline viewModel.timeline = timeline
} label: { } label: {
Label(timelineTitle, Label(timeline.title,
systemImage: viewModel.systemImageName(timeline: timeline)) systemImage: viewModel.systemImageName(timeline: timeline))
} }
} }
@ -102,9 +103,9 @@ private extension TabNavigationView {
} }
} }
private extension TabNavigationView { private extension Timeline {
var timelineTitle: String { var title: String {
switch viewModel.timeline { switch self {
case .home: case .home:
return NSLocalizedString("timelines.home", comment: "") return NSLocalizedString("timelines.home", comment: "")
case .local: case .local: