-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Bonus Pagamenti Digitali): [#175890963] Adds the screen to see a…
…ll BPay accounts to add (#2697) * [#175890863] Creates base component for bpay search funnel * [#175890863] Adds navigation from methods list and replace actions * [#175890863] Handles copy for bpay/pagobancomat * [#175890863] minor fixes * [#175890863] updates comments * [#175890963] BPay draft add component * [#175890963] Adds component to the relative screen * [#175890963] Fixes useEffect param and labels Co-authored-by: Fabrizio <[email protected]>
- Loading branch information
1 parent
fc07e9b
commit 8d8d6cf
Showing
5 changed files
with
121 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
ts/features/wallet/onboarding/bancomatPay/screens/add-account/AddBPayComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { View } from "native-base"; | ||
import * as React from "react"; | ||
import { SafeAreaView, StyleSheet } from "react-native"; | ||
import { ScrollView } from "react-native-gesture-handler"; | ||
import { connect } from "react-redux"; | ||
import { InitializedProfile } from "../../../../../../../definitions/backend/InitializedProfile"; | ||
import { H1 } from "../../../../../../components/core/typography/H1"; | ||
import { H4 } from "../../../../../../components/core/typography/H4"; | ||
import { IOStyles } from "../../../../../../components/core/variables/IOStyles"; | ||
import BaseScreenComponent from "../../../../../../components/screens/BaseScreenComponent"; | ||
import FooterWithButtons from "../../../../../../components/ui/FooterWithButtons"; | ||
import I18n from "../../../../../../i18n"; | ||
import { GlobalState } from "../../../../../../store/reducers/types"; | ||
import { | ||
cancelButtonProps, | ||
confirmButtonProps | ||
} from "../../../../../bonus/bonusVacanze/components/buttons/ButtonConfigurations"; | ||
import { abiListSelector } from "../../../store/abi"; | ||
import { Abi } from "../../../../../../../definitions/pagopa/walletv2/Abi"; | ||
import { BPay } from "../../../../../../../definitions/pagopa/BPay"; | ||
import BPayCard from "../../../../bancomatpay/component/BPayCard"; | ||
|
||
type Props = { | ||
account: BPay; | ||
accountsNumber: number; | ||
currentIndex: number; | ||
handleContinue: () => void; | ||
handleSkip: () => void; | ||
profile?: InitializedProfile; | ||
} & ReturnType<typeof mapStateToProps> & | ||
Pick<React.ComponentProps<typeof BaseScreenComponent>, "contextualHelp">; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
alignItems: "center" | ||
}, | ||
title: { lineHeight: 33, alignSelf: "flex-start" }, | ||
flexStart: { alignSelf: "flex-start" } | ||
}); | ||
|
||
const AddBPayComponent: React.FunctionComponent<Props> = (props: Props) => { | ||
const [abiInfo, setAbiInfo] = React.useState<Abi>({}); | ||
|
||
React.useEffect(() => { | ||
const abi: Abi | undefined = props.abiList.find( | ||
elem => elem.abi === props.account.instituteCode | ||
); | ||
setAbiInfo(abi ?? {}); | ||
}, [props.account.instituteCode]); | ||
|
||
return ( | ||
<BaseScreenComponent | ||
customGoBack={<View hspacer={true} spacer={true} />} | ||
headerTitle={I18n.t("wallet.onboarding.bPay.headerTitle")} | ||
contextualHelp={props.contextualHelp} | ||
> | ||
<SafeAreaView style={IOStyles.flex}> | ||
<ScrollView style={IOStyles.flex}> | ||
<View spacer={true} /> | ||
<View | ||
style={[ | ||
styles.container, | ||
IOStyles.flex, | ||
IOStyles.horizontalContentPadding | ||
]} | ||
> | ||
<H1 style={styles.title}> | ||
{I18n.t("wallet.onboarding.bPay.add.screenTitle")} | ||
</H1> | ||
<View spacer small /> | ||
<H4 weight={"Regular"} style={styles.flexStart}> | ||
{I18n.t("wallet.onboarding.bPay.add.label", { | ||
current: props.currentIndex + 1, | ||
length: props.accountsNumber | ||
})} | ||
</H4> | ||
<View spacer={true} large={true} /> | ||
<BPayCard | ||
phone={props.account.numberObfuscated} | ||
abiLogo={abiInfo.logoUrl} | ||
bankName={props.account.bankName ?? ""} // This should never be undefined | ||
/> | ||
</View> | ||
</ScrollView> | ||
<FooterWithButtons | ||
type={"TwoButtonsInlineThird"} | ||
leftButton={cancelButtonProps( | ||
props.handleSkip, | ||
I18n.t("global.buttons.skip") | ||
)} | ||
rightButton={confirmButtonProps( | ||
props.handleContinue, | ||
I18n.t("global.buttons.add") | ||
)} | ||
/> | ||
</SafeAreaView> | ||
</BaseScreenComponent> | ||
); | ||
}; | ||
|
||
const mapStateToProps = (state: GlobalState) => ({ | ||
abiList: abiListSelector(state) | ||
}); | ||
|
||
export default connect(mapStateToProps)(AddBPayComponent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters