@gluwa/connect-kit 0.2.0-next.1 → 0.2.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/assets/creditwallet.png +0 -0
- package/assets/fonts/Inter-Medium.ttf +0 -0
- package/assets/fonts/Inter-Medium.woff2 +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/assets/fonts/Inter-Regular.woff2 +0 -0
- package/assets/fonts/Inter-SemiBold.ttf +0 -0
- package/assets/fonts/Inter-SemiBold.woff2 +0 -0
- package/assets/graphic.png +0 -0
- package/assets/metamask.png +0 -0
- package/assets/wc-logo.svg +3 -0
- package/assets/wc-search.png +0 -0
- package/dist/chunk-EDNRW47A.js +401 -0
- package/dist/credit-connect.js +2 -409
- package/dist/index.css +1903 -390
- package/dist/index.d.ts +17 -10
- package/dist/index.js +1118 -871
- package/dist/package.json +7 -6
- package/package.json +8 -8
- package/src/ConnectKitProvider.tsx +90 -65
- package/src/api/asset.ts +10 -0
- package/src/assets.d.ts +5 -0
- package/src/components/actionItem/index.tsx +50 -0
- package/src/components/actionItem/style.scss +47 -0
- package/src/components/copyLink/index.tsx +16 -0
- package/src/components/copyLink/style.scss +16 -0
- package/src/components/qrArea/index.tsx +70 -0
- package/src/components/qrArea/style.scss +130 -0
- package/src/components/searchBar/asset/Search.tsx +20 -0
- package/src/components/searchBar/asset/XMarkCircle.tsx +24 -0
- package/src/components/searchBar/index.tsx +44 -0
- package/src/components/searchBar/style.scss +58 -0
- package/src/components/snackbar/index.tsx +25 -0
- package/src/components/snackbar/style.scss +51 -0
- package/src/components/toggle/index.tsx +27 -0
- package/src/components/toggle/style.scss +53 -0
- package/src/components/walletGrid/index.tsx +64 -0
- package/src/components/walletGrid/style.scss +108 -0
- package/src/components/walletItem/index.tsx +49 -0
- package/src/components/walletItem/style.scss +70 -0
- package/src/connector-meta.ts +12 -7
- package/src/core/config.ts +20 -1
- package/src/creditConnectConnector.ts +17 -25
- package/src/hooks/useWCState.ts +22 -5
- package/src/hooks/useWagmiConnect.ts +0 -1
- package/src/index.ts +4 -2
- package/src/layout/allWallets/index.tsx +52 -0
- package/src/layout/allWallets/style.scss +62 -0
- package/src/layout/connectDialog/asset/backIcon.tsx +24 -0
- package/src/layout/connectDialog/asset/checkIcon.tsx +28 -0
- package/src/layout/connectDialog/asset/closeIcon.tsx +21 -0
- package/src/layout/connectDialog/asset/copyIcon.tsx +28 -0
- package/src/layout/connectDialog/asset/linkIcon.tsx +24 -0
- package/src/layout/connectDialog/asset/spinner.tsx +21 -0
- package/src/layout/connectDialog/idle/index.tsx +32 -0
- package/src/layout/connectDialog/idle/style.scss +61 -0
- package/src/layout/connectDialog/index.tsx +286 -0
- package/src/layout/connectDialog/loading/index.tsx +13 -0
- package/src/layout/connectDialog/loading/style.scss +19 -0
- package/src/layout/connectDialog/metaMask/index.tsx +61 -0
- package/src/layout/connectDialog/metaMask/style.scss +65 -0
- package/src/layout/connectDialog/qr/index.tsx +33 -0
- package/src/layout/connectDialog/style.scss +95 -0
- package/src/layout/connectDialog/timeout/index.tsx +31 -0
- package/src/layout/connectDialog/timeout/style.scss +64 -0
- package/src/layout/connectDialog/walletConnect/index.tsx +45 -0
- package/src/layout/connectDialog/walletConnect/style.scss +48 -0
- package/src/layout/connectDialog/walletQR/index.tsx +37 -0
- package/src/layout/detailPanel/index.tsx +147 -0
- package/src/layout/detailPanel/style.scss +64 -0
- package/src/layout/selectorPanel/index.tsx +100 -0
- package/src/layout/selectorPanel/style.scss +113 -0
- package/src/style/color.scss +417 -0
- package/src/style/font.scss +28 -0
- package/src/style/index.scss +5 -0
- package/src/style/mixin.scss +217 -0
- package/src/style/reset.scss +110 -0
- package/src/style/variables.scss +13 -0
- package/src/types.ts +11 -8
- package/src/utils/platform.ts +6 -0
- package/tsconfig.json +5 -1
- package/tsup.config.ts +32 -2
- package/dist/chunk-DDA6FP6U.js +0 -7
- package/src/ConnectModal.scss +0 -665
- package/src/ConnectModal.tsx +0 -573
- package/src/components/QRFrame.tsx +0 -43
- package/src/views/CreditWalletView.tsx +0 -58
- package/src/views/IdleView.tsx +0 -10
- package/src/views/MetaMaskView.tsx +0 -66
- package/src/views/SwitchChainView.tsx +0 -72
- package/src/views/WalletConnectView.tsx +0 -206
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
import { QrArea } from '../../../components/qrArea';
|
|
4
|
+
import { ActionItem } from '../../../components/actionItem';
|
|
5
|
+
|
|
6
|
+
interface WalletConnectProps {
|
|
7
|
+
uri?: string | null;
|
|
8
|
+
logoUrl?: string;
|
|
9
|
+
walletCount?: number;
|
|
10
|
+
onShowAllWallets?: () => void;
|
|
11
|
+
onCopy?: () => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const WalletConnect: FC<WalletConnectProps> = ({
|
|
15
|
+
uri,
|
|
16
|
+
logoUrl,
|
|
17
|
+
walletCount,
|
|
18
|
+
onShowAllWallets,
|
|
19
|
+
onCopy,
|
|
20
|
+
}) => {
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
<QrArea
|
|
24
|
+
uri={uri}
|
|
25
|
+
status={!uri ? 'loading' : 'ready'}
|
|
26
|
+
logoUrl={logoUrl}
|
|
27
|
+
hasBg
|
|
28
|
+
label="Scan this QR Code with your phone"
|
|
29
|
+
onCopy={onCopy}
|
|
30
|
+
/>
|
|
31
|
+
<ActionItem
|
|
32
|
+
as="button"
|
|
33
|
+
type="button"
|
|
34
|
+
className="ck-walletconnect-all-btn"
|
|
35
|
+
onClick={onShowAllWallets}
|
|
36
|
+
>
|
|
37
|
+
<span className="ck-walletconnect-all-icon" aria-hidden="true" />
|
|
38
|
+
<span className="ck-walletconnect-all-label">All Wallets</span>
|
|
39
|
+
{typeof walletCount === 'number' && walletCount > 0 && (
|
|
40
|
+
<span className="ck-walletconnect-all-badge">{walletCount}+</span>
|
|
41
|
+
)}
|
|
42
|
+
</ActionItem>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@use '../../../style/mixin.scss' as *;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
.ck-root .ck-walletconnect-copy-btn {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
gap: 6px;
|
|
8
|
+
@include textToken('body3-l1-regular');
|
|
9
|
+
color: var(--scale-gray-500);
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ck-walletconnect-copy-icon {
|
|
14
|
+
display: block;
|
|
15
|
+
width: 20px;
|
|
16
|
+
height: 20px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// ── All Wallets button ─────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
.ck-walletconnect-all-icon {
|
|
22
|
+
width: 44px;
|
|
23
|
+
height: 44px;
|
|
24
|
+
border-radius: 6px;
|
|
25
|
+
background:
|
|
26
|
+
radial-gradient(circle at 16.5px 16.5px, var(--scale-purple-500) 3px, transparent 4px),
|
|
27
|
+
radial-gradient(circle at 27.5px 16.5px, var(--scale-purple-500) 3px, transparent 4px),
|
|
28
|
+
radial-gradient(circle at 16.5px 27.5px, var(--scale-purple-500) 3px, transparent 4px),
|
|
29
|
+
radial-gradient(circle at 27.5px 27.5px, var(--scale-purple-500) 3px, transparent 4px),
|
|
30
|
+
var(--scale-gray-300);
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ck-walletconnect-all-label {
|
|
35
|
+
flex: 1;
|
|
36
|
+
@include textToken('subtitle2-bold');
|
|
37
|
+
color: var(--scale-gray-900);
|
|
38
|
+
text-align: left;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ck-walletconnect-all-badge {
|
|
42
|
+
@include textToken('caption1-bold');
|
|
43
|
+
color: var(--scale-gray-900);
|
|
44
|
+
background: var(--scale-gray-300);
|
|
45
|
+
padding: 4px 8px;
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
flex-shrink: 0;
|
|
48
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { type WCWallet } from '../../../types';
|
|
3
|
+
import { QrArea } from '../../../components/qrArea';
|
|
4
|
+
import { ActionItem } from '../../../components/actionItem';
|
|
5
|
+
|
|
6
|
+
interface WalletQRProps {
|
|
7
|
+
wallet: WCWallet;
|
|
8
|
+
uri?: string | null;
|
|
9
|
+
onCopy?: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const WalletQR: FC<WalletQRProps> = ({ wallet, uri = null, onCopy }) => {
|
|
13
|
+
const downloadUrl = wallet.appIos || wallet.appAndroid || wallet.homepage;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<>
|
|
17
|
+
<QrArea
|
|
18
|
+
uri={uri}
|
|
19
|
+
status={!uri ? 'loading' : 'ready'}
|
|
20
|
+
logoUrl={wallet.imageUrl || undefined}
|
|
21
|
+
hasBg
|
|
22
|
+
label={`Scan with ${wallet.name}`}
|
|
23
|
+
onCopy={onCopy}
|
|
24
|
+
/>
|
|
25
|
+
{downloadUrl && (
|
|
26
|
+
<ActionItem
|
|
27
|
+
as="a"
|
|
28
|
+
href={downloadUrl}
|
|
29
|
+
target="_blank"
|
|
30
|
+
rel="noopener noreferrer"
|
|
31
|
+
label={`Don't have ${wallet.name}?`}
|
|
32
|
+
action="Download"
|
|
33
|
+
/>
|
|
34
|
+
)}
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { CloseIcon } from '../connectDialog/asset/closeIcon';
|
|
3
|
+
import { BackIcon } from '../connectDialog/asset/backIcon';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
import { type ConnectorId, type WCWallet } from '../../types';
|
|
6
|
+
import { CONNECTOR_META } from '../../connector-meta';
|
|
7
|
+
import { Idle } from '../connectDialog/idle';
|
|
8
|
+
import { Loading } from '../connectDialog/loading';
|
|
9
|
+
import { QR } from '../connectDialog/qr';
|
|
10
|
+
import { Timeout } from '../connectDialog/timeout';
|
|
11
|
+
import { MetaMask } from '../connectDialog/metaMask';
|
|
12
|
+
import { WalletConnect } from '../connectDialog/walletConnect';
|
|
13
|
+
import { AllWallets } from '../allWallets';
|
|
14
|
+
import { WalletQR } from '../connectDialog/walletQR';
|
|
15
|
+
|
|
16
|
+
export type DetailContent =
|
|
17
|
+
| 'idle'
|
|
18
|
+
| 'loading'
|
|
19
|
+
| 'qr'
|
|
20
|
+
| 'timeout'
|
|
21
|
+
| 'metamask-ext'
|
|
22
|
+
| 'metamask-qr'
|
|
23
|
+
| 'walletconnect'
|
|
24
|
+
| 'all-wallets'
|
|
25
|
+
| 'wallet-qr';
|
|
26
|
+
|
|
27
|
+
interface DetailPanelProps {
|
|
28
|
+
selectedConnector: ConnectorId | null;
|
|
29
|
+
selectedWallet?: WCWallet | null;
|
|
30
|
+
content?: DetailContent;
|
|
31
|
+
/** wagmi connect 가 emit 한 QR code URI (display_uri 이벤트). null = 아직 도착 안 함. */
|
|
32
|
+
qrUri?: string | null;
|
|
33
|
+
/** WalletConnect Explorer API 의 walletList (AllWallets 그리드). */
|
|
34
|
+
wallets?: WCWallet[];
|
|
35
|
+
walletListLoading?: boolean;
|
|
36
|
+
/** Selector 의 'WC' 카운트 표시용 — 보통 walletList.length. */
|
|
37
|
+
walletCount?: number;
|
|
38
|
+
onBack: () => void;
|
|
39
|
+
onClose: () => void;
|
|
40
|
+
onShowAllWallets?: () => void;
|
|
41
|
+
onSelectWallet?: (wallet: WCWallet) => void;
|
|
42
|
+
onCopyLink?: () => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const getTitle = (content: DetailContent, connector: ConnectorId | null): string => {
|
|
46
|
+
switch (content) {
|
|
47
|
+
case 'idle':
|
|
48
|
+
return '';
|
|
49
|
+
case 'loading':
|
|
50
|
+
return connector ? CONNECTOR_META[connector].detailTitle : '';
|
|
51
|
+
case 'qr':
|
|
52
|
+
return connector ? CONNECTOR_META[connector].detailTitle : '';
|
|
53
|
+
case 'timeout':
|
|
54
|
+
return connector ? CONNECTOR_META[connector].detailTitle : '';
|
|
55
|
+
case 'metamask-ext':
|
|
56
|
+
return 'MetaMask';
|
|
57
|
+
case 'metamask-qr':
|
|
58
|
+
return 'Scan with MetaMask';
|
|
59
|
+
case 'walletconnect':
|
|
60
|
+
return 'Scan with WalletConnect';
|
|
61
|
+
case 'all-wallets':
|
|
62
|
+
return 'All Wallets';
|
|
63
|
+
case 'wallet-qr':
|
|
64
|
+
return '';
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const DetailPanel: FC<DetailPanelProps> = ({
|
|
69
|
+
selectedConnector,
|
|
70
|
+
selectedWallet = null,
|
|
71
|
+
content = 'idle',
|
|
72
|
+
qrUri = null,
|
|
73
|
+
wallets = [],
|
|
74
|
+
walletListLoading = false,
|
|
75
|
+
walletCount,
|
|
76
|
+
onBack,
|
|
77
|
+
onClose,
|
|
78
|
+
onShowAllWallets,
|
|
79
|
+
onSelectWallet,
|
|
80
|
+
onCopyLink,
|
|
81
|
+
}) => {
|
|
82
|
+
// CONNECTOR_META 에서 활성 connector 의 logo / downloadUrl 가져옴.
|
|
83
|
+
const connectorMeta = selectedConnector ? CONNECTOR_META[selectedConnector] : null;
|
|
84
|
+
const connectorLogoUrl = connectorMeta?.logoUrl;
|
|
85
|
+
const connectorDownloadUrl = connectorMeta?.downloadUrl;
|
|
86
|
+
const title =
|
|
87
|
+
selectedWallet && content === 'wallet-qr'
|
|
88
|
+
? `Scan with ${selectedWallet.name}`
|
|
89
|
+
: getTitle(content, selectedConnector);
|
|
90
|
+
const showBack = content !== 'idle';
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<section className="ck-detail">
|
|
94
|
+
<header className="ck-detail-header">
|
|
95
|
+
{showBack && (
|
|
96
|
+
<button type="button" className="ck-btn-back" onClick={onBack} aria-label="Back">
|
|
97
|
+
<BackIcon />
|
|
98
|
+
</button>
|
|
99
|
+
)}
|
|
100
|
+
{title ? (
|
|
101
|
+
<h2 className="ck-detail-title">{title}</h2>
|
|
102
|
+
) : (
|
|
103
|
+
<span className="ck-detail-header-spacer" aria-hidden="true" />
|
|
104
|
+
)}
|
|
105
|
+
<button type="button" className="ck-btn-close" onClick={onClose} aria-label="Close">
|
|
106
|
+
<CloseIcon />
|
|
107
|
+
</button>
|
|
108
|
+
</header>
|
|
109
|
+
<div className="ck-detail-body">
|
|
110
|
+
{content === 'idle' && <Idle />}
|
|
111
|
+
{content === 'loading' && <Loading />}
|
|
112
|
+
{content === 'qr' && (
|
|
113
|
+
<QR uri={qrUri} logoUrl={connectorLogoUrl} downloadUrl={connectorDownloadUrl} />
|
|
114
|
+
)}
|
|
115
|
+
{content === 'timeout' && <Timeout />}
|
|
116
|
+
{(content === 'metamask-ext' || content === 'metamask-qr') && (
|
|
117
|
+
<MetaMask
|
|
118
|
+
variant={content === 'metamask-ext' ? 'extension' : 'qr'}
|
|
119
|
+
logoUrl={connectorLogoUrl}
|
|
120
|
+
uri={qrUri}
|
|
121
|
+
downloadUrl={connectorDownloadUrl}
|
|
122
|
+
onCopy={onCopyLink}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
{content === 'walletconnect' && (
|
|
126
|
+
<WalletConnect
|
|
127
|
+
uri={qrUri}
|
|
128
|
+
logoUrl={connectorLogoUrl}
|
|
129
|
+
walletCount={walletCount}
|
|
130
|
+
onShowAllWallets={onShowAllWallets}
|
|
131
|
+
onCopy={onCopyLink}
|
|
132
|
+
/>
|
|
133
|
+
)}
|
|
134
|
+
{content === 'all-wallets' && (
|
|
135
|
+
<AllWallets
|
|
136
|
+
wallets={wallets}
|
|
137
|
+
isLoading={walletListLoading}
|
|
138
|
+
onSelectWallet={onSelectWallet ?? (() => undefined)}
|
|
139
|
+
/>
|
|
140
|
+
)}
|
|
141
|
+
{content === 'wallet-qr' && selectedWallet && (
|
|
142
|
+
<WalletQR wallet={selectedWallet} uri={qrUri} onCopy={onCopyLink} />
|
|
143
|
+
)}
|
|
144
|
+
</div>
|
|
145
|
+
</section>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@use '../../style/mixin.scss' as *;
|
|
2
|
+
|
|
3
|
+
.ck-detail {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
background: var(--semantic-paper-dialog);
|
|
7
|
+
min-height: 0;
|
|
8
|
+
position: relative;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// ── Header ────────────────────────────────────────────────────────────────────
|
|
12
|
+
.ck-detail-header {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 10px;
|
|
16
|
+
height: 60px;
|
|
17
|
+
padding: 0 20px;
|
|
18
|
+
flex-shrink: 0;
|
|
19
|
+
background: var(--semantic-paper-sheet);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ck-btn-back {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
width: 14px;
|
|
27
|
+
height: 20px;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
color: var(--scale-gray-900);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ck-detail-title {
|
|
33
|
+
@include textToken('subtitle1-bold');
|
|
34
|
+
flex: 1;
|
|
35
|
+
color: var(--scale-gray-900);
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
text-overflow: ellipsis;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.ck-detail-header-spacer {
|
|
42
|
+
flex: 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ck-btn-close {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
width: 20px;
|
|
50
|
+
height: 20px;
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
color: var(--scale-gray-900);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ── Body ──────────────────────────────────────────────────────────────────────
|
|
56
|
+
.ck-detail-body {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
flex: 1;
|
|
60
|
+
min-height: 0;
|
|
61
|
+
overflow-y: auto;
|
|
62
|
+
padding: 20px;
|
|
63
|
+
@include themedScrollbar;
|
|
64
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { CloseIcon } from '../connectDialog/asset/closeIcon';
|
|
3
|
+
import './style.scss';
|
|
4
|
+
import { type ConnectorId } from '../../types';
|
|
5
|
+
import { CONNECTOR_META } from '../../connector-meta';
|
|
6
|
+
import { WalletItem } from '../../components/walletItem';
|
|
7
|
+
import { LinkIcon } from '../connectDialog/asset/linkIcon';
|
|
8
|
+
|
|
9
|
+
const MAIN_CONNECTORS = new Set<ConnectorId>(['CREDIT_CONNECT']);
|
|
10
|
+
|
|
11
|
+
interface SelectorPanelProps {
|
|
12
|
+
connectors: ConnectorId[];
|
|
13
|
+
selectedConnector: ConnectorId | null;
|
|
14
|
+
recentConnector?: ConnectorId | null;
|
|
15
|
+
onSelect: (id: ConnectorId) => void;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const SelectorPanel: FC<SelectorPanelProps> = ({
|
|
20
|
+
connectors,
|
|
21
|
+
selectedConnector,
|
|
22
|
+
recentConnector = null,
|
|
23
|
+
onSelect,
|
|
24
|
+
onClose,
|
|
25
|
+
}) => {
|
|
26
|
+
const mainConnectors = connectors.filter((id) => MAIN_CONNECTORS.has(id));
|
|
27
|
+
const subConnectors = connectors.filter((id) => !MAIN_CONNECTORS.has(id));
|
|
28
|
+
const hasDivider = mainConnectors.length > 0 && subConnectors.length > 0;
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<section className="ck-selector">
|
|
32
|
+
<header className="ck-selector-header">
|
|
33
|
+
<h2 className="ck-selector-title">Connect Wallet</h2>
|
|
34
|
+
{/* Close button — visible on mobile only via CSS */}
|
|
35
|
+
<button
|
|
36
|
+
type="button"
|
|
37
|
+
className="ck-btn-close ck-selector-close"
|
|
38
|
+
onClick={onClose}
|
|
39
|
+
aria-label="Close"
|
|
40
|
+
>
|
|
41
|
+
<CloseIcon />
|
|
42
|
+
</button>
|
|
43
|
+
</header>
|
|
44
|
+
|
|
45
|
+
<div className="ck-selector-body">
|
|
46
|
+
<div className="ck-selector-service">
|
|
47
|
+
{mainConnectors.length > 0 && (
|
|
48
|
+
<ul className="ck-selector-main" role="list">
|
|
49
|
+
{mainConnectors.map((id) => (
|
|
50
|
+
<li key={id}>
|
|
51
|
+
<WalletItem
|
|
52
|
+
id={id}
|
|
53
|
+
label={CONNECTOR_META[id].label}
|
|
54
|
+
logoUrl={CONNECTOR_META[id].logoUrl}
|
|
55
|
+
isSelected={selectedConnector === id}
|
|
56
|
+
isRecent={recentConnector === id}
|
|
57
|
+
onSelect={onSelect}
|
|
58
|
+
/>
|
|
59
|
+
</li>
|
|
60
|
+
))}
|
|
61
|
+
</ul>
|
|
62
|
+
)}
|
|
63
|
+
|
|
64
|
+
{hasDivider && (
|
|
65
|
+
<div className="ck-selector-divider" aria-hidden="true">
|
|
66
|
+
<span className="ck-selector-divider-label">OR</span>
|
|
67
|
+
</div>
|
|
68
|
+
)}
|
|
69
|
+
|
|
70
|
+
{subConnectors.length > 0 && (
|
|
71
|
+
<ul className="ck-selector-sub" role="list">
|
|
72
|
+
{subConnectors.map((id) => (
|
|
73
|
+
<li key={id}>
|
|
74
|
+
<WalletItem
|
|
75
|
+
id={id}
|
|
76
|
+
label={CONNECTOR_META[id].label}
|
|
77
|
+
logoUrl={CONNECTOR_META[id].logoUrl}
|
|
78
|
+
isSelected={selectedConnector === id}
|
|
79
|
+
isRecent={recentConnector === id}
|
|
80
|
+
onSelect={onSelect}
|
|
81
|
+
/>
|
|
82
|
+
</li>
|
|
83
|
+
))}
|
|
84
|
+
</ul>
|
|
85
|
+
)}
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<a
|
|
89
|
+
className="ck-no-wallet-btn"
|
|
90
|
+
href="https://creditcoin.org/Credit-Wallet"
|
|
91
|
+
target="_blank"
|
|
92
|
+
rel="noopener noreferrer"
|
|
93
|
+
>
|
|
94
|
+
<span className="ck-no-wallet-btn-label">I don't have a wallet</span>
|
|
95
|
+
<LinkIcon className="ck-no-wallet-btn-icon" />
|
|
96
|
+
</a>
|
|
97
|
+
</div>
|
|
98
|
+
</section>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
@use '../../style/mixin.scss' as *;
|
|
2
|
+
|
|
3
|
+
.ck-selector {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
min-height: 0;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
background: var(--semantic-paper-sheet);
|
|
9
|
+
border-right: 1px solid var(--semantic-divider-divider-2);
|
|
10
|
+
|
|
11
|
+
@include tablet {
|
|
12
|
+
border-right: none;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ck-selector-header {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
height: 60px;
|
|
21
|
+
padding: 0 20px;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ck-selector-title {
|
|
26
|
+
@include textToken('subtitle1-bold');
|
|
27
|
+
color: var(--scale-gray-900);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ck-selector-close.ck-btn-close {
|
|
31
|
+
display: none;
|
|
32
|
+
|
|
33
|
+
@include tablet {
|
|
34
|
+
display: flex !important;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
width: 20px;
|
|
38
|
+
height: 20px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ck-selector-body {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
flex: 1;
|
|
47
|
+
min-height: 0;
|
|
48
|
+
overflow-y: auto;
|
|
49
|
+
padding: 20px;
|
|
50
|
+
gap: 0;
|
|
51
|
+
@include themedScrollbar;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.ck-selector-service {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
gap: 32px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ck-selector-main {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: column;
|
|
63
|
+
gap: 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ck-selector-sub {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
gap: 10px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ck-selector-divider {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 16px;
|
|
76
|
+
|
|
77
|
+
&::before,
|
|
78
|
+
&::after {
|
|
79
|
+
content: '';
|
|
80
|
+
flex: 1;
|
|
81
|
+
height: 1px;
|
|
82
|
+
background: var(--semantic-divider-divider-1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.ck-selector-divider-label {
|
|
87
|
+
@include textToken('label4-regular');
|
|
88
|
+
color: var(--scale-gray-400);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.ck-root .ck-no-wallet-btn {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
gap: 4px;
|
|
96
|
+
width: 100%;
|
|
97
|
+
padding: 12px 20px;
|
|
98
|
+
color: var(--scale-gray-600);
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
|
|
101
|
+
@include tablet {
|
|
102
|
+
margin-top: 20px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ck-no-wallet-btn-label {
|
|
107
|
+
@include textToken('label4-regular');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.ck-no-wallet-btn-icon {
|
|
111
|
+
flex-shrink: 0;
|
|
112
|
+
color: var(--scale-gray-600);
|
|
113
|
+
}
|