-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: federation in the wallet (#238)
Signed-off-by: Jan <[email protected]> Co-authored-by: Timo Glastra <[email protected]>
- Loading branch information
1 parent
a16b1ef
commit 03cecfb
Showing
15 changed files
with
199 additions
and
224 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { FunkeFederationDetailScreen } from '@easypid/features/wallet/FunkeFederationDetailScreen' | ||
import type { TrustedEntity } from '@package/agent' | ||
import { useLocalSearchParams } from 'expo-router' | ||
|
||
export default function Screen() { | ||
const { entityId, trustedEntities, name, logo } = useLocalSearchParams() | ||
|
||
const trustedEntitiesArray = JSON.parse(decodeURIComponent(trustedEntities as string)) as Array<TrustedEntity> | ||
|
||
return ( | ||
<FunkeFederationDetailScreen | ||
entityId={entityId as string} | ||
trustedEntities={trustedEntitiesArray} | ||
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
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
104 changes: 104 additions & 0 deletions
104
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,104 @@ | ||
import type { TrustedEntity } from '@package/agent' | ||
import { | ||
Circle, | ||
FlexPage, | ||
Heading, | ||
HeroIcons, | ||
IconContainer, | ||
Image, | ||
MessageBox, | ||
Paragraph, | ||
ScrollView, | ||
type ScrollViewRefType, | ||
XStack, | ||
YStack, | ||
} from '@package/ui' | ||
import { TextBackButton, useScrollViewPosition } from 'packages/app/src' | ||
import React, { useRef } from 'react' | ||
import { useSafeAreaInsets } from 'react-native-safe-area-context' | ||
|
||
interface FunkeFederationDetailScreenProps { | ||
name: string | ||
logo?: string | ||
entityId?: string | ||
trustedEntities?: Array<TrustedEntity> | ||
} | ||
|
||
export function FunkeFederationDetailScreen({ | ||
name, | ||
logo, | ||
entityId, | ||
trustedEntities = [], | ||
}: FunkeFederationDetailScreenProps) { | ||
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" ai="center"> | ||
{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> | ||
)} | ||
<Heading variant="h2">{name}</Heading> | ||
</XStack> | ||
<YStack gap="$4" py="$2"> | ||
<YStack gap="$2"> | ||
<Heading variant="sub2">Trusted by</Heading> | ||
<Paragraph> | ||
{trustedEntities.length > 0 ? ( | ||
<>A list of organizations and whether they have approved {name}.</> | ||
) : ( | ||
<>There are no organizations that have approved {name}.</> | ||
)} | ||
</Paragraph> | ||
</YStack> | ||
<YStack gap="$2"> | ||
{trustedEntities.map((entity) => { | ||
return ( | ||
<XStack ai="center" key={entity.entity_id} br="$8" p="$3.5" gap="$3" bg="$grey-100"> | ||
{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" ai="center"> | ||
<Heading f={1} numberOfLines={2} variant="h2"> | ||
{entity.organization_name} | ||
</Heading> | ||
<IconContainer icon={<HeroIcons.CheckCircleFilled size={30} color="$positive-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.