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(Bonus Pagamenti Digitali): [#175266102] Add summary (graphical and textual) for period transactions and amount component #2332

Merged
merged 72 commits into from
Nov 6, 2020

Conversation

fabriziofff
Copy link
Contributor

@fabriziofff fabriziofff commented Nov 2, 2020

This pr depends on #2330

Short description

This pr adds the BpdSummaryComponent that displays information related to the selected period and amount.

Component architecture

Description

A concise description of the component architecture:

  • ShadowBox: A box with a shadow
  • BpdBaseShadowBoxLayout: The layout of the graphical component
  • ProgressBar: A simple progress bar
  • TransactionsGraphicalSummary: A graphical component that represents graphically the transaction in the period
  • TextualSummary: A summary with textual information related to the period and amount.
  • BpdSummaryComponent: The general component that displays textual + graphical information.

Each component implements some rules in order to display the appropriate graphic state.

Composition

ShadowBox <---use-- BpdBaseShadowBoxLayout + ProgressBar <--use-- TransactionsGraphicalSummary

ShadowBox <---use-- BpdBaseShadowBoxLayout <--use-- TextualSummary

TransactionsGraphicalSummary + TextualSummary <--use-- BpdSummaryComponent

TransactionsGraphicalSummary graphical states

transactions === 0 transactions < minTransactionNumber transactions >= minTransactionNumber

BpdSummaryComponent graphical states

status === closed && totalCashback >= maxPeriodCashback && transactionNumber >= minTransactionNumber status === closed && totalCashback < maxPeriodCashback && transactionNumber >= minTransactionNumber status === closed && transactionNumber < minTransactionNumber
status === current && transactionNumber < minTransactionNumber && totalCashback > 0 status === closed && today <= endGracePeriod && today >= period.endDate status === inactive

List of changes proposed in this pull request

  • Added all the component previously described to display the summary.
  • Added blue color to H2 core typography component.
  • Added prefetchBpdData saga (and related trigger action bpdDetailsLoadAll as single entrypoint to load all the informations related to bpd.
  • Added profileNameSelector to select the name of the profile.

fabriziofff and others added 30 commits October 29, 2020 10:20
@fabriziofff fabriziofff changed the title feat(Bonus Pagamenti Digitali): [#175266102] Summary (graphical and textual) for period transactions and amount feat(Bonus Pagamenti Digitali): [#175266102] Add summary (graphical and textual) for period transactions and amount component Nov 3, 2020
Undermaken and others added 14 commits November 4, 2020 17:43
…hub.com:pagopa/io-app into 174848741-iban-component
…gopa/io-app into 175515542-transaction-screen-stub
…on-screen-stub' into 175515542-transaction-screen-stub
…ub.com:pagopa/io-app into 175266102-transaction-component
…ub.com:pagopa/io-app into 175266102-transaction-component

# Conflicts:
#	ts/components/core/typography/H2.tsx
const today = new Date();
const endGracePeriod = new Date();
endGracePeriod.setDate(
props.period.endDate.getDate() + props.period.gracePeriod
Copy link
Contributor

Choose a reason for hiding this comment

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

if props.period.gracePeriod express the days, perhaps should it be converted in millisecond?
props.period.endDate.getDate() + props.period.gracePeriod * 1000 * 60 * 60 * 24

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

My fault! I didn't test it and I confused getDate with getTime

@@ -69,6 +69,7 @@ export const bpdEnabledSelector = (

/**
* Return the Iban that the user has entered to receive the cashback amount
* @return {RemoteValue<string | undefined, Error>}
*/
export const bpdIbanSelector = createSelector(
Copy link
Contributor

Choose a reason for hiding this comment

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

Expressing the type of generics accepted by createSelector you can inform typescript about the value type returned
Although it is more verbose, as a developer I prefer to know immediately what is the type returned by the selector

export const bpdIbanSelector = createSelector<
  GlobalState,
  RemoteValue<string | undefined, Error>,
  RemoteValue<string | undefined, Error>
>

Copy link
Contributor Author

@fabriziofff fabriziofff Nov 5, 2020

Choose a reason for hiding this comment

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

Sure better! changed in d230fa3

@Undermaken Undermaken merged commit 965fea2 into master Nov 6, 2020
@Undermaken Undermaken deleted the 175266102-transaction-component branch November 6, 2020 09:11
@Undermaken Undermaken restored the 175266102-transaction-component branch November 6, 2020 09:12
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.

4 participants