Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/12597 custom fields banner #12601

Merged
merged 7 commits into from
Sep 25, 2024
Merged

Conversation

hichamboushaba
Copy link
Member

Closes: #12597

Description

This PR adds a banner to the custom fields list screen to show a message that would help explaining how the saving works for them, in contrast to how it works in the other parts of the Product Details.
For more information on why we need this and how we reached this decision please check this discussion p1725968896022239/1725948493.332539-slack-C03L1NF1EA3

Steps to reproduce

  1. Ensure an order has at least one custom field.
  2. Open the order in the app.
  3. Tap on View Custom Fields.

Testing information

  1. Confirm the top banner is shown.
  2. Confirm it can be dismissed.

The tests that have been performed

The above.

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.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

Comment on lines +53 to +61
private val appPrefs: AppPrefsWrapper = mock {
val bannerDismissed = MutableStateFlow(false)
on { observePrefs() }.thenReturn(bannerDismissed.map { Unit })
on { isCustomFieldsTopBannerDismissed } doAnswer { bannerDismissed.value }
on { isCustomFieldsTopBannerDismissed = any() }.then { invocation ->
bannerDismissed.update { invocation.arguments[0] as Boolean }
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

This works more like a fake than a mock, and allows for a more thorough testing (we can simulate the dismiss properly).

@hichamboushaba hichamboushaba added type: enhancement A request for an enhancement. feature: order details Related to order details. feature: product details Related to adding or editing products, includes product settings. labels Sep 12, 2024
@hichamboushaba hichamboushaba marked this pull request as ready for review September 12, 2024 15:45
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 12, 2024

📲 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 Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit6a5e7c7
Direct Downloadwoocommerce-wear-prototype-build-pr12601-6a5e7c7.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 12, 2024

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

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit6a5e7c7
Direct Downloadwoocommerce-prototype-build-pr12601-6a5e7c7.apk

@hichamboushaba hichamboushaba requested review from JorgeMucientes and irfano and removed request for JorgeMucientes September 19, 2024 15:59
@hichamboushaba hichamboushaba added this to the 20.6 milestone Sep 23, 2024
@JorgeMucientes JorgeMucientes self-assigned this Sep 23, 2024
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.

Nice job @hichamboushaba, the code looks good and works as expected. I left a minor suggestion about displaying the banner message in expanded state by default for this particular case. Lmk wdyt.

shape = RectangleShape,
modifier = modifier
) {
var isExpanded by rememberSaveable { mutableStateOf(false) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor suggestion.

For this particular case where the text is short, very relevant and there's plenty of space on the screen, wdyt of displaying the text expanded by default? We can add a new parma to the composable, something like initiallyExapanded : Boolean = false and use it to set the initial status of it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks Jorge, great idea! I implemented this, but the banner will collapse by default in landscape mode due to the reduced screen real estate.

@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 20.6. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by 🚫 Danger

@hichamboushaba hichamboushaba merged commit cdf6e5b into trunk Sep 25, 2024
15 checks passed
@hichamboushaba hichamboushaba deleted the issue/12597-custom-fields-banner branch September 25, 2024 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: order details Related to order details. feature: product details Related to adding or editing products, includes product settings. type: enhancement A request for an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Custom Fields] Add a banner to explain when custom fields are saved
4 participants