Skip to content

Commit

Permalink
refactor: Proof request attributes (#1347)
Browse files Browse the repository at this point in the history
Signed-off-by: al-rosenthal <[email protected]>
  • Loading branch information
al-rosenthal authored Dec 11, 2024
1 parent da17657 commit e4bb384
Show file tree
Hide file tree
Showing 13 changed files with 1,633 additions and 1,447 deletions.
21 changes: 13 additions & 8 deletions packages/legacy/core/App/components/misc/CredentialCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTheme } from '../../contexts/theme'
import { GenericFn } from '../../types/fn'

import CredentialCard10 from './CredentialCard10'
import CredentialCard11 from './CredentialCard11'
import CredentialCard11, { CredentialErrors } from './CredentialCard11'
import OpenIDCredentialCard from '../../modules/openid/components/OpenIDCredentialCard'
import { GenericCredentialExchangeRecord } from '../../types/credentials'

Expand All @@ -21,9 +21,8 @@ interface CredentialCardProps {
style?: ViewStyle
proof?: boolean
displayItems?: (Attribute | Predicate)[]
existsInWallet?: boolean
satisfiedPredicates?: boolean
hasAltCredentials?: boolean
credentialErrors?: CredentialErrors[]
handleAltCredChange?: () => void
}

Expand All @@ -34,12 +33,11 @@ const CredentialCard: React.FC<CredentialCardProps> = ({
proof,
displayItems,
credName,
existsInWallet,
satisfiedPredicates,
hasAltCredentials,
handleAltCredChange,
style = {},
onPress = undefined,
credentialErrors,
}) => {
// add ability to reference credential by ID, allows us to get past react hook restrictions
const [bundleResolver] = useServices([TOKENS.UTIL_OCA_RESOLVER])
Expand All @@ -50,8 +48,6 @@ const CredentialCard: React.FC<CredentialCardProps> = ({
<CredentialCard11
displayItems={displayItems}
style={{ backgroundColor: ColorPallet.brand.secondaryBackground }}
error={!existsInWallet}
predicateError={!satisfiedPredicates}
credName={credName}
credDefId={credDefId}
schemaId={schemaId}
Expand All @@ -60,6 +56,7 @@ const CredentialCard: React.FC<CredentialCardProps> = ({
hasAltCredentials={hasAltCredentials}
proof
elevated
credentialErrors={credentialErrors ?? []}
/>
)
}
Expand All @@ -68,7 +65,14 @@ const CredentialCard: React.FC<CredentialCardProps> = ({
if (type === BrandingOverlayType.Branding01) {
return <CredentialCard10 credential={credential as CredentialExchangeRecord} style={style} onPress={onPress} />
} else {
return <CredentialCard11 credential={credential as CredentialExchangeRecord} style={style} onPress={onPress} />
return (
<CredentialCard11
credential={credential as CredentialExchangeRecord}
style={style}
onPress={onPress}
credentialErrors={credentialErrors ?? []}
/>
)
}
} else {
return (
Expand All @@ -79,6 +83,7 @@ const CredentialCard: React.FC<CredentialCardProps> = ({
displayItems={displayItems}
style={style}
onPress={onPress}
credentialErrors={credentialErrors ?? []}
/>
)
}
Expand Down
Loading

0 comments on commit e4bb384

Please sign in to comment.