Skip to content

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

Open
marfavi wants to merge 2 commits intomainfrom
refactor-perks-and-tickets-section
Open

refactor(ui): perks section and tickets page#566
marfavi wants to merge 2 commits intomainfrom
refactor-perks-and-tickets-section

Conversation

@marfavi
Copy link
Copy Markdown
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
Copy Markdown

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

@marfavi marfavi requested a review from fredpetersen December 12, 2023 11:27
@marfavi marfavi disabled auto-merge December 12, 2023 11:31
@codecov
Copy link
Copy Markdown

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.

1 participant