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[IOBP-1119]: Adapt IDPay custom table and list to design system components #6597

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
cbd2aa6
refactor: update idpay headers
LeleDallas Jan 3, 2025
aa3c517
refactor: update idpay headers
LeleDallas Jan 3, 2025
673a994
test: add missing navigation mock function
LeleDallas Jan 3, 2025
0464b64
refactor: update radio/switch components
LeleDallas Jan 3, 2025
3e899d7
refactor: removed deprecated nav screen
LeleDallas Jan 7, 2025
1ea295b
refactor: removed reanimated deprecation
LeleDallas Jan 7, 2025
483f90d
refactor: FooterActions from design system
LeleDallas Jan 7, 2025
12ac51b
test: replace deprecated functions
LeleDallas Jan 7, 2025
5e8f5ad
refactor: replace deprecated scroll view
LeleDallas Jan 7, 2025
a803b46
refactor: using IOScrollViewWithLargeHeader
LeleDallas Jan 7, 2025
2c6e49b
refactor: update idpay configuration scrollview types
LeleDallas Jan 7, 2025
3cd40af
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 8, 2025
1b9fee4
refactor: update idpay code scrollview
LeleDallas Jan 8, 2025
04c5b2a
refactor: update idpay onboarding scrollview
LeleDallas Jan 8, 2025
da3b762
refactor: update idpay barcode screen scrollview
LeleDallas Jan 8, 2025
9bca3c2
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 8, 2025
d57c900
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 9, 2025
d023e9c
test: apply getAllByText as the element appears multiple times
LeleDallas Jan 9, 2025
4e961c3
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 9, 2025
7d1891d
refactor: replace custom radio with RadioGroup
LeleDallas Jan 9, 2025
b4468ce
Merge branch 'IOBP-1094-update-radio-button-for-idpay' into IOBP-1115…
LeleDallas Jan 9, 2025
4e9b4d1
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 10, 2025
f01f6e0
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 10, 2025
57a0253
refactor: apply `ListItem` to idpay initiative screens
LeleDallas Jan 10, 2025
d864481
refactor: apply `ListItem` to idpay timeline screens
LeleDallas Jan 10, 2025
723cc9a
refactor: remove `Table` for `ListItem`, update skeleton
LeleDallas Jan 10, 2025
0e6b0b8
chore: remove unused import
LeleDallas Jan 10, 2025
5266cd8
fix: remove duplicated list item
LeleDallas Jan 10, 2025
c1d0677
Merge branch 'master' into IOBP-1119-convert-table-and-custom-list-to…
LeleDallas Jan 10, 2025
1d64f79
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 10, 2025
e82a082
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 13, 2025
aac0bb6
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 13, 2025
e15420f
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 15, 2025
6f03a07
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 15, 2025
0badea1
Merge branch 'master' into IOBP-1094-update-radio-button-for-idpay
LeleDallas Jan 15, 2025
ba30881
Merge branch 'IOBP-1094-update-radio-button-for-idpay' into IOBP-1115…
LeleDallas Jan 15, 2025
7aeaefb
Merge branch 'IOBP-1115-upgrade-deprecated-components-for-idpay' into…
LeleDallas Jan 15, 2025
6e6df0b
Merge branch 'master' into IOBP-1115-upgrade-deprecated-components-fo…
LeleDallas Jan 15, 2025
ab5ae7f
Merge branch 'IOBP-1115-upgrade-deprecated-components-for-idpay' into…
LeleDallas Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ts/features/idpay/barcode/navigation/navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Stack = createStackNavigator<IdPayBarcodeParamsList>();
export const IdPayBarcodeNavigator = () => (
<Stack.Navigator
initialRouteName={IdPayBarcodeRoutes.IDPAY_BARCODE_RESULT}
screenOptions={{ gestureEnabled: true, headerShown: false }}
screenOptions={{ gestureEnabled: true }}
>
<Stack.Screen
name={IdPayBarcodeRoutes.IDPAY_BARCODE_RESULT}
Expand Down
92 changes: 40 additions & 52 deletions ts/features/idpay/barcode/screens/IdPayBarcodeResultScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import {
Body,
GradientScrollView,
H2,
BodySmall,
H3,
HeaderSecondLevel,
IOColors,
IOStyles,
IOVisualCostants,
BodySmall,
VSpacer
} from "@pagopa/io-app-design-system";
import * as pot from "@pagopa/ts-commons/lib/pot";
Expand All @@ -19,17 +16,18 @@ import { SafeAreaView, StyleSheet, View } from "react-native";
import Barcode from "react-native-barcode-builder";
import { TransactionBarCodeResponse } from "../../../../../definitions/idpay/TransactionBarCodeResponse";
import { OperationResultScreenContent } from "../../../../components/screens/OperationResultScreenContent";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import { LoadingIndicator } from "../../../../components/ui/LoadingIndicator";
import I18n from "../../../../i18n";
import { useIONavigation } from "../../../../navigation/params/AppParamsList";
import { useIODispatch, useIOSelector } from "../../../../store/hooks";
import { formatNumberCurrencyCents } from "../../common/utils/strings";
import { IDPayDetailsRoutes } from "../../details/navigation";
import { IdPayBarcodeExpireProgressBar } from "../components/BarcodeExpirationProgressBar";
import { IdPayBarcodeParamsList } from "../navigation/params";
import { idPayBarcodeByInitiativeIdSelector } from "../store";
import { calculateIdPayBarcodeSecondsToExpire } from "../utils";
import { idPayGenerateBarcode } from "../store/actions";
import { useIONavigation } from "../../../../navigation/params/AppParamsList";
import { calculateIdPayBarcodeSecondsToExpire } from "../utils";

// -------------------- types --------------------

Expand Down Expand Up @@ -110,61 +108,50 @@ const SuccessContent = ({ goBack, barcode }: SuccessContentProps) => {
return <BarcodeExpiredContent initiativeId={barcode.initiativeId} />;
}
return (
<>
<HeaderSecondLevel
backAccessibilityLabel={I18n.t("global.buttons.back")}
title=""
type="singleAction"
firstAction={{
icon: "closeLarge",
accessibilityLabel: I18n.t("global.buttons.close"),
onPress: goBack
}}
goBack={goBack}
/>
<GradientScrollView
primaryActionProps={{
<IOScrollViewWithLargeHeader
includeContentMargins
actions={{
type: "TwoButtons",
primary: {
label: I18n.t("idpay.barCode.resultScreen.success.saveImageCta"),
accessibilityLabel: I18n.t(
"idpay.barCode.resultScreen.success.saveImageCta"
),
onPress: () => null
}}
secondaryActionProps={{
},
secondary: {
label: I18n.t("global.buttons.close"),
accessibilityLabel: I18n.t("global.buttons.close"),
onPress: goBack
}}
>
<H2>{I18n.t("idpay.barCode.resultScreen.success.header")}</H2>
<VSpacer size={16} />
<Body>
{I18n.t("idpay.barCode.resultScreen.success.body", {
initiativeName: barcode.initiativeName
})}
</Body>
<VSpacer size={24} />
<View style={styles.barcodeContainer}>
<View style={[IOStyles.row, { alignSelf: "center" }]}>
<BodySmall weight="Regular" color="black">
{I18n.t("idpay.barCode.resultScreen.success.validUpTo")}
</BodySmall>
<BodySmall weight="Semibold" color="black">
{formatNumberCurrencyCents(barcode.residualBudgetCents)}
</BodySmall>
</View>
<VSpacer size={4} />
<Barcode format="CODE128" value={trx} />
<H3 style={{ alignSelf: "center" }}>{trx}</H3>
<VSpacer size={32} />
<IdPayBarcodeExpireProgressBar
secondsExpirationTotal={barcode.trxExpirationSeconds}
secondsToExpiration={secondsTillExpire}
setIsExpired={setIsBarcodeExpired}
/>
}
}}
title={{
label: I18n.t("idpay.barCode.resultScreen.success.header")
}}
description={I18n.t("idpay.barCode.resultScreen.success.body", {
initiativeName: barcode.initiativeName
})}
>
<View style={styles.barcodeContainer}>
<View style={[IOStyles.row, { alignSelf: "center" }]}>
<BodySmall weight="Regular" color="black">
{I18n.t("idpay.barCode.resultScreen.success.validUpTo")}
</BodySmall>
<BodySmall weight="Semibold" color="black">
{formatNumberCurrencyCents(barcode.residualBudgetCents)}
</BodySmall>
</View>
</GradientScrollView>
</>
<VSpacer size={4} />
<Barcode format="CODE128" value={trx} />
<H3 style={{ alignSelf: "center" }}>{trx}</H3>
<VSpacer size={32} />
<IdPayBarcodeExpireProgressBar
secondsExpirationTotal={barcode.trxExpirationSeconds}
secondsToExpiration={secondsTillExpire}
setIsExpired={setIsBarcodeExpired}
/>
</View>
</IOScrollViewWithLargeHeader>
);
};

Expand All @@ -179,6 +166,7 @@ const BarcodeExpiredContent = ({
};
return (
<OperationResultScreenContent
isHeaderVisible
title={I18n.t("idpay.barCode.resultScreen.success.expired.header")}
action={{
label: I18n.t("idpay.barCode.resultScreen.success.expired.CTA"),
Expand Down
3 changes: 2 additions & 1 deletion ts/features/idpay/code/navigation/navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Stack = createStackNavigator<IdPayCodeParamsList>();
export const IdPayCodeNavigator = () => (
<Stack.Navigator
initialRouteName={IdPayCodeRoutes.IDPAY_CODE_ONBOARDING}
screenOptions={{ gestureEnabled: false, headerShown: false }}
screenOptions={{ gestureEnabled: false }}
>
<Stack.Screen
name={IdPayCodeRoutes.IDPAY_CODE_ONBOARDING}
Expand All @@ -32,6 +32,7 @@ export const IdPayCodeNavigator = () => (
component={IdPayCodeRenewScreen}
/>
<Stack.Screen
options={{ headerShown: false }}
name={IdPayCodeRoutes.IDPAY_CODE_RESULT}
component={IdPayCodeResultScreen}
/>
Expand Down
103 changes: 48 additions & 55 deletions ts/features/idpay/code/screens/IdPayCodeDisplayScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
import {
Banner,
Body,
ButtonSolid,
ContentWrapper,
H2,
H3,
IOColors,
IOStyles,
VSpacer
} from "@pagopa/io-app-design-system";
import { Banner, H3, IOColors, VSpacer } from "@pagopa/io-app-design-system";
import { RouteProp, useNavigation, useRoute } from "@react-navigation/native";
import * as React from "react";
import { StyleSheet, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import LoadingSpinnerOverlay from "../../../../components/LoadingSpinnerOverlay";
import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import I18n from "../../../../i18n";
import {
AppParamsList,
Expand Down Expand Up @@ -76,52 +65,56 @@ const IdPayCodeDisplayScreen = () => {
? I18n.t("global.buttons.continue")
: I18n.t("global.buttons.close");

useHeaderSecondLevel({
title: "",
canGoBack: true,
contextualHelp: emptyContextualHelp,
supportRequest: true
});

return (
<>
<IOScrollViewWithLargeHeader
title={{
label: I18n.t("idpay.code.onboarding.header")
}}
description={[
{ text: I18n.t("idpay.code.onboarding.body1") },
{
text: "\n"
},
{
text: I18n.t("idpay.code.onboarding.bodyBold"),
weight: "Semibold"
},
{
text: "\n"
},
{
text: I18n.t("idpay.code.onboarding.bodyCta"),
weight: "Semibold",
asLink: true,
onPress: presentCieBottomSheet
}
]}
contextualHelp={emptyContextualHelp}
headerActionsProp={{ showHelp: true }}
actions={{
type: "SingleButton",
primary: {
label: buttonLabel,
onPress: handleContinue,
testID: "actionButtonTestID"
}
}}
includeContentMargins
>
<LoadingSpinnerOverlay isLoading={isGeneratingCode} loadingOpacity={1}>
<ContentWrapper>
<H2>{I18n.t("idpay.code.onboarding.header")}</H2>
<VSpacer size={16} />
<Body color="grey-700" weight="Regular">
{I18n.t("idpay.code.onboarding.body1")}
</Body>
<Body color="grey-700" weight="Semibold">
{I18n.t("idpay.code.onboarding.bodyBold")}
</Body>
<Body weight="Semibold" asLink onPress={presentCieBottomSheet}>
{I18n.t("idpay.code.onboarding.bodyCta")}
</Body>
<VSpacer size={24} />
<CodeDisplayComponent code={idPayCode} />
<VSpacer size={24} />
<Banner
color="neutral"
pictogramName="security"
size="big"
viewRef={bannerRef}
title={I18n.t("idpay.code.onboarding.banner.header")}
content={I18n.t("idpay.code.onboarding.banner.body")}
/>
</ContentWrapper>
<SafeAreaView style={IOStyles.horizontalContentPadding}>
<ButtonSolid
accessibilityLabel={buttonLabel}
label={buttonLabel}
fullWidth={true}
onPress={handleContinue}
testID="actionButtonTestID"
/>
</SafeAreaView>
<CodeDisplayComponent code={idPayCode} />
<VSpacer size={24} />
<Banner
color="neutral"
pictogramName="security"
size="big"
viewRef={bannerRef}
title={I18n.t("idpay.code.onboarding.banner.header")}
content={I18n.t("idpay.code.onboarding.banner.body")}
/>
</LoadingSpinnerOverlay>
{bottomSheet}
</>
</IOScrollViewWithLargeHeader>
);
};

Expand Down
55 changes: 29 additions & 26 deletions ts/features/idpay/code/screens/IdPayCodeRenewScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import {
Body,
H2,
IOStyles,
ListItemAction,
VSpacer
} from "@pagopa/io-app-design-system";
import { ListItemAction } from "@pagopa/io-app-design-system";
import { useNavigation } from "@react-navigation/native";
import * as React from "react";
import { Alert, View } from "react-native";
import { Alert } from "react-native";
import { IOScrollViewWithLargeHeader } from "../../../../components/ui/IOScrollViewWithLargeHeader";
import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel";
import I18n from "../../../../i18n";
import {
Expand Down Expand Up @@ -63,25 +58,33 @@ export const IdPayCodeRenewScreen = () => {
});

return (
<>
<View style={IOStyles.horizontalContentPadding}>
<H2>{I18n.t("idpay.code.renew.screen.header")}</H2>
<VSpacer size={16} />
<Body>{I18n.t("idpay.code.renew.screen.body")}</Body>
<Body weight="Semibold" asLink onPress={presentCieBottomSheet}>
{I18n.t("idpay.code.renew.screen.link")}
</Body>
<VSpacer size={16} />
<ListItemAction
label={I18n.t("idpay.code.renew.screen.generateCTA")}
onPress={() => customAlert(handleConfirm)}
icon="change"
accessibilityLabel={I18n.t("idpay.code.renew.screen.generateCTA")}
variant="danger"
/>
</View>
<IOScrollViewWithLargeHeader
title={{
label: I18n.t("idpay.code.renew.screen.header")
}}
description={[
{ text: I18n.t("idpay.code.renew.screen.body") },
{ text: "\n" },
{
text: I18n.t("idpay.code.renew.screen.link"),
onPress: presentCieBottomSheet,
weight: "Semibold",
asLink: true
}
]}
contextualHelp={emptyContextualHelp}
headerActionsProp={{ showHelp: true }}
includeContentMargins
>
<ListItemAction
label={I18n.t("idpay.code.renew.screen.generateCTA")}
onPress={() => customAlert(handleConfirm)}
icon="change"
accessibilityLabel={I18n.t("idpay.code.renew.screen.generateCTA")}
variant="danger"
/>
{bottomSheet}
</>
</IOScrollViewWithLargeHeader>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ describe("IdPayCodeDisplayScreen", () => {

fireEvent(button, "onPress");

expect(mockReplace).toBeCalledWith(IdPayCodeRoutes.IDPAY_CODE_MAIN, {
screen: IdPayCodeRoutes.IDPAY_CODE_RESULT
});
expect(mockReplace).toHaveBeenCalledWith(
IdPayCodeRoutes.IDPAY_CODE_MAIN,
{
screen: IdPayCodeRoutes.IDPAY_CODE_RESULT
}
);
});
});

Expand All @@ -83,7 +86,7 @@ describe("IdPayCodeDisplayScreen", () => {

fireEvent(button, "onPress");

expect(mockPop).toBeCalled();
expect(mockPop).toHaveBeenCalled();
});
});
});
Expand Down
Loading
Loading