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

feat: [#176825286,#176323469] Features Carousel: Items are now shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program, hidden if loading or the information is not available #2793

Merged
merged 10 commits into from
Feb 12, 2021

Conversation

CrisTofani
Copy link
Contributor

Short description

This PR converts the usage of the availableBonusTypesSelector with the new visibleAvailableBonusSelector which handles the visibility of bonus items

@pagopa-github-bot pagopa-github-bot changed the title [#176825286] Clean usage of availableBonusSelector with memoized one feat(Carta Giovani Nazionale): [#176825286] Clean usage of availableBonusSelector with memoized one Feb 8, 2021
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Feb 8, 2021

Warnings
⚠️

Multiple stories with different types are associated with this Pull request.
Only one tag will be added, following the order: feature > bug > chore

⚠️

Different scopes were found on the stories related to the pull request: [Carta Giovani Nazionale,Bonus Pagamenti Digitali].

       It is not possible to assign a single scope to this pull request!

Affected stories

  • 🌟 #176825286: L'item nel carosello deve basarsi sul FF remoto della lista dei bonus disponibili
  • 🐞 #176323469: [trivial] il carosello nel portafoglio si mostra prima che l'informazione sia arrivata

Generated by 🚫 dangerJS against 7a8beb0

@codecov
Copy link

codecov bot commented Feb 8, 2021

Codecov Report

Merging #2793 (7a8beb0) into master (a286f21) will increase coverage by 0.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2793      +/-   ##
==========================================
+ Coverage   54.83%   54.85%   +0.01%     
==========================================
  Files         813      813              
  Lines       22547    22547              
  Branches     4233     4233              
==========================================
+ Hits        12364    12368       +4     
+ Misses      10122    10118       -4     
  Partials       61       61              
Impacted Files Coverage Δ
...features/wallet/component/FeaturedCardCarousel.tsx 40.98% <25.00%> (-0.69%) ⬇️
...screens/onboarding/BpdCTAStartOnboardingScreen.tsx 63.63% <50.00%> (-0.37%) ⬇️
...onus/bonusVacanze/screens/AvailableBonusScreen.tsx 47.05% <100.00%> (+1.22%) ⬆️
...nusVacanze/store/reducers/availableBonusesTypes.ts 76.59% <100.00%> (+4.09%) ⬆️
ts/screens/wallet/WalletHomeScreen.tsx 25.11% <100.00%> (+0.11%) ⬆️
ts/utils/pot.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a286f21...7a8beb0. Read the comment docs.

@CrisTofani CrisTofani marked this pull request as ready for review February 8, 2021 14:31
(abs: AvailableBonusTypesState) => pot.isLoading(abs)
);

export const isAvailableBonusNoneErrorSelector = createSelector(
Copy link
Contributor

Choose a reason for hiding this comment

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

In this selector you could use composition

export const isAvailableBonusNoneErrorSelector = createSelector(
  [availableBonusTypesSelector, isAvailableBonusErrorSelector],
  (abs: AvailableBonusTypesState, hasError: boolean) =>
    hasError && pot.isNone(abs)
);

PS you could also leave a little comment for each selector?

const anyBonusNotActive =
(!pot.getOrElse(props.bpdActiveBonus, false) && bpdEnabled) ||
(!props.cgnActiveBonus && cgnEnabled);
const hasBpdActive: boolean | undefined = pot.getOrElse(
Copy link
Contributor

Choose a reason for hiding this comment

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

this expression never returns undefined. It returns always a boolean

we should implement this logic

if we have a value (pot some) we can say has bpd or not (true / false, depending of the pot value). Otherwise we can't say nothing (undefined)

Suggested change
const hasBpdActive: boolean | undefined = pot.getOrElse(
const hasBpdActive: boolean | undefined =
props.bpdActiveBonus.kind === "PotSome"
? props.bpdActiveBonus.value
: undefined;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're absolutely right I thought to commit the previously suggested code:

const hasBpdActive: boolean | undefined =
    pot.isSome(props.bpdActiveBonus)
      ? props.bpdActiveBonus.value
      : undefined;

I'm fixing it asap!

@Undermaken Undermaken changed the title feat(Carta Giovani Nazionale): [#176825286] Clean usage of availableBonusSelector with memoized one feat(Carta Giovani Nazionale): [#176825286,#176323469] Clean usage of availableBonusSelector with memoized one Feb 12, 2021
@Undermaken
Copy link
Contributor

@CrisTofani since now we are using PR title as changelog detail

what do you think to change PR

from

feat(Carta Giovani Nazionale): [#176825286,#176323469] Clean usage of availableBonusSelector with memoized one #2793

to

feat(Carta Giovani Nazionale): [#176825286,#176323469] Features Carousel: CGN item is shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program (no more while it loading) #2793

@CrisTofani
Copy link
Contributor Author

@CrisTofani since now we are using PR title as changelog detail

what do you think to change PR

from

feat(Carta Giovani Nazionale): [#176825286,#176323469] Clean usage of availableBonusSelector with memoized one #2793

to

feat(Carta Giovani Nazionale): [#176825286,#176323469] Features Carousel: CGN item is shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program (no more while it loading) #2793

@Undermaken maybe

feat(Carta Giovani Nazionale): [#176825286,#176323469] Features Carousel: CGN item is shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program, hidden if loading or the information is not available #2793

what do you think?

@pagopa-github-bot pagopa-github-bot changed the title feat(Carta Giovani Nazionale): [#176825286,#176323469] Clean usage of availableBonusSelector with memoized one feat: [#176825286,#176323469] Clean usage of availableBonusSelector with memoized one Feb 12, 2021
@CrisTofani CrisTofani changed the title feat: [#176825286,#176323469] Clean usage of availableBonusSelector with memoized one feat(Carta Giovani Nazionale): [#176825286,#176323469] Features Carousel: CGN item is shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program, hidden if loading or the information is not available Feb 12, 2021
@CrisTofani
Copy link
Contributor Author

@Undermaken a fix from previous proposal:

feat(Carta Giovani Nazionale): [#176825286,#176323469] Features Carousel: Items are now shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program, hidden if loading or the information is not available #2793

what do you think?

@CrisTofani CrisTofani changed the title feat(Carta Giovani Nazionale): [#176825286,#176323469] Features Carousel: CGN item is shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program, hidden if loading or the information is not available feat(Carta Giovani Nazionale): [#176825286,#176323469] Features Carousel: Items are now shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program, hidden if loading or the information is not available Feb 12, 2021
@pagopa-github-bot pagopa-github-bot changed the title feat(Carta Giovani Nazionale): [#176825286,#176323469] Features Carousel: Items are now shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program, hidden if loading or the information is not available feat: [#176825286,#176323469] Features Carousel: Items are now shown depending on local and remote feature flag. BPD item is shown only when user is not enrolled to the program, hidden if loading or the information is not available Feb 12, 2021
@Undermaken Undermaken merged commit 435cde1 into master Feb 12, 2021
@Undermaken Undermaken deleted the 176825286-fixes-bonus-available-selector-usage branch February 12, 2021 11:51
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.

3 participants