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

refactor(ui): perks section and tickets page #566

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

marfavi
Copy link
Member

@marfavi marfavi commented Dec 12, 2023

  • Converted BaristaPerksSection to a StatelessWidget as it did not utilise any stateful features.
  • Transitioned BaristaPerksSection and UserRoleIndicator to accept a String instead of Role. This prevents duplicate conversion/formatting from Role to String in these widgets.
  • Made tickets_page.dart more state safe by removing UserState cast and taking into account cases where UserState is not UserWithData.
  • Extracted contents of TicketsPage to a private widget to maintain readablity.
  • Fixed the incorrect usage of context.read inside of the build method of TicketsPage.

The refactor improves overall code maintainability and aligns with best practices for widgets that do not require internal state management.

- Converted `BaristaPerksSection` to a `StatelessWidget` as it did not utilise any stateful features.
- Transitioned `BaristaPerksSection` and `UserRoleIndicator` to accept a `String` instead of `Role`. This prevents duplicate conversion/formatting from `Role` to `String` in these widgets.
- Made `tickets_page.dart` more state safe by removing UserState cast and taking into account cases where UserState is not UserWithData.
- Extracted ticket contents of `TicketsPage` to a private widget to maintain readablity.
- Fixed the incorrect usage of `context.read` inside of the build method of `TicketsPage`.

The refactor improves overall code maintainability and aligns with best practices for widgets that do not require internal state management.
@marfavi marfavi enabled auto-merge (squash) December 12, 2023 11:15
@ghost
Copy link

ghost commented Dec 12, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

Copy link

codecov bot commented Jan 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (65c1fb7) 68.76% compared to head (7b5e70d) 68.76%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #566   +/-   ##
=======================================
  Coverage   68.76%   68.76%           
=======================================
  Files         133      133           
  Lines        1697     1697           
=======================================
  Hits         1167     1167           
  Misses        530      530           
Flag Coverage Δ
unittests 68.76% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant