-
Notifications
You must be signed in to change notification settings - Fork 16
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: federation in the wallet #238
Merged
Merged
Changes from 3 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
697ff0c
feat: federation in the wallet
janrtvld 7c19153
chore: cleanup
janrtvld 1111d92
chore: type
janrtvld 41cd2c3
feat: federation details
janrtvld 9579682
feat: done
janrtvld f197a17
chore: rename
janrtvld f0ffc50
feat: working
janrtvld bc0c341
feat: final fixes
janrtvld abe86d1
chore: back to funke
janrtvld 8e4d3bb
fix: ci
janrtvld f242f43
Merge branch 'main' into feat/federation-in-the-wallet
TimoGlastra 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { FunkeFederationDetailScreen } from '@easypid/features/wallet/FunkeFederationDetailScreen' | ||
import { useLocalSearchParams } from 'expo-router' | ||
|
||
export default function Screen() { | ||
const { entityId, trustedEntityIds, name, logo } = useLocalSearchParams() | ||
|
||
const trustedEntityIdsArray = Array.isArray(trustedEntityIds) ? trustedEntityIds : trustedEntityIds?.split(',') ?? [] | ||
|
||
return ( | ||
<FunkeFederationDetailScreen | ||
entityId={entityId as string} | ||
trustedEntityIds={trustedEntityIdsArray} | ||
name={name as string} | ||
logo={logo as string} | ||
/> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,8 +25,8 @@ interface VerifyPartySlideProps { | |||||
logo?: DisplayImage | ||||||
backgroundColor?: string | ||||||
lastInteractionDate?: string | ||||||
approvalsCount?: number | ||||||
onContinue?: () => Promise<void> | ||||||
verifiedEntityIds?: Record<string, boolean> | ||||||
} | ||||||
|
||||||
export const VerifyPartySlide = ({ | ||||||
|
@@ -36,14 +36,18 @@ export const VerifyPartySlide = ({ | |||||
logo, | ||||||
backgroundColor, | ||||||
lastInteractionDate, | ||||||
approvalsCount, | ||||||
onContinue, | ||||||
verifiedEntityIds, | ||||||
}: VerifyPartySlideProps) => { | ||||||
const router = useRouter() | ||||||
const { onNext, onCancel } = useWizard() | ||||||
const { withHaptics } = useHaptics() | ||||||
const [isLoading, setIsLoading] = useState(false) | ||||||
|
||||||
const trustedEntityIds = Object.entries(verifiedEntityIds ?? {}) | ||||||
.filter(([_, isVerified]) => isVerified) | ||||||
.map(([entityId]) => entityId) | ||||||
|
||||||
const handleContinue = async () => { | ||||||
setIsLoading(true) | ||||||
if (onContinue) { | ||||||
|
@@ -54,7 +58,9 @@ export const VerifyPartySlide = ({ | |||||
} | ||||||
|
||||||
const onPressVerifiedIssuer = withHaptics(() => { | ||||||
router.push(`/issuer?entityId=${entityId}`) | ||||||
router.push( | ||||||
`/issuer?name=${name}&logo=${logo?.url}&entityId=${entityId}&trustedEntityIds=${trustedEntityIds?.join(',') ?? ''}` | ||||||
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. The route changd right?
Suggested change
|
||||||
) | ||||||
}) | ||||||
|
||||||
const onPressInteraction = withHaptics(() => { | ||||||
|
@@ -93,15 +99,20 @@ export const VerifyPartySlide = ({ | |||||
</YStack> | ||||||
|
||||||
<YStack gap="$4"> | ||||||
{approvalsCount ? ( | ||||||
{trustedEntityIds && trustedEntityIds.length > 0 ? ( | ||||||
<InfoButton | ||||||
variant="positive" | ||||||
variant="unknown" | ||||||
title="Verified organisation" | ||||||
description={`Approved by ${approvalsCount} organisations`} | ||||||
description={`Approved by ${trustedEntityIds?.length} organisations`} | ||||||
onPress={onPressVerifiedIssuer} | ||||||
/> | ||||||
) : ( | ||||||
<InfoButton variant="unknown" title="Unverified organization" description="No trust approvals found" /> | ||||||
<InfoButton | ||||||
variant="unknown" | ||||||
title="Unverified organization" | ||||||
description="No trust approvals found" | ||||||
onPress={onPressVerifiedIssuer} | ||||||
/> | ||||||
)} | ||||||
<InfoButton | ||||||
variant={lastInteractionDate ? 'interaction-success' : 'interaction-new'} | ||||||
|
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 |
---|---|---|
|
@@ -122,6 +122,7 @@ export function FunkeMdocOfflineSharingScreen({ | |
hostName: undefined, | ||
logo: undefined, | ||
name: 'Unknown party', | ||
verifiedEntityIds: undefined, | ||
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. error? |
||
}, | ||
}, | ||
status | ||
|
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
125 changes: 125 additions & 0 deletions
125
apps/easypid/src/features/wallet/FunkeFederationDetailScreen.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,125 @@ | ||
import { | ||
Circle, | ||
FlexPage, | ||
Heading, | ||
HeroIcons, | ||
IconContainer, | ||
Image, | ||
MessageBox, | ||
Paragraph, | ||
ScrollView, | ||
type ScrollViewRefType, | ||
XStack, | ||
YStack, | ||
} from '@package/ui' | ||
import { useTrustedEntities } from 'packages/agent/src' | ||
import { TextBackButton, useScrollViewPosition } from 'packages/app/src' | ||
import { useRef } from 'react' | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context' | ||
|
||
interface FunkeFederationDetailScreenProps { | ||
name: string | ||
logo?: string | ||
entityId?: string | ||
trustedEntityIds?: string[] | ||
} | ||
|
||
export function FunkeFederationDetailScreen({ | ||
name, | ||
logo, | ||
entityId, | ||
trustedEntityIds = [], | ||
}: FunkeFederationDetailScreenProps) { | ||
const { trustedEntities } = useTrustedEntities() | ||
|
||
const { handleScroll, isScrolledByOffset, scrollEventThrottle } = useScrollViewPosition() | ||
const { bottom } = useSafeAreaInsets() | ||
const scrollViewRef = useRef<ScrollViewRefType>(null) | ||
|
||
return ( | ||
<FlexPage gap="$0" paddingHorizontal="$0"> | ||
<YStack | ||
w="100%" | ||
top={0} | ||
p="$4" | ||
borderBottomWidth="$0.5" | ||
borderColor={isScrolledByOffset ? '$grey-200' : '$background'} | ||
/> | ||
<ScrollView ref={scrollViewRef} onScroll={handleScroll} scrollEventThrottle={scrollEventThrottle}> | ||
<YStack gap="$4" p="$4" marginBottom={bottom}> | ||
<Heading variant="h1">About this party</Heading> | ||
<MessageBox | ||
variant="light" | ||
message="Always consider whether sharing with a party is wise." | ||
icon={<HeroIcons.ExclamationTriangleFilled />} | ||
/> | ||
<XStack gap="$4" pt="$2"> | ||
{logo ? ( | ||
<Circle overflow="hidden" ai="center" jc="center" size="$6" bw={1} borderColor="$grey-200" bg="$grey-100"> | ||
<Image src={logo} height="100%" width="100%" /> | ||
</Circle> | ||
) : ( | ||
<Circle overflow="hidden" ai="center" jc="center" size="$6" bw={1} borderColor="$grey-200" bg="$grey-100"> | ||
<HeroIcons.BuildingOffice color="$grey-700" /> | ||
</Circle> | ||
)} | ||
<YStack> | ||
<Heading variant="h2">{name}</Heading> | ||
<Paragraph fontWeight="$medium" color="$primary-500"> | ||
Website | ||
</Paragraph> | ||
</YStack> | ||
</XStack> | ||
<YStack gap="$4" py="$2"> | ||
<YStack gap="$2"> | ||
<Heading variant="sub2">Trusted by</Heading> | ||
<Paragraph> | ||
A list of organizations and whether they have approved{' '} | ||
<Paragraph fontWeight="$semiBold">{name}</Paragraph>. | ||
</Paragraph> | ||
</YStack> | ||
<YStack gap="$2"> | ||
{trustedEntities.map((entity) => { | ||
const isTrusted = trustedEntityIds.includes(entity.entity_id) | ||
janrtvld marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return ( | ||
<XStack | ||
ai="center" | ||
key={entity.entity_id} | ||
br="$8" | ||
p="$3.5" | ||
gap="$3" | ||
bw="$0.5" | ||
borderColor={isTrusted ? '$success-500' : '$danger-300'} | ||
bg={isTrusted ? '$success-500' : '$danger-300'} | ||
> | ||
{entity.logo_uri && ( | ||
<Circle overflow="hidden" size="$4" bg="$grey-50"> | ||
<Image src={entity.logo_uri} height="100%" width="100%" /> | ||
</Circle> | ||
)} | ||
<XStack gap="$1" f={1} justifyContent="space-between"> | ||
<Heading variant="h2">{entity.organization_name}</Heading> | ||
<IconContainer | ||
icon={ | ||
isTrusted ? ( | ||
<HeroIcons.CheckCircleFilled color="$success-500" /> | ||
) : ( | ||
<HeroIcons.X color="$danger-500" /> | ||
) | ||
} | ||
/> | ||
</XStack> | ||
</XStack> | ||
) | ||
})} | ||
</YStack> | ||
</YStack> | ||
</YStack> | ||
</ScrollView> | ||
<YStack btw="$0.5" borderColor="$grey-200" pt="$4" mx="$-4" px="$4" bg="$background"> | ||
<TextBackButton /> | ||
</YStack> | ||
</FlexPage> | ||
) | ||
} |
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.
We can provide the types here