Skip to content

Commit ea4bd47

Browse files
author
BountyCoder
committed
Add GoodDollar header and primary-identity card to connect-a-wallet-widget
Every widget in this repo renders its own GoodDollar/chain-badge header inside its own view (see StreamingWidgetView) rather than relying on the shared MiniAppShell for it — this widget was missing that, and the "Primary verified identity" card showing which host address is linking from, per the #113 design reference. Regenerated Playwright screenshots to reflect both changes.
1 parent 9c7cf47 commit ea4bd47

9 files changed

Lines changed: 72 additions & 1 deletion

File tree

packages/connect-a-wallet-widget/src/components/ConnectAWalletWidgetView.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React from 'react'
2-
import { Alert, ButtonText, Heading, Spinner } from '@goodwidget/ui'
2+
import { Alert, Badge, BadgeText, ButtonText, Heading, Spinner, XStack } from '@goodwidget/ui'
33
import type { ConnectAWalletWidgetAdapterResult } from '../widgetRuntimeContract'
44
import { AddressLinkForm } from './AddressLinkForm'
55
import { ChainLinkRow } from './ChainLinkRow'
6+
import { PrimaryIdentityCard } from './PrimaryIdentityCard'
67
import { ActionButton, EmptyStateCard, WidgetContent } from './shared'
78
import { WalletGate } from './WalletGate'
89

@@ -17,9 +18,24 @@ export function ConnectAWalletWidgetView({
1718
}: ConnectAWalletWidgetViewProps) {
1819
const { state, actions } = adapter
1920

21+
// Every widget in this repo renders its own "GoodDollar" + active-chain
22+
// header rather than relying on the host shell for it (see
23+
// StreamingWidgetView) — matches the #113 design reference's top bar.
24+
const header = (
25+
<XStack justifyContent="space-between" alignItems="center" paddingHorizontal="$1">
26+
<Heading level={4}>GoodDollar</Heading>
27+
{state.activeChainId && (
28+
<Badge type={state.isActiveChainSupported ? 'info' : 'warning'}>
29+
<BadgeText>Chain {state.activeChainId}</BadgeText>
30+
</Badge>
31+
)}
32+
</XStack>
33+
)
34+
2035
if (!state.isWalletConnected) {
2136
return (
2237
<WidgetContent data-testid={dataTestId}>
38+
{header}
2339
<WalletGate
2440
isWalletConnected={state.isWalletConnected}
2541
isConnecting={state.status === 'connecting'}
@@ -31,6 +47,10 @@ export function ConnectAWalletWidgetView({
3147

3248
return (
3349
<WidgetContent data-testid={dataTestId}>
50+
{header}
51+
52+
<PrimaryIdentityCard walletAddress={state.walletAddress} />
53+
3454
{!state.isActiveChainSupported && (
3555
<Alert
3656
type="warning"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React from 'react'
2+
import { AddressDisplay, Icon, Text, XStack, YStack, createComponent } from '@goodwidget/ui'
3+
4+
const IdentityIconBadge = createComponent(YStack, {
5+
name: 'PrimaryIdentityIconBadge',
6+
width: 36,
7+
height: 36,
8+
borderRadius: '$full',
9+
alignItems: 'center',
10+
justifyContent: 'center',
11+
backgroundColor: '$infoMuted',
12+
})
13+
14+
const IdentityCard = createComponent(XStack, {
15+
name: 'PrimaryIdentityCard',
16+
alignItems: 'center',
17+
gap: '$3',
18+
padding: '$3',
19+
borderRadius: '$3',
20+
borderWidth: 1,
21+
borderColor: '$borderColor',
22+
})
23+
24+
interface PrimaryIdentityCardProps {
25+
walletAddress: string | null
26+
}
27+
28+
/**
29+
* Shows which address the per-chain rows below are linking *from* — the
30+
* connected host wallet, i.e. the user's GoodID primary identity. Mirrors
31+
* the "Primary Verified Identity" card in the #113 design reference.
32+
*/
33+
export function PrimaryIdentityCard({ walletAddress }: PrimaryIdentityCardProps) {
34+
if (!walletAddress) {
35+
return null
36+
}
37+
38+
return (
39+
<IdentityCard data-testid="connect-a-wallet-widget-primary-identity">
40+
<IdentityIconBadge>
41+
<Icon name="shield-check" size="sm" color="primary" />
42+
</IdentityIconBadge>
43+
<YStack flex={1} gap="$0.5">
44+
<Text variant="label" tone="secondary" fontWeight="700">
45+
Primary verified identity
46+
</Text>
47+
<AddressDisplay address={walletAddress} size="sm" />
48+
</YStack>
49+
</IdentityCard>
50+
)
51+
}
3.85 KB
Loading
3.85 KB
Loading
10.8 KB
Loading
10.8 KB
Loading
9.94 KB
Loading
10.4 KB
Loading
11.7 KB
Loading

0 commit comments

Comments
 (0)