File tree Expand file tree Collapse file tree 2 files changed +22
-24
lines changed
WooCommerce/Classes/Bookings/BookingList Expand file tree Collapse file tree 2 files changed +22
-24
lines changed Original file line number Diff line number Diff line change @@ -84,15 +84,9 @@ private extension BookingListContainerView {
8484 Button {
8585 showingFilters = true
8686 } label: {
87- if viewModel. numberOfActiveFilters > 0 {
88- Text ( Localization . filterWithCount ( viewModel. numberOfActiveFilters) )
89- . font ( . body)
90- . foregroundStyle ( Color . accentColor)
91- } else {
92- Text ( Localization . filter)
93- . font ( . body)
94- . foregroundStyle ( Color . accentColor)
95- }
87+ Text ( viewModel. filterText)
88+ . font ( . body)
89+ . foregroundStyle ( Color . accentColor)
9690 }
9791 . renderedIf ( viewModel. selectedTab == . all)
9892 }
@@ -209,21 +203,6 @@ private extension BookingListContainerView {
209203 value: " Sort by " ,
210204 comment: " Button to select the order of the booking list "
211205 )
212- static let filter = NSLocalizedString (
213- " bookingListView.filter " ,
214- value: " Filter " ,
215- comment: " Button to filter the booking list "
216- )
217- static func filterWithCount( _ count: Int ) -> String {
218- String . localizedStringWithFormat (
219- NSLocalizedString (
220- " bookingListView.filter.withCount " ,
221- value: " Filter (%d) " ,
222- comment: " Button to filter the booking list with number of active filters "
223- ) ,
224- count
225- )
226- }
227206 static let searchPrompt = NSLocalizedString (
228207 " bookingListView.search.prompt " ,
229208 value: " Search bookings " ,
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ final class BookingListContainerViewModel: ObservableObject {
2424
2525 private var filters = BookingFiltersViewModel . Filters ( )
2626
27+ var filterText : String {
28+ numberOfActiveFilters == 0 ? Localization . filter : String . localizedStringWithFormat ( Localization . filterWithCount, numberOfActiveFilters)
29+ }
30+
2731 var filterViewModel : BookingFiltersViewModel {
2832 BookingFiltersViewModel ( filter: filters, siteID: siteID)
2933 }
@@ -108,6 +112,21 @@ final class BookingListContainerViewModel: ObservableObject {
108112 }
109113}
110114
115+ private extension BookingListContainerViewModel {
116+ enum Localization {
117+ static let filter = NSLocalizedString (
118+ " bookingListView.filter " ,
119+ value: " Filter " ,
120+ comment: " Button to filter the booking list "
121+ )
122+ static let filterWithCount = NSLocalizedString (
123+ " bookingListView.filter.withCount " ,
124+ value: " Filter (%1$d) " ,
125+ comment: " Button to filter the booking list with number of active filters "
126+ )
127+ }
128+ }
129+
111130enum BookingListTab : Int , CaseIterable {
112131 case today
113132 case upcoming
You can’t perform that action at this time.
0 commit comments