@hfunlabs/hypurr-connect 0.1.19 → 0.1.20
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/dist/index.js +40 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/WalletSelectorDropdown.tsx +15 -49
package/package.json
CHANGED
|
@@ -18,12 +18,9 @@ import { useIsMobile } from "./useIsMobile";
|
|
|
18
18
|
import { UserProfileModal, type SlippageOption } from "./UserProfileModal";
|
|
19
19
|
import { getAgentExpiryTitle } from "./agentWallet";
|
|
20
20
|
import {
|
|
21
|
-
Bot,
|
|
22
21
|
Copy,
|
|
23
22
|
Crown,
|
|
24
|
-
Eye,
|
|
25
23
|
Folder,
|
|
26
|
-
KeyRound,
|
|
27
24
|
LayoutDashboard,
|
|
28
25
|
LogOut,
|
|
29
26
|
Plus,
|
|
@@ -202,36 +199,6 @@ const formatCompactAddress = (addr: string | undefined) => {
|
|
|
202
199
|
return `${addr.slice(0, 4)}...${addr.slice(-2)}`;
|
|
203
200
|
};
|
|
204
201
|
|
|
205
|
-
type WalletTypeMeta = {
|
|
206
|
-
label: string;
|
|
207
|
-
color: string;
|
|
208
|
-
icon: ReactNode;
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
function getWalletTypeMeta(wallet: DropdownWallet): WalletTypeMeta {
|
|
212
|
-
if (wallet.isAgent) {
|
|
213
|
-
return {
|
|
214
|
-
label: "Agent wallet",
|
|
215
|
-
color: "#38bdf8",
|
|
216
|
-
icon: <Bot size={12} />,
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (wallet.isReadOnly) {
|
|
221
|
-
return {
|
|
222
|
-
label: "Read-only wallet",
|
|
223
|
-
color: "#a78bfa",
|
|
224
|
-
icon: <Eye size={12} />,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return {
|
|
229
|
-
label: "Private-key wallet",
|
|
230
|
-
color: "#34d399",
|
|
231
|
-
icon: <KeyRound size={12} />,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
|
|
235
202
|
const rootStyle: CSSProperties = {
|
|
236
203
|
position: "absolute",
|
|
237
204
|
right: 0,
|
|
@@ -245,6 +212,17 @@ const rootStyle: CSSProperties = {
|
|
|
245
212
|
overflow: "hidden",
|
|
246
213
|
};
|
|
247
214
|
|
|
215
|
+
// Scoped scrollbar styling so the dropdown looks the same on every host site
|
|
216
|
+
// (matches alpha-trade). Inline styles can't target ::-webkit-scrollbar, so
|
|
217
|
+
// inject a scoped <style>; Firefox uses the standard props on the element.
|
|
218
|
+
const SCROLLBAR_CLASS = "hpc-wallet-scroll";
|
|
219
|
+
const scrollbarCss = `
|
|
220
|
+
.${SCROLLBAR_CLASS}::-webkit-scrollbar { width: 6px; height: 6px; }
|
|
221
|
+
.${SCROLLBAR_CLASS}::-webkit-scrollbar-track { background: #0b0e11; }
|
|
222
|
+
.${SCROLLBAR_CLASS}::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
|
|
223
|
+
.${SCROLLBAR_CLASS}::-webkit-scrollbar-thumb:hover { background: #4b5563; }
|
|
224
|
+
`;
|
|
225
|
+
|
|
248
226
|
const sectionBorder = "1px solid rgb(var(--line))";
|
|
249
227
|
|
|
250
228
|
const sectionHeaderStyle: CSSProperties = {
|
|
@@ -341,7 +319,6 @@ export function WalletSelectorDropdown({
|
|
|
341
319
|
depth={depth}
|
|
342
320
|
isSelected={isSelected}
|
|
343
321
|
label={label}
|
|
344
|
-
walletType={getWalletTypeMeta(wallet)}
|
|
345
322
|
compactAddress={compactAddress}
|
|
346
323
|
onSelect={() => {
|
|
347
324
|
selectWallet(wallet.id);
|
|
@@ -381,6 +358,7 @@ export function WalletSelectorDropdown({
|
|
|
381
358
|
exit={{ opacity: 0, scale: 0.95 }}
|
|
382
359
|
transition={{ duration: 0.15, ease: "easeOut" }}
|
|
383
360
|
>
|
|
361
|
+
<style>{scrollbarCss}</style>
|
|
384
362
|
{/* Profile header */}
|
|
385
363
|
<button
|
|
386
364
|
onClick={openProfile}
|
|
@@ -537,10 +515,13 @@ export function WalletSelectorDropdown({
|
|
|
537
515
|
<div style={{ borderBottom: sectionBorder }}>
|
|
538
516
|
<div style={sectionHeaderStyle}>Wallets</div>
|
|
539
517
|
<div
|
|
518
|
+
className={SCROLLBAR_CLASS}
|
|
540
519
|
style={{
|
|
541
520
|
maxHeight: 256,
|
|
542
521
|
overflowY: "auto",
|
|
543
522
|
paddingBottom: 4,
|
|
523
|
+
scrollbarWidth: "thin",
|
|
524
|
+
scrollbarColor: "#374151 #0b0e11",
|
|
544
525
|
}}
|
|
545
526
|
>
|
|
546
527
|
{walletListEntries.map((entry) => {
|
|
@@ -716,7 +697,6 @@ function WalletRow({
|
|
|
716
697
|
depth,
|
|
717
698
|
isSelected,
|
|
718
699
|
label,
|
|
719
|
-
walletType,
|
|
720
700
|
compactAddress,
|
|
721
701
|
onSelect,
|
|
722
702
|
onShowPortfolio,
|
|
@@ -728,7 +708,6 @@ function WalletRow({
|
|
|
728
708
|
depth: number;
|
|
729
709
|
isSelected: boolean;
|
|
730
710
|
label: string | null;
|
|
731
|
-
walletType: WalletTypeMeta;
|
|
732
711
|
compactAddress: string;
|
|
733
712
|
onSelect: () => void;
|
|
734
713
|
onShowPortfolio?: () => void;
|
|
@@ -794,19 +773,6 @@ function WalletRow({
|
|
|
794
773
|
padding: 0,
|
|
795
774
|
}}
|
|
796
775
|
>
|
|
797
|
-
<span
|
|
798
|
-
title={walletType.label}
|
|
799
|
-
aria-label={walletType.label}
|
|
800
|
-
style={{
|
|
801
|
-
display: "inline-flex",
|
|
802
|
-
alignItems: "center",
|
|
803
|
-
justifyContent: "center",
|
|
804
|
-
flexShrink: 0,
|
|
805
|
-
color: isAgentExpired ? walletTextColor : walletType.color,
|
|
806
|
-
}}
|
|
807
|
-
>
|
|
808
|
-
{walletType.icon}
|
|
809
|
-
</span>
|
|
810
776
|
{label ? (
|
|
811
777
|
<>
|
|
812
778
|
<span
|