@@ -157,44 +157,8 @@ private extension BookingListView {
157157 ScrollView {
158158 LazyVStack ( spacing: 0 , pinnedViews: . sectionHeaders) {
159159 Section {
160- VStack ( spacing: BookingListViewLayout . emptyStatePadding) {
161- Spacer ( )
162- Image ( uiImage: isSearching ? . magnifyingGlassNotFound : . noBookings)
163- . resizable ( )
164- . aspectRatio ( contentMode: . fit)
165- . frame ( width: BookingListViewLayout . emptyStateImageWidth * scale)
166- . padding ( . bottom, BookingListViewLayout . viewPadding)
167- if isSearching {
168- Text ( BookingListViewLocalization . emptySearchText)
169- . font ( . body)
170- . foregroundStyle ( Color . secondary)
171- } else {
172- VStack ( spacing: BookingListViewLayout . textVerticalPadding) {
173- Text ( viewModel. emptyStateTitle)
174- . font ( . title2)
175- . fontWeight ( . semibold)
176- . foregroundStyle ( . primary)
177- Text ( viewModel. emptyStateDescription)
178- . font ( . title3)
179- . foregroundStyle ( . secondary)
180- }
181- if viewModel. hasFilters {
182- VStack ( spacing: BookingListViewLayout . textVerticalPadding) {
183- Button ( " Change filters " ) {
184- // TODO
185- }
186- . buttonStyle ( PrimaryButtonStyle ( ) )
187- Button ( " Clear filters " ) {
188- // TODO
189- }
190- }
191- }
192- Spacer ( )
193- }
194- }
195- . multilineTextAlignment ( . center)
196- . padding ( . horizontal, BookingListViewLayout . emptyStatePadding)
197- . frame ( minWidth: proxy. size. width, minHeight: proxy. size. height)
160+ emptyStateContent ( isSearching: isSearching)
161+ . frame ( minWidth: proxy. size. width, minHeight: proxy. size. height)
198162 } header: {
199163 header
200164 }
@@ -207,6 +171,46 @@ private extension BookingListView {
207171 . background ( Color ( . systemBackground) )
208172 }
209173
174+ func emptyStateContent( isSearching: Bool ) -> some View {
175+ VStack ( spacing: BookingListViewLayout . emptyStatePadding) {
176+ Spacer ( )
177+ Image ( uiImage: isSearching ? . magnifyingGlassNotFound : . noBookings)
178+ . resizable ( )
179+ . aspectRatio ( contentMode: . fit)
180+ . frame ( width: BookingListViewLayout . emptyStateImageWidth * scale)
181+ . padding ( . bottom, BookingListViewLayout . viewPadding)
182+ if isSearching {
183+ Text ( BookingListViewLocalization . emptySearchText)
184+ . font ( . body)
185+ . foregroundStyle ( Color . secondary)
186+ } else {
187+ VStack ( spacing: BookingListViewLayout . textVerticalPadding) {
188+ Text ( viewModel. emptyStateTitle)
189+ . font ( . title2)
190+ . fontWeight ( . semibold)
191+ . foregroundStyle ( . primary)
192+ Text ( viewModel. emptyStateDescription)
193+ . font ( . title3)
194+ . foregroundStyle ( . secondary)
195+ }
196+ if viewModel. hasFilters {
197+ VStack ( spacing: BookingListViewLayout . textVerticalPadding) {
198+ Button ( " Change filters " ) {
199+ // TODO
200+ }
201+ . buttonStyle ( PrimaryButtonStyle ( ) )
202+ Button ( " Clear filters " ) {
203+ // TODO
204+ }
205+ }
206+ }
207+ }
208+ Spacer ( )
209+ }
210+ . multilineTextAlignment ( . center)
211+ . padding ( . horizontal, BookingListViewLayout . emptyStatePadding)
212+ }
213+
210214 func errorSnackBar( onTap: @escaping ( ) -> Void ) -> some View {
211215 Text ( BookingListViewLocalization . errorMessage)
212216 . foregroundStyle ( Color ( . listForeground( modal: false ) ) )
@@ -223,15 +227,15 @@ private extension BookingListView {
223227 }
224228}
225229
226- private enum BookingListViewLayout {
230+ fileprivate enum BookingListViewLayout {
227231 static let textVerticalPadding : CGFloat = 8
228232 static let viewPadding : CGFloat = 16
229233 static let emptyStatePadding : CGFloat = 24
230234 static let emptyStateImageWidth : CGFloat = 67
231235 static let cornerRadius : CGFloat = 8
232236}
233237
234- private enum BookingListViewLocalization {
238+ fileprivate enum BookingListViewLocalization {
235239 static let errorMessage = NSLocalizedString (
236240 " bookingList.errorMessage " ,
237241 value: " Error fetching bookings " ,
0 commit comments