Skip to content

[Dynamic Dashboard] Stock card 19.0 beta feedback updates #11730

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

Merged
merged 5 commits into from
Jun 18, 2024

Conversation

hafizrahman
Copy link
Contributor

@hafizrahman hafizrahman commented Jun 14, 2024

Part of: #11718

Description

This PR adds the following:

  1. Align the product thumbnail to the top. Now, if the product title goes longer than 1 line, the image stays fixed to the top.
  2. Logic to sort product items by stock quantity, lowest first.

Steps to reproduce

Product thumbnail

  1. You will need a product with a really long name. Or else, just edit DashboardProductStockCard on line 278 and hack in a longer name for the product. I used text = product.name + product.name + product.name + product.name + product.name + product.name,
  2. Start app, enable Stock card on My Store,
  3. Ensure the thumbnail stays aligned to the top like the screenshot below,
  4. Optionally also check the thumbnail with one line product title and ensure it still looks good too.
Single line Multiple lines
Screenshot_20240614_151516

Product sorting

I think just check the code and smoke test that the result is always ordered correctly, also by changing various product's stocks and re-checking the card.

* trunk:
  Update WooPosCartCartRepositoryTest
  Remove unused imports
  Update WooPosCartViewModelTest
  Don't crash the app on payment failure
  Satisfy detekt's complaints
  Clean up code
  Start payment flow from totals screen
  Fix order creation API request
  Show only simple products that have price
  Start collect payment flow from totals screen
  Pass order id to totals screen
@@ -58,7 +58,10 @@ class DashboardProductStockViewModel @AssistedInject constructor(
emit(Loading(status))
productStockRepository.fetchProductStockReport(status, refresh.isForced)
.fold(
onSuccess = { emit(ViewState.Success(it, status)) },
onSuccess = {
val sortedProductStockItems = it.sortedBy { item -> item.stockQuantity }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hafizrahman hafizrahman marked this pull request as ready for review June 14, 2024 08:57
@hafizrahman hafizrahman added this to the 19.2 milestone Jun 14, 2024
@hafizrahman hafizrahman added the feature: dashboard Related to home screen project label Jun 14, 2024
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jun 14, 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
FlavorJalapeno
Build TypeDebug
Commit263d435
Direct Downloadwoocommerce-prototype-build-pr11730-263d435.apk

@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.

Project coverage is 40.28%. Comparing base (81ad5ef) to head (0b26be4).
Report is 52 commits behind head on trunk.

Current head 0b26be4 differs from pull request most recent head 263d435

Please upload reports for the commit 263d435 to get more accurate results.

Files Patch % Lines
...id/ui/dashboard/stock/DashboardProductStockCard.kt 0.00% 3 Missing ⚠️
.../dashboard/stock/DashboardProductStockViewModel.kt 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##              trunk   #11730      +/-   ##
============================================
- Coverage     40.28%   40.28%   -0.01%     
  Complexity     5333     5333              
============================================
  Files          1133     1133              
  Lines         65148    65151       +3     
  Branches       9006     9006              
============================================
  Hits          26243    26243              
- Misses        36504    36507       +3     
  Partials       2401     2401              

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

@JorgeMucientes JorgeMucientes self-assigned this Jun 14, 2024
@@ -189,7 +189,7 @@ private fun ProductStockLoading(
}

@Composable
private fun ProductReviewsCardContent(
private fun ProductStockCardContent(
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch!

modifier = Modifier.weight(1f),
modifier = Modifier
.weight(1f)
.padding(end = 8.dp),
Copy link
Contributor

Choose a reason for hiding this comment

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

Just added some minor padding at the end to avoid long names almost "touch" the stock left number.

Screenshot 2024-06-18 at 10 41 51

@JorgeMucientes JorgeMucientes enabled auto-merge June 18, 2024 08:53
@JorgeMucientes
Copy link
Contributor

Nice job @hafizrahman. I added just one minor change before merging.

:shipit:

@JorgeMucientes JorgeMucientes merged commit 69b2aeb into trunk Jun 18, 2024
14 checks passed
@JorgeMucientes JorgeMucientes deleted the fix/11718-stocks-card-updates branch June 18, 2024 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: dashboard Related to home screen project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants