-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
129 additions
and
11 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
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
98 changes: 98 additions & 0 deletions
98
ts/features/it-wallet/screens/credential/ItwCredentialDetailsScreen.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,98 @@ | ||
import React from "react"; | ||
import { RouteProp, useRoute } from "@react-navigation/native"; | ||
import { | ||
Banner, | ||
BlockButtonProps, | ||
FooterWithButtons, | ||
VSpacer | ||
} from "@pagopa/io-app-design-system"; | ||
import { ScrollView } from "react-native-gesture-handler"; | ||
import { SafeAreaView, View } from "react-native"; | ||
import { constNull } from "fp-ts/lib/function"; | ||
import ItwCredentialCard from "../../components/ItwCredentialCard"; | ||
import { IOStyles } from "../../../../components/core/variables/IOStyles"; | ||
import BaseScreenComponent from "../../../../components/screens/BaseScreenComponent"; | ||
import I18n from "../../../../i18n"; | ||
import { emptyContextualHelp } from "../../../../utils/emptyContextualHelp"; | ||
import { ItwParamsList } from "../../navigation/ItwParamsList"; | ||
import ItwCredentialClaimsList from "../../components/ItwCredentialClaimsList"; | ||
import { StoredCredential } from "../../store/reducers/itwCredentialsReducer"; | ||
|
||
export type ItwCredentialDetailsScreenNavigationParams = { | ||
credential: StoredCredential; | ||
}; | ||
|
||
type ItwCredentialDetailscreenRouteProps = RouteProp< | ||
ItwParamsList, | ||
"ITW_CREDENTIAL_PRESENTATION_DETAILS" | ||
>; | ||
|
||
/** | ||
* Renders a preview screen which displays a visual representation and the claims contained in the credential. | ||
*/ | ||
const ItwCredentialDetailsScreen = () => { | ||
const route = useRoute<ItwCredentialDetailscreenRouteProps>(); | ||
const { credential } = route.params; | ||
const bannerViewRef = React.createRef<View>(); | ||
|
||
/** | ||
* Content view which asks the user to confirm the issuance of the credential. | ||
* @param data - the issuance result data of the credential used to display the credential. | ||
*/ | ||
const ContentView = ({ data }: { data: StoredCredential }) => { | ||
const presentationButton: BlockButtonProps = { | ||
type: "Solid", | ||
buttonProps: { | ||
label: I18n.t( | ||
"features.itWallet.presentation.credentialDetails.buttons.qrCode" | ||
), | ||
accessibilityLabel: I18n.t( | ||
"features.itWallet.presentation.credentialDetails.buttons.qrCode" | ||
), | ||
onPress: () => null | ||
} | ||
}; | ||
|
||
return ( | ||
<BaseScreenComponent goBack={true} contextualHelp={emptyContextualHelp}> | ||
<SafeAreaView style={IOStyles.flex}> | ||
<ScrollView contentContainerStyle={IOStyles.horizontalContentPadding}> | ||
<ItwCredentialCard | ||
parsedCredential={data.parsedCredential} | ||
display={data.displayData} | ||
/> | ||
<VSpacer /> | ||
<ItwCredentialClaimsList data={{ ...data, issuerName: "INPS" }} /> | ||
<VSpacer size={32} /> | ||
<Banner | ||
testID={"ItwBannerTestID"} | ||
viewRef={bannerViewRef} | ||
color={"neutral"} | ||
size="big" | ||
title={I18n.t( | ||
"features.itWallet.issuing.credentialPreviewScreen.banner.title" | ||
)} | ||
content={I18n.t( | ||
"features.itWallet.issuing.credentialPreviewScreen.banner.content" | ||
)} | ||
pictogramName={"security"} | ||
action={I18n.t( | ||
"features.itWallet.issuing.credentialPreviewScreen.banner.actionTitle" | ||
)} | ||
onPress={constNull} | ||
/> | ||
<VSpacer size={32} /> | ||
</ScrollView> | ||
<FooterWithButtons | ||
type={"SingleButton"} | ||
primary={presentationButton} | ||
/> | ||
</SafeAreaView> | ||
</BaseScreenComponent> | ||
); | ||
}; | ||
|
||
return <ContentView data={credential} />; | ||
}; | ||
|
||
export default ItwCredentialDetailsScreen; |
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