-
Notifications
You must be signed in to change notification settings - Fork 152
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: unify UI for DIDComm and OpenID flows for Offer and details screens #1365
Merged
jleach
merged 11 commits into
openwallet-foundation:main
from
MosCD3:sandbox/moscd3/openID-OCA-details-offer
Jan 9, 2025
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
04476ec
Unify UI for Didcomm and OpenID flows for Offer and details screens
MosCD3 a437e69
rebase
MosCD3 dac70b1
component re-use
MosCD3 d23794d
Merge branch 'main' into sandbox/moscd3/openID-OCA-details-offer
MosCD3 016a7e2
adding logo to branding overlay
MosCD3 ccde877
Merge branch 'main' into sandbox/moscd3/openID-OCA-details-offer
MosCD3 af402b1
resolve comments
MosCD3 06e41b9
Merge branch 'main' into sandbox/moscd3/openID-OCA-details-offer
MosCD3 4479a96
Merge branch 'main' into sandbox/moscd3/openID-OCA-details-offer
jleach 6cb6b99
Merge branch 'main' into sandbox/moscd3/openID-OCA-details-offer
jleach c567266
Merge branch 'main' into sandbox/moscd3/openID-OCA-details-offer
jleach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
58 changes: 58 additions & 0 deletions
58
packages/legacy/core/App/components/views/CredentialCardLogo.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,58 @@ | ||
import { Image, StyleSheet, Text, View } from 'react-native' | ||
import { BrandingOverlay } from '@hyperledger/aries-oca' | ||
import { CredentialOverlay } from '@hyperledger/aries-oca/build/legacy' | ||
import { useTheme } from '../../contexts/theme' | ||
import { toImageSource } from '../../utils/credential' | ||
|
||
type Props = { | ||
overlay: CredentialOverlay<BrandingOverlay> | ||
} | ||
|
||
const logoHeight = 80 | ||
const paddingHorizontal = 24 | ||
|
||
const CredentialCardLogo: React.FC<Props> = ({ overlay }: Props) => { | ||
const { TextTheme } = useTheme() | ||
|
||
const styles = StyleSheet.create({ | ||
logoContainer: { | ||
top: -0.5 * logoHeight, | ||
left: paddingHorizontal, | ||
marginBottom: -1 * logoHeight, | ||
width: logoHeight, | ||
height: logoHeight, | ||
backgroundColor: '#ffffff', | ||
borderRadius: 8, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
shadowColor: '#000', | ||
shadowOffset: { | ||
width: 1, | ||
height: 1, | ||
}, | ||
shadowOpacity: 0.3, | ||
}, | ||
}) | ||
|
||
return ( | ||
<View style={styles.logoContainer}> | ||
{overlay.brandingOverlay?.logo ? ( | ||
<Image | ||
source={toImageSource(overlay.brandingOverlay?.logo)} | ||
style={{ | ||
resizeMode: 'cover', | ||
width: logoHeight, | ||
height: logoHeight, | ||
borderRadius: 8, | ||
}} | ||
/> | ||
) : ( | ||
<Text style={[TextTheme.title, { fontSize: 0.5 * logoHeight, color: '#000' }]}> | ||
{(overlay.metaOverlay?.name ?? overlay.metaOverlay?.issuer ?? 'C')?.charAt(0).toUpperCase()} | ||
</Text> | ||
)} | ||
</View> | ||
) | ||
} | ||
|
||
export default CredentialCardLogo |
72 changes: 72 additions & 0 deletions
72
packages/legacy/core/App/components/views/CredentialDetailPrimaryHeader.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,72 @@ | ||
import { StyleSheet, Text, useWindowDimensions, View } from 'react-native' | ||
import { BrandingOverlay } from '@hyperledger/aries-oca' | ||
import { CredentialOverlay } from '@hyperledger/aries-oca/build/legacy' | ||
import CardWatermark from '../../components/misc/CardWatermark' | ||
import { useTheme } from '../../contexts/theme' | ||
import { credentialTextColor } from '../../utils/credential' | ||
import { testIdWithKey } from '../../utils/testable' | ||
|
||
type Props = { | ||
overlay: CredentialOverlay<BrandingOverlay> | ||
} | ||
|
||
const paddingHorizontal = 24 | ||
const paddingVertical = 16 | ||
const logoHeight = 80 | ||
|
||
const CredentialDetailPrimaryHeader: React.FC<Props> = ({ overlay }: Props) => { | ||
const { TextTheme, ColorPallet } = useTheme() | ||
const { width, height } = useWindowDimensions() | ||
const styles = StyleSheet.create({ | ||
primaryHeaderContainer: { | ||
paddingHorizontal, | ||
paddingVertical, | ||
}, | ||
textContainer: { | ||
color: credentialTextColor(ColorPallet, overlay.brandingOverlay?.primaryBackgroundColor), | ||
}, | ||
}) | ||
|
||
return ( | ||
<View | ||
testID={testIdWithKey('CredentialDetailsPrimaryHeader')} | ||
style={[styles.primaryHeaderContainer, { zIndex: -1 }]} | ||
> | ||
<View> | ||
{overlay.metaOverlay?.watermark && ( | ||
<CardWatermark width={width} height={height} watermark={overlay.metaOverlay?.watermark} /> | ||
)} | ||
<Text | ||
testID={testIdWithKey('CredentialIssuer')} | ||
style={[ | ||
TextTheme.label, | ||
styles.textContainer, | ||
{ | ||
paddingLeft: logoHeight + paddingVertical, | ||
paddingBottom: paddingVertical, | ||
lineHeight: 19, | ||
opacity: 0.8, | ||
}, | ||
]} | ||
numberOfLines={1} | ||
> | ||
{overlay.metaOverlay?.issuer} | ||
</Text> | ||
<Text | ||
testID={testIdWithKey('CredentialName')} | ||
style={[ | ||
TextTheme.normal, | ||
styles.textContainer, | ||
{ | ||
lineHeight: 24, | ||
}, | ||
]} | ||
> | ||
{overlay.metaOverlay?.name} | ||
</Text> | ||
</View> | ||
</View> | ||
) | ||
} | ||
|
||
export default CredentialDetailPrimaryHeader |
43 changes: 43 additions & 0 deletions
43
packages/legacy/core/App/components/views/CredentialDetailSecondaryHeader.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,43 @@ | ||
import React from 'react' | ||
import { BrandingOverlay } from '@hyperledger/aries-oca' | ||
import { CredentialOverlay } from '@hyperledger/aries-oca/build/legacy' | ||
import { ImageBackground, StyleSheet, View } from 'react-native' | ||
import { toImageSource } from '../../utils/credential' | ||
import { testIdWithKey } from '../../utils/testable' | ||
|
||
type Props = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
overlay: CredentialOverlay<BrandingOverlay> | ||
} | ||
|
||
const logoHeight = 80 | ||
|
||
const CredentialDetailSecondaryHeader: React.FC<Props> = ({ overlay }: Props) => { | ||
const styles = StyleSheet.create({ | ||
secondaryHeaderContainer: { | ||
height: 1.5 * logoHeight, | ||
backgroundColor: | ||
(overlay.brandingOverlay?.backgroundImage | ||
? 'rgba(0, 0, 0, 0)' | ||
: overlay.brandingOverlay?.secondaryBackgroundColor) ?? 'rgba(0, 0, 0, 0.24)', | ||
}, | ||
}) | ||
|
||
return ( | ||
<> | ||
{overlay.brandingOverlay?.backgroundImage ? ( | ||
<ImageBackground | ||
source={toImageSource(overlay.brandingOverlay?.backgroundImage)} | ||
imageStyle={{ | ||
resizeMode: 'cover', | ||
}} | ||
> | ||
<View testID={testIdWithKey('CredentialDetailsSecondaryHeader')} style={styles.secondaryHeaderContainer} /> | ||
</ImageBackground> | ||
) : ( | ||
<View testID={testIdWithKey('CredentialDetailsSecondaryHeader')} style={styles.secondaryHeaderContainer} /> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
export default CredentialDetailSecondaryHeader |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Able to rename to
CredentialDetailPrimaryHeaderProps
to follow the app convetion?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done