Show timeline selector even without posts

This commit is contained in:
Lumaa 2024-04-26 20:05:43 +02:00
parent 1af892bbd1
commit e33d878d9c
1 changed files with 51 additions and 5 deletions

View File

@ -122,11 +122,57 @@ struct TimelineView: View {
.ignoresSafeArea() .ignoresSafeArea()
VStack { VStack {
Image("HeroIcon") if showHero {
.resizable() Button {
.aspectRatio(contentMode: .fit) withAnimation(.easeInOut) {
.frame(width: 50) showPicker.toggle()
.padding(.bottom) }
} label: {
Image("HeroIcon")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 30)
.padding(.bottom)
}
}
if showPicker {
ViewThatFits {
HStack {
ForEach(timelines, id: \.self) { t in
Button {
Task {
await reloadTimeline(t)
}
} label: {
Text(t.localizedTitle())
.padding(.horizontal)
}
.buttonStyle(LargeButton(filled: t == filter, height: 7.5))
.disabled(t == filter)
}
}
ScrollView(.horizontal) {
HStack {
ForEach(timelines, id: \.self) { t in
Button {
Task {
await reloadTimeline(t)
}
} label: {
Text(t.localizedTitle())
.padding(.horizontal)
}
.buttonStyle(LargeButton(filled: t == filter, height: 7.5))
.disabled(t == filter)
}
}
}
.padding(.vertical)
.scrollIndicators(.hidden)
}
}
ContentUnavailableView { ContentUnavailableView {
Text("timeline.empty") Text("timeline.empty")