Skip to content

Conversation

@irfano
Copy link
Contributor

@irfano irfano commented Oct 29, 2025

Part of WOOMOB-1465

Description

This adds the Type Filter page to the Booking Filter screen. It currently includes only the UI part. once we have a dedicated ViewModel for the Type Filter screen, we’ll need to bind the logic to the UI.

Test Steps

  1. Log in with a CIAB store.
  2. Go to Bookings.
  3. Go to the All tab.
  4. Tap the Filters button.
  5. Select Booking type.

Images/gif

  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Moves the `BookingFilterListItem` data class from `BookingFilterListUiState.kt` to a new, dedicated file `BookingFilterListItem.kt` within the same package.
This commit introduces a new Composable, `SingleChoiceFilterPage`, for displaying a list of filter options where only one can be selected at a time.
Introduces the `BookingTypeFilterPage` composable. This page utilizes the generic `SingleChoiceFilterPage` to display a list of booking type filter options.
@dangermattic
Copy link
Collaborator

dangermattic commented Oct 29, 2025

2 Warnings
⚠️ Class BookingTypeFilterViewModel is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ This PR is assigned to the milestone 23.6. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.

Generated by 🚫 Danger

Comment on lines +8 to +12
data class BookingFilterListItem(
@StringRes val title: Int,
val value: String? = null,
val onClick: () -> Unit = {}
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I extracted this from BookingFilterListUiState to make it reusable across all screens, not just the root page.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 29, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App NameWooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commite1bee75
Direct Downloadwoocommerce-wear-prototype-build-pr14858-e1bee75.apk

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use a structure similar to BookingFilterListUiState here.

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Oct 29, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App NameWooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commite1bee75
Direct Downloadwoocommerce-prototype-build-pr14858-e1bee75.apk

@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 5.63380% with 67 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.24%. Comparing base (7e5bb1b) to head (2291267).

Files with missing lines Patch % Lines
...droid/ui/bookings/filter/SingleChoiceFilterPage.kt 0.00% 33 Missing ⚠️
...i/bookings/filter/type/BookingTypeFilterUiState.kt 0.00% 28 Missing ⚠️
...d/ui/bookings/filter/type/BookingTypeFilterPage.kt 0.00% 5 Missing ⚠️
...ndroid/ui/bookings/filter/BookingFilterListItem.kt 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #14858      +/-   ##
============================================
- Coverage     38.26%   38.24%   -0.03%     
  Complexity    10077    10077              
============================================
  Files          2131     2135       +4     
  Lines        120744   120810      +66     
  Branches      16547    16561      +14     
============================================
  Hits          46206    46206              
- Misses        69840    69906      +66     
  Partials       4698     4698              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

# Conflicts:
#	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/bookings/filter/BookingFilterListScreen.kt
@irfano irfano marked this pull request as draft October 30, 2025 09:20
@JorgeMucientes JorgeMucientes self-assigned this Oct 30, 2025
Adds a new `BookingTypeFilterViewModel` to manage the state for the booking type filter.
This ViewModel handles the initial selected type and updates the UI state when a new type is selected.
@irfano irfano changed the title [Bookings] Type filter UI [Bookings] Type filter Oct 30, 2025
@irfano irfano marked this pull request as ready for review October 30, 2025 16:00
Copy link
Contributor

@JorgeMucientes JorgeMucientes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done @irfano. Code looks good.

I just left a minor concern that might worth checking before merging this.
Additionally, I was wondering if within the UI scope work we are doing here, shouldn't this PR also include the logic to update BookingFilterListScreen with the selected value from BookingTypeFilterPage? It feels like that part would make sense as part of the UI work too.

Comment on lines -125 to +128
TODO()
BookingTypeFilterRoute(initialType = state.currentBookingType) { type ->
state.onUpdateFilterOption(type)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused with this new filter "BookingType" and the one added below in line 133 "Service/Event". I think we are adding the same filter twice. Might be worth double checking with Wagner or with folks from ciab-bookings how do they want to refer to this filter.

Currently in desktop experience they are referring to it as Service/Event filter. But who knows if that is the final call:

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess “Service/Event” refers to the name of the service or event, while “Booking type” indicates whether the booking is for a service or an event. These both screens are from Figma, so let’s keep both.

image

@irfano irfano modified the milestones: 23.6, 23.7 Oct 31, 2025
@irfano
Copy link
Contributor Author

irfano commented Oct 31, 2025

shouldn't this PR also include the logic to update BookingFilterListScreen with the selected value from BookingTypeFilterPage?

I plan to handle that in a separate PR. The change will involve updating the BookingFilterListViewModel, which affects all sub-screens, and this PR is already close to 300 lines.

@irfano irfano merged commit 6d7c199 into trunk Oct 31, 2025
21 of 23 checks passed
@irfano irfano deleted the issue/WOOMOB-1465-bookings-type-filter branch October 31, 2025 08:52
Comment on lines +12 to +16
sealed interface BookingType : BookingsFilterOption {
object Any : BookingType
object Service : BookingType
object Event : BookingType
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@irfano I'm late, but I think something like this would be more consistent with other filters here. Having it like this wouldn't require different filtering logic in the ViewModel to set the state.

data class BookingType(
        val value: Type
    ) : BookingsFilterOption {
        enum class Type {
            ANY, SERVICE, EVENT
        }
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing this and sharing your feedback, Adam. This was the alternative I had in mind. I would either do this or update the onUpdateFilterOption() function, I chose the latter to avoid defining a new Type class. But your suggestion might actually be better, I’ll consider it and update BookingType in my next PR.

@irfano irfano mentioned this pull request Nov 3, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants