From c70a9b6bb462e6bc70851b1ae1272ed55f002737 Mon Sep 17 00:00:00 2001 From: Lumaa Date: Fri, 29 Dec 2023 12:54:11 +0100 Subject: [PATCH] Message for no statuses --- Threaded/Views/TimelineView.swift | 52 +++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/Threaded/Views/TimelineView.swift b/Threaded/Views/TimelineView.swift index 7ecef21..cf2fb10 100644 --- a/Threaded/Views/TimelineView.swift +++ b/Threaded/Views/TimelineView.swift @@ -13,22 +13,48 @@ struct TimelineView: View { var body: some View { NavigationStack(path: $navigator.path) { if statuses != nil { - ScrollView(showsIndicators: false) { - Image("HeroIcon") - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 30) - .padding(.bottom) - - ForEach(statuses!, id: \.id) { status in - VStack(spacing: 2) { - CompactPostView(status: status, navigator: navigator) + if !statuses!.isEmpty { + ScrollView(showsIndicators: false) { + Image("HeroIcon") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 30) + .padding(.bottom) + + ForEach(statuses!, id: \.id) { status in + VStack(spacing: 2) { + CompactPostView(status: status, navigator: navigator) + } } } + .padding(.top) + .background(Color.appBackground) + .withAppRouter() + } else { + ZStack { + Color.appBackground + .ignoresSafeArea() + + VStack { + Image("HeroIcon") + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 50) + .padding(.bottom) + + ContentUnavailableView { + Text("timeline.empty") + .bold() + } description: { + Text("timeline.empty.description") + } + .scrollDisabled(true) + } + .scrollDisabled(true) + .background(Color.appBackground) + .frame(height: 150) + } } - .padding(.top) - .background(Color.appBackground) - .withAppRouter() } else { ZStack { Color.appBackground