@b3dotfun/sdk 0.0.65-test.1 → 0.0.65
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/cjs/anyspend/react/components/AnySpend.js +33 -73
- package/dist/cjs/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/cjs/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
- package/dist/cjs/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/cjs/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/cjs/anyspend/react/components/common/OrderHistory.js +3 -7
- package/dist/cjs/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
- package/dist/cjs/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/cjs/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/cjs/global-account/react/components/AccountAssets/AccountAssets.js +2 -38
- package/dist/cjs/global-account/react/components/AvatarEditor/AvatarEditor.js +33 -139
- package/dist/cjs/global-account/react/components/B3DynamicModal.js +6 -25
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
- package/dist/cjs/global-account/react/components/LinkAccount/LinkAccount.js +279 -113
- package/dist/cjs/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ManageAccount.js +193 -24
- package/dist/cjs/global-account/react/components/index.d.ts +2 -4
- package/dist/cjs/global-account/react/components/index.js +4 -11
- package/dist/cjs/global-account/react/components/ui/Tabs.js +2 -2
- package/dist/cjs/global-account/react/components/ui/dialog.js +2 -2
- package/dist/cjs/global-account/react/hooks/index.d.ts +1 -1
- package/dist/cjs/global-account/react/hooks/index.js +1 -3
- package/dist/cjs/global-account/react/hooks/useB3BalanceFromAddresses.js +0 -1
- package/dist/cjs/global-account/react/stores/index.d.ts +0 -1
- package/dist/cjs/global-account/react/stores/index.js +1 -3
- package/dist/cjs/global-account/react/stores/useModalStore.d.ts +3 -34
- package/dist/cjs/global-account/react/utils/profileDisplay.d.ts +0 -2
- package/dist/cjs/global-account/react/utils/profileDisplay.js +2 -2
- package/dist/cjs/shared/constants/chains/supported.d.ts +2 -2
- package/dist/cjs/shared/utils/ipfs.js +1 -1
- package/dist/esm/anyspend/react/components/AnySpend.js +34 -74
- package/dist/esm/anyspend/react/components/AnySpendCustom.js +1 -1
- package/dist/esm/anyspend/react/components/common/CryptoPaymentMethod.js +1 -1
- package/dist/esm/anyspend/react/components/common/FeeDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/FiatPaymentMethod.js +2 -2
- package/dist/esm/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/esm/anyspend/react/components/common/OrderHistory.js +5 -6
- package/dist/esm/anyspend/react/components/common/PanelOnrampPayment.js +1 -1
- package/dist/esm/anyspend/react/components/common/PointsDetailPanel.js +1 -1
- package/dist/esm/anyspend/react/components/common/RecipientSelection.js +1 -1
- package/dist/esm/global-account/react/components/AccountAssets/AccountAssets.js +2 -38
- package/dist/esm/global-account/react/components/AvatarEditor/AvatarEditor.js +34 -140
- package/dist/esm/global-account/react/components/B3DynamicModal.js +6 -25
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
- package/dist/esm/global-account/react/components/LinkAccount/LinkAccount.js +280 -113
- package/dist/esm/global-account/react/components/ManageAccount/BalanceContent.js +2 -2
- package/dist/esm/global-account/react/components/ManageAccount/ManageAccount.js +195 -26
- package/dist/esm/global-account/react/components/index.d.ts +2 -4
- package/dist/esm/global-account/react/components/index.js +2 -7
- package/dist/esm/global-account/react/components/ui/Tabs.js +2 -2
- package/dist/esm/global-account/react/components/ui/dialog.js +2 -2
- package/dist/esm/global-account/react/hooks/index.d.ts +1 -1
- package/dist/esm/global-account/react/hooks/index.js +1 -1
- package/dist/esm/global-account/react/hooks/useB3BalanceFromAddresses.js +0 -1
- package/dist/esm/global-account/react/stores/index.d.ts +0 -1
- package/dist/esm/global-account/react/stores/index.js +0 -1
- package/dist/esm/global-account/react/stores/useModalStore.d.ts +3 -34
- package/dist/esm/global-account/react/utils/profileDisplay.d.ts +0 -2
- package/dist/esm/global-account/react/utils/profileDisplay.js +2 -2
- package/dist/esm/shared/constants/chains/supported.d.ts +2 -2
- package/dist/esm/shared/utils/ipfs.js +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/types/anyspend/react/components/common/OrderHistory.d.ts +1 -1
- package/dist/types/global-account/react/components/LinkAccount/LinkAccount.d.ts +4 -6
- package/dist/types/global-account/react/components/index.d.ts +2 -4
- package/dist/types/global-account/react/hooks/index.d.ts +1 -1
- package/dist/types/global-account/react/stores/index.d.ts +0 -1
- package/dist/types/global-account/react/stores/useModalStore.d.ts +3 -34
- package/dist/types/global-account/react/utils/profileDisplay.d.ts +0 -2
- package/dist/types/shared/constants/chains/supported.d.ts +2 -2
- package/package.json +1 -1
- package/src/anyspend/react/components/AnySpend.tsx +167 -225
- package/src/anyspend/react/components/AnySpendCustom.tsx +1 -1
- package/src/anyspend/react/components/common/CryptoPaymentMethod.tsx +1 -1
- package/src/anyspend/react/components/common/FeeDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/FiatPaymentMethod.tsx +2 -2
- package/src/anyspend/react/components/common/OrderHistory.tsx +13 -8
- package/src/anyspend/react/components/common/PanelOnrampPayment.tsx +1 -1
- package/src/anyspend/react/components/common/PointsDetailPanel.tsx +1 -1
- package/src/anyspend/react/components/common/RecipientSelection.tsx +1 -1
- package/src/global-account/react/components/AccountAssets/AccountAssets.tsx +25 -115
- package/src/global-account/react/components/AvatarEditor/AvatarEditor.tsx +126 -303
- package/src/global-account/react/components/B3DynamicModal.tsx +6 -28
- package/src/global-account/react/components/LinkAccount/LinkAccount.tsx +433 -332
- package/src/global-account/react/components/ManageAccount/BalanceContent.tsx +3 -2
- package/src/global-account/react/components/ManageAccount/ManageAccount.tsx +589 -73
- package/src/global-account/react/components/index.ts +2 -9
- package/src/global-account/react/components/ui/Tabs.tsx +13 -5
- package/src/global-account/react/components/ui/dialog.tsx +14 -32
- package/src/global-account/react/hooks/index.ts +0 -3
- package/src/global-account/react/hooks/useB3BalanceFromAddresses.ts +0 -1
- package/src/global-account/react/stores/index.ts +0 -1
- package/src/global-account/react/stores/useModalStore.ts +2 -39
- package/src/global-account/react/utils/profileDisplay.ts +2 -4
- package/src/shared/utils/ipfs.ts +1 -1
- package/src/styles/index.css +1 -6
- package/dist/cjs/global-account/react/components/Deposit/Deposit.d.ts +0 -1
- package/dist/cjs/global-account/react/components/Deposit/Deposit.js +0 -65
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
- package/dist/cjs/global-account/react/components/LinkAccount/LinkNewAccount.js +0 -331
- package/dist/cjs/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
- package/dist/cjs/global-account/react/components/ManageAccount/AppsContent.js +0 -34
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/BottomNavigation.js +0 -23
- package/dist/cjs/global-account/react/components/ManageAccount/Header.d.ts +0 -3
- package/dist/cjs/global-account/react/components/ManageAccount/Header.js +0 -120
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
- package/dist/cjs/global-account/react/components/ManageAccount/HomeActions.js +0 -43
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
- package/dist/cjs/global-account/react/components/ManageAccount/HomeContent.js +0 -16
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/NFTContent.js +0 -15
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/ProfileSection.js +0 -44
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsContent.js +0 -50
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsMenuItem.js +0 -8
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/SettingsProfileCard.js +0 -38
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
- package/dist/cjs/global-account/react/components/ManageAccount/TokenContent.js +0 -22
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
- package/dist/cjs/global-account/react/components/ModalHeader/ModalHeader.js +0 -12
- package/dist/cjs/global-account/react/components/Send/Send.d.ts +0 -5
- package/dist/cjs/global-account/react/components/Send/Send.js +0 -187
- package/dist/cjs/global-account/react/components/icons/BellIcon.d.ts +0 -3
- package/dist/cjs/global-account/react/components/icons/BellIcon.js +0 -5
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
- package/dist/cjs/global-account/react/components/icons/ChevronDownIcon.js +0 -7
- package/dist/cjs/global-account/react/components/icons/CopyIcon.d.ts +0 -2
- package/dist/cjs/global-account/react/components/icons/CopyIcon.js +0 -7
- package/dist/cjs/global-account/react/components/icons/LinkIcon.d.ts +0 -3
- package/dist/cjs/global-account/react/components/icons/LinkIcon.js +0 -5
- package/dist/cjs/global-account/react/components/icons/LockIcon.d.ts +0 -3
- package/dist/cjs/global-account/react/components/icons/LockIcon.js +0 -5
- package/dist/cjs/global-account/react/components/icons/WalletIcon.d.ts +0 -2
- package/dist/cjs/global-account/react/components/icons/WalletIcon.js +0 -7
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
- package/dist/cjs/global-account/react/stores/useRecentAddressesStore.js +0 -36
- package/dist/esm/global-account/react/components/Deposit/Deposit.d.ts +0 -1
- package/dist/esm/global-account/react/components/Deposit/Deposit.js +0 -59
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
- package/dist/esm/global-account/react/components/LinkAccount/LinkNewAccount.js +0 -325
- package/dist/esm/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
- package/dist/esm/global-account/react/components/ManageAccount/AppsContent.js +0 -32
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/BottomNavigation.js +0 -21
- package/dist/esm/global-account/react/components/ManageAccount/Header.d.ts +0 -3
- package/dist/esm/global-account/react/components/ManageAccount/Header.js +0 -81
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
- package/dist/esm/global-account/react/components/ManageAccount/HomeActions.js +0 -41
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
- package/dist/esm/global-account/react/components/ManageAccount/HomeContent.js +0 -10
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/NFTContent.js +0 -13
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/ProfileSection.js +0 -42
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
- package/dist/esm/global-account/react/components/ManageAccount/SettingsContent.js +0 -45
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
- package/dist/esm/global-account/react/components/ManageAccount/SettingsMenuItem.js +0 -6
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/SettingsProfileCard.js +0 -36
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
- package/dist/esm/global-account/react/components/ManageAccount/TokenContent.js +0 -20
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
- package/dist/esm/global-account/react/components/ModalHeader/ModalHeader.js +0 -10
- package/dist/esm/global-account/react/components/Send/Send.d.ts +0 -5
- package/dist/esm/global-account/react/components/Send/Send.js +0 -181
- package/dist/esm/global-account/react/components/icons/BellIcon.d.ts +0 -3
- package/dist/esm/global-account/react/components/icons/BellIcon.js +0 -3
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
- package/dist/esm/global-account/react/components/icons/ChevronDownIcon.js +0 -4
- package/dist/esm/global-account/react/components/icons/CopyIcon.d.ts +0 -2
- package/dist/esm/global-account/react/components/icons/CopyIcon.js +0 -4
- package/dist/esm/global-account/react/components/icons/LinkIcon.d.ts +0 -3
- package/dist/esm/global-account/react/components/icons/LinkIcon.js +0 -3
- package/dist/esm/global-account/react/components/icons/LockIcon.d.ts +0 -3
- package/dist/esm/global-account/react/components/icons/LockIcon.js +0 -3
- package/dist/esm/global-account/react/components/icons/WalletIcon.d.ts +0 -2
- package/dist/esm/global-account/react/components/icons/WalletIcon.js +0 -4
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
- package/dist/esm/global-account/react/stores/useRecentAddressesStore.js +0 -33
- package/dist/types/global-account/react/components/Deposit/Deposit.d.ts +0 -1
- package/dist/types/global-account/react/components/LinkAccount/LinkNewAccount.d.ts +0 -4
- package/dist/types/global-account/react/components/ManageAccount/AppsContent.d.ts +0 -6
- package/dist/types/global-account/react/components/ManageAccount/BottomNavigation.d.ts +0 -2
- package/dist/types/global-account/react/components/ManageAccount/Header.d.ts +0 -3
- package/dist/types/global-account/react/components/ManageAccount/HomeActions.d.ts +0 -5
- package/dist/types/global-account/react/components/ManageAccount/HomeContent.d.ts +0 -6
- package/dist/types/global-account/react/components/ManageAccount/NFTContent.d.ts +0 -2
- package/dist/types/global-account/react/components/ManageAccount/ProfileSection.d.ts +0 -2
- package/dist/types/global-account/react/components/ManageAccount/SettingsContent.d.ts +0 -7
- package/dist/types/global-account/react/components/ManageAccount/SettingsMenuItem.d.ts +0 -9
- package/dist/types/global-account/react/components/ManageAccount/SettingsProfileCard.d.ts +0 -2
- package/dist/types/global-account/react/components/ManageAccount/TokenContent.d.ts +0 -2
- package/dist/types/global-account/react/components/ModalHeader/ModalHeader.d.ts +0 -10
- package/dist/types/global-account/react/components/Send/Send.d.ts +0 -5
- package/dist/types/global-account/react/components/icons/BellIcon.d.ts +0 -3
- package/dist/types/global-account/react/components/icons/ChevronDownIcon.d.ts +0 -2
- package/dist/types/global-account/react/components/icons/CopyIcon.d.ts +0 -2
- package/dist/types/global-account/react/components/icons/LinkIcon.d.ts +0 -3
- package/dist/types/global-account/react/components/icons/LockIcon.d.ts +0 -3
- package/dist/types/global-account/react/components/icons/WalletIcon.d.ts +0 -2
- package/dist/types/global-account/react/stores/useRecentAddressesStore.d.ts +0 -25
- package/src/global-account/react/components/Deposit/Deposit.tsx +0 -211
- package/src/global-account/react/components/LinkAccount/LinkNewAccount.tsx +0 -490
- package/src/global-account/react/components/ManageAccount/AppsContent.tsx +0 -79
- package/src/global-account/react/components/ManageAccount/BottomNavigation.tsx +0 -83
- package/src/global-account/react/components/ManageAccount/Header.tsx +0 -230
- package/src/global-account/react/components/ManageAccount/HomeActions.tsx +0 -118
- package/src/global-account/react/components/ManageAccount/HomeContent.tsx +0 -42
- package/src/global-account/react/components/ManageAccount/NFTContent.tsx +0 -24
- package/src/global-account/react/components/ManageAccount/ProfileSection.tsx +0 -74
- package/src/global-account/react/components/ManageAccount/SettingsContent.tsx +0 -87
- package/src/global-account/react/components/ManageAccount/SettingsMenuItem.tsx +0 -31
- package/src/global-account/react/components/ManageAccount/SettingsProfileCard.tsx +0 -74
- package/src/global-account/react/components/ManageAccount/TokenContent.tsx +0 -41
- package/src/global-account/react/components/ModalHeader/ModalHeader.tsx +0 -50
- package/src/global-account/react/components/Send/Send.tsx +0 -585
- package/src/global-account/react/components/icons/BellIcon.tsx +0 -15
- package/src/global-account/react/components/icons/ChevronDownIcon.tsx +0 -17
- package/src/global-account/react/components/icons/CopyIcon.tsx +0 -22
- package/src/global-account/react/components/icons/LinkIcon.tsx +0 -15
- package/src/global-account/react/components/icons/LockIcon.tsx +0 -15
- package/src/global-account/react/components/icons/WalletIcon.tsx +0 -21
- package/src/global-account/react/stores/useRecentAddressesStore.ts +0 -55
|
@@ -4,16 +4,12 @@ import app from "@b3dotfun/sdk/global-account/app";
|
|
|
4
4
|
import { Button, useB3, useProfile } from "@b3dotfun/sdk/global-account/react";
|
|
5
5
|
import { cn } from "@b3dotfun/sdk/shared/utils/cn";
|
|
6
6
|
import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
|
|
7
|
-
import { getIpfsUrl } from "@b3dotfun/sdk/shared/utils/ipfs";
|
|
8
7
|
import { client } from "@b3dotfun/sdk/shared/utils/thirdweb";
|
|
9
|
-
import { Loader2, Upload, X } from "lucide-react";
|
|
8
|
+
import { Check, Loader2, Upload, X } from "lucide-react";
|
|
10
9
|
import { useRef, useState } from "react";
|
|
11
10
|
import { toast } from "sonner";
|
|
12
11
|
import { useActiveAccount } from "thirdweb/react";
|
|
13
12
|
import { upload } from "thirdweb/storage";
|
|
14
|
-
import { useProfileSettings } from "../../hooks/useProfile";
|
|
15
|
-
import { useModalStore } from "../../stores";
|
|
16
|
-
import ModalHeader from "../ModalHeader/ModalHeader";
|
|
17
13
|
|
|
18
14
|
const debug = debugB3React("AvatarEditor");
|
|
19
15
|
|
|
@@ -22,23 +18,13 @@ interface AvatarEditorProps {
|
|
|
22
18
|
className?: string;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
type ViewStep = "select" | "upload";
|
|
26
|
-
|
|
27
21
|
export function AvatarEditor({ onSetAvatar, className }: AvatarEditorProps) {
|
|
28
|
-
const [viewStep, setViewStep] = useState<ViewStep>("select");
|
|
29
|
-
const [selectedAvatar, setSelectedAvatar] = useState<string | null>(null);
|
|
30
|
-
const [hoveredProfile, setHoveredProfile] = useState<string | null>(null);
|
|
31
22
|
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
|
32
23
|
const [previewUrl, setPreviewUrl] = useState<string | null>(null);
|
|
33
24
|
const [isUploading, setIsUploading] = useState(false);
|
|
34
25
|
const [isSaving, setIsSaving] = useState(false);
|
|
35
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
36
26
|
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
37
|
-
const { setUser
|
|
38
|
-
const setB3ModalContentType = useModalStore(state => state.setB3ModalContentType);
|
|
39
|
-
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
40
|
-
const contentType = useModalStore(state => state.contentType);
|
|
41
|
-
const { setPreference } = useProfileSettings();
|
|
27
|
+
const { setUser } = useB3();
|
|
42
28
|
|
|
43
29
|
const account = useActiveAccount();
|
|
44
30
|
const { data: profile, refetch: refreshProfile } = useProfile({
|
|
@@ -46,11 +32,9 @@ export function AvatarEditor({ onSetAvatar, className }: AvatarEditorProps) {
|
|
|
46
32
|
fresh: true,
|
|
47
33
|
});
|
|
48
34
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
? getIpfsUrl(profile.avatar)
|
|
53
|
-
: undefined;
|
|
35
|
+
// Thirdweb upload function
|
|
36
|
+
|
|
37
|
+
const hasAvatar = profile?.avatar;
|
|
54
38
|
|
|
55
39
|
const handleFileSelect = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
56
40
|
const file = event.target.files?.[0];
|
|
@@ -72,12 +56,10 @@ export function AvatarEditor({ onSetAvatar, className }: AvatarEditorProps) {
|
|
|
72
56
|
// Create preview URL
|
|
73
57
|
const url = URL.createObjectURL(file);
|
|
74
58
|
setPreviewUrl(url);
|
|
75
|
-
setSelectedAvatar(url);
|
|
76
59
|
}
|
|
77
60
|
};
|
|
78
61
|
|
|
79
|
-
const
|
|
80
|
-
setSelectedAvatar(currentAvatar || null);
|
|
62
|
+
const handleRemoveFile = () => {
|
|
81
63
|
setSelectedFile(null);
|
|
82
64
|
if (previewUrl) {
|
|
83
65
|
URL.revokeObjectURL(previewUrl);
|
|
@@ -88,323 +70,164 @@ export function AvatarEditor({ onSetAvatar, className }: AvatarEditorProps) {
|
|
|
88
70
|
}
|
|
89
71
|
};
|
|
90
72
|
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
93
|
-
toast.error("
|
|
73
|
+
const handleUpload = async () => {
|
|
74
|
+
if (!selectedFile) {
|
|
75
|
+
toast.error("Please select an image first");
|
|
94
76
|
return;
|
|
95
77
|
}
|
|
96
78
|
|
|
97
|
-
|
|
79
|
+
setIsUploading(true);
|
|
98
80
|
try {
|
|
99
|
-
|
|
100
|
-
if (selectedFile) {
|
|
101
|
-
debug("Starting upload to IPFS", selectedFile);
|
|
102
|
-
|
|
103
|
-
// Upload to IPFS using Thirdweb
|
|
104
|
-
const ipfsUrl = await upload({
|
|
105
|
-
client,
|
|
106
|
-
files: [selectedFile],
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
debug("Upload successful", ipfsUrl);
|
|
110
|
-
|
|
111
|
-
// Save avatar URL using profiles service
|
|
112
|
-
const user = await app.service("users").setAvatar(
|
|
113
|
-
{
|
|
114
|
-
avatar: ipfsUrl,
|
|
115
|
-
},
|
|
116
|
-
// @ts-expect-error - our typed client is expecting context even though it's set elsewhere
|
|
117
|
-
{},
|
|
118
|
-
);
|
|
119
|
-
// update user
|
|
120
|
-
// @ts-expect-error this resolved fine, look into why expect-error needed
|
|
121
|
-
setUser(user);
|
|
81
|
+
debug("Starting upload to IPFS", selectedFile);
|
|
122
82
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (selectedProfile && selectedProfile.type) {
|
|
130
|
-
debug("Setting profile preference to:", selectedProfile.type);
|
|
83
|
+
// Upload to IPFS using Thirdweb
|
|
84
|
+
const ipfsUrl = await upload({
|
|
85
|
+
client,
|
|
86
|
+
files: [selectedFile],
|
|
87
|
+
});
|
|
131
88
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
89
|
+
debug("Upload successful", ipfsUrl);
|
|
90
|
+
|
|
91
|
+
// Save avatar URL using profiles service
|
|
92
|
+
setIsSaving(true);
|
|
93
|
+
const user = await app.service("users").setAvatar(
|
|
94
|
+
{
|
|
95
|
+
avatar: ipfsUrl,
|
|
96
|
+
},
|
|
97
|
+
// @ts-expect-error - our typed client is expecting context even though it's set elsewhere
|
|
98
|
+
{},
|
|
99
|
+
);
|
|
100
|
+
// update user
|
|
101
|
+
// @ts-expect-error this resolved fine, look into why expect-error needed
|
|
102
|
+
setUser(user);
|
|
142
103
|
|
|
143
104
|
// Refresh profile to get updated avatar
|
|
144
105
|
await refreshProfile();
|
|
145
106
|
|
|
107
|
+
toast.success(
|
|
108
|
+
hasAvatar ? "Nice look! Your avatar has been updated!" : "Looks great! Your avatar has been saved!",
|
|
109
|
+
);
|
|
110
|
+
|
|
146
111
|
onSetAvatar?.();
|
|
112
|
+
|
|
113
|
+
// Clean up
|
|
114
|
+
handleRemoveFile();
|
|
147
115
|
} catch (error) {
|
|
148
|
-
debug("Error
|
|
149
|
-
toast.error("Failed to
|
|
116
|
+
debug("Error uploading avatar:", error);
|
|
117
|
+
toast.error("Failed to upload avatar. Please try again.");
|
|
150
118
|
} finally {
|
|
119
|
+
setIsUploading(false);
|
|
151
120
|
setIsSaving(false);
|
|
152
121
|
}
|
|
153
122
|
};
|
|
154
123
|
|
|
155
|
-
const
|
|
156
|
-
if (viewStep === "upload") {
|
|
157
|
-
setViewStep("select");
|
|
158
|
-
handleRemovePreview();
|
|
159
|
-
} else {
|
|
160
|
-
setB3ModalContentType({
|
|
161
|
-
type: "manageAccount",
|
|
162
|
-
chain: (contentType as any)?.chain,
|
|
163
|
-
partnerId: partnerId,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
const handleProfileAvatarSelect = (avatarUrl: string) => {
|
|
169
|
-
setSelectedAvatar(avatarUrl);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
const handleUploadImageClick = () => {
|
|
173
|
-
setViewStep("upload");
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
const handleOpenFilePicker = () => {
|
|
124
|
+
const handleFileInputClick = () => {
|
|
177
125
|
fileInputRef.current?.click();
|
|
178
126
|
};
|
|
179
127
|
|
|
180
|
-
const handleDragEnter = (e: React.DragEvent<HTMLDivElement>) => {
|
|
181
|
-
e.preventDefault();
|
|
182
|
-
e.stopPropagation();
|
|
183
|
-
setIsDragging(true);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const handleDragLeave = (e: React.DragEvent<HTMLDivElement>) => {
|
|
187
|
-
e.preventDefault();
|
|
188
|
-
e.stopPropagation();
|
|
189
|
-
setIsDragging(false);
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {
|
|
193
|
-
e.preventDefault();
|
|
194
|
-
e.stopPropagation();
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {
|
|
198
|
-
e.preventDefault();
|
|
199
|
-
e.stopPropagation();
|
|
200
|
-
setIsDragging(false);
|
|
201
|
-
|
|
202
|
-
const file = e.dataTransfer.files?.[0];
|
|
203
|
-
if (file) {
|
|
204
|
-
// Validate file type
|
|
205
|
-
if (!file.type.startsWith("image/")) {
|
|
206
|
-
toast.error("Please select an image file");
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Validate file size (max 5MB)
|
|
211
|
-
if (file.size > 5 * 1024 * 1024) {
|
|
212
|
-
toast.error("File size must be less than 5MB");
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
setSelectedFile(file);
|
|
217
|
-
|
|
218
|
-
// Create preview URL
|
|
219
|
-
const url = URL.createObjectURL(file);
|
|
220
|
-
setPreviewUrl(url);
|
|
221
|
-
setSelectedAvatar(url);
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
const handleLinkMoreAccount = () => {
|
|
226
|
-
setB3ModalContentType({
|
|
227
|
-
type: "linkAccount",
|
|
228
|
-
chain: (contentType as any)?.chain,
|
|
229
|
-
partnerId: partnerId,
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
|
|
233
128
|
const isLoading = isUploading || isSaving;
|
|
234
129
|
|
|
235
|
-
// Get profile avatars
|
|
236
|
-
const profileAvatars =
|
|
237
|
-
profile?.profiles
|
|
238
|
-
?.filter(p => p.avatar)
|
|
239
|
-
.map(p => ({
|
|
240
|
-
type: p.type,
|
|
241
|
-
avatar: getIpfsUrl(p?.avatar || ""),
|
|
242
|
-
name: p.name || p.type,
|
|
243
|
-
})) || [];
|
|
244
|
-
|
|
245
130
|
return (
|
|
246
|
-
<div className={cn("flex
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
<div className="relative mb-6">
|
|
256
|
-
<div className="h-32 w-32 overflow-hidden rounded-full">
|
|
257
|
-
<img
|
|
258
|
-
src={selectedAvatar || currentAvatar || "https://via.placeholder.com/128"}
|
|
259
|
-
alt="Avatar preview"
|
|
260
|
-
className="h-full w-full object-cover"
|
|
261
|
-
/>
|
|
262
|
-
</div>
|
|
263
|
-
{selectedAvatar && (
|
|
264
|
-
<button
|
|
265
|
-
onClick={handleRemovePreview}
|
|
266
|
-
className="absolute -right-1 -top-1 flex h-8 w-8 items-center justify-center rounded-full bg-[#51525c] text-white transition-colors hover:bg-[#71717a]"
|
|
267
|
-
>
|
|
268
|
-
<X className="h-4 w-4" />
|
|
269
|
-
</button>
|
|
270
|
-
)}
|
|
271
|
-
</div>
|
|
272
|
-
|
|
273
|
-
{/* Upload Image Button */}
|
|
274
|
-
<button
|
|
275
|
-
onClick={handleUploadImageClick}
|
|
276
|
-
className="font-inter shadow-xs mb-6 flex w-full items-center justify-center gap-2 rounded-xl border border-[#e4e4e7] bg-white px-4 py-3 text-sm font-semibold text-[#18181b] transition-colors hover:bg-[#f4f4f5]"
|
|
277
|
-
>
|
|
278
|
-
<Upload className="h-4 w-4" />
|
|
279
|
-
Upload image
|
|
280
|
-
</button>
|
|
281
|
-
|
|
282
|
-
{/* Select Profile Image Section */}
|
|
283
|
-
<div className="w-full">
|
|
284
|
-
<h3 className="mb-2 text-base font-semibold text-[#18181b]">Select your profile image</h3>
|
|
285
|
-
<p className="mb-4 text-sm font-semibold text-[#475467]">
|
|
286
|
-
Pick an avatar from your linked profiles, ENS or upload a new one.
|
|
287
|
-
</p>
|
|
288
|
-
|
|
289
|
-
{/* Profile Avatars */}
|
|
290
|
-
<div className="mb-4 flex gap-3">
|
|
291
|
-
{profileAvatars.map((profileAvatar, index) => (
|
|
292
|
-
<div
|
|
293
|
-
key={index}
|
|
294
|
-
className="relative"
|
|
295
|
-
onMouseEnter={() => setHoveredProfile(profileAvatar.type)}
|
|
296
|
-
onMouseLeave={() => setHoveredProfile(null)}
|
|
297
|
-
>
|
|
298
|
-
<button
|
|
299
|
-
onClick={() => handleProfileAvatarSelect(profileAvatar.avatar)}
|
|
300
|
-
className={cn(
|
|
301
|
-
"h-16 w-16 overflow-hidden rounded-full border-2 transition-all",
|
|
302
|
-
selectedAvatar === profileAvatar.avatar
|
|
303
|
-
? "border-[#3368ef] ring-2 ring-[#3368ef]/20"
|
|
304
|
-
: "border-transparent hover:border-[#e4e4e7]",
|
|
305
|
-
)}
|
|
306
|
-
>
|
|
307
|
-
<img
|
|
308
|
-
src={profileAvatar.avatar}
|
|
309
|
-
alt={`${profileAvatar.type} avatar`}
|
|
310
|
-
className="h-full w-full object-cover"
|
|
311
|
-
/>
|
|
312
|
-
</button>
|
|
131
|
+
<div className={cn("flex flex-col items-center justify-center space-y-6 p-8", className)}>
|
|
132
|
+
<div className="space-y-2 text-center">
|
|
133
|
+
<h2 className="font-neue-montreal-semibold text-b3-grey text-2xl">
|
|
134
|
+
{hasAvatar ? "Update Your Avatar" : "Set Your Avatar"}
|
|
135
|
+
</h2>
|
|
136
|
+
<p className="text-b3-foreground-muted font-neue-montreal-medium">
|
|
137
|
+
Upload an image to personalize your profile
|
|
138
|
+
</p>
|
|
139
|
+
</div>
|
|
313
140
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
141
|
+
{/* Current Avatar Display */}
|
|
142
|
+
{hasAvatar && !previewUrl && (
|
|
143
|
+
<div className="relative">
|
|
144
|
+
<div className="border-b3-primary-blue h-32 w-32 overflow-hidden rounded-full border-4">
|
|
145
|
+
<img src={profile.avatar} alt="Current avatar" className="h-full w-full object-cover" />
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
)}
|
|
149
|
+
|
|
150
|
+
{/* File Upload Area */}
|
|
151
|
+
<div className="w-full max-w-md">
|
|
152
|
+
{!selectedFile ? (
|
|
153
|
+
<div
|
|
154
|
+
onClick={handleFileInputClick}
|
|
155
|
+
className="border-b3-line hover:border-b3-primary-blue hover:bg-b3-primary-wash/20 cursor-pointer rounded-xl border-2 border-dashed p-8 text-center transition-colors"
|
|
156
|
+
>
|
|
157
|
+
<Upload className="text-b3-grey mx-auto mb-4 h-12 w-12" />
|
|
158
|
+
<p className="text-b3-grey font-neue-montreal-semibold mb-2">Click to select an image</p>
|
|
159
|
+
<p className="text-b3-foreground-muted font-neue-montreal-medium text-sm">PNG, JPG, or GIF up to 5MB</p>
|
|
160
|
+
</div>
|
|
161
|
+
) : (
|
|
162
|
+
<div className="space-y-4">
|
|
163
|
+
{/* Preview */}
|
|
164
|
+
<div className="relative">
|
|
165
|
+
<div className="border-b3-primary-blue mx-auto h-32 w-32 overflow-hidden rounded-full border-4">
|
|
166
|
+
{previewUrl ? (
|
|
167
|
+
<img src={previewUrl} alt="Preview" className="h-full w-full object-cover" />
|
|
168
|
+
) : (
|
|
169
|
+
<div className="bg-b3-primary-wash flex h-full w-full items-center justify-center rounded-full">
|
|
170
|
+
<p className="text-b3-grey font-neue-montreal-semibold text-sm">No file selected</p>
|
|
320
171
|
</div>
|
|
321
|
-
)
|
|
172
|
+
)}
|
|
322
173
|
</div>
|
|
323
|
-
|
|
324
|
-
{/* Link More Account */}
|
|
325
174
|
<button
|
|
326
|
-
onClick={
|
|
327
|
-
className="
|
|
175
|
+
onClick={handleRemoveFile}
|
|
176
|
+
className="bg-b3-negative absolute -right-2 -top-2 flex h-8 w-8 items-center justify-center rounded-full text-white transition-colors hover:bg-red-600"
|
|
177
|
+
disabled={isLoading}
|
|
328
178
|
>
|
|
329
|
-
<
|
|
330
|
-
width="16"
|
|
331
|
-
height="16"
|
|
332
|
-
viewBox="0 0 16 16"
|
|
333
|
-
fill="none"
|
|
334
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
335
|
-
className="h-4 w-4"
|
|
336
|
-
>
|
|
337
|
-
<path
|
|
338
|
-
d="M8.75 2.75C8.75 2.33579 8.41421 2 8 2C7.58579 2 7.25 2.33579 7.25 2.75V7.25H2.75C2.33579 7.25 2 7.58579 2 8C2 8.41421 2.33579 8.75 2.75 8.75H7.25V13.25C7.25 13.6642 7.58579 14 8 14C8.41421 14 8.75 13.6642 8.75 13.25V8.75H13.25C13.6642 8.75 14 8.41421 14 8C14 7.58579 13.6642 7.25 13.25 7.25H8.75V2.75Z"
|
|
339
|
-
fill="currentColor"
|
|
340
|
-
/>
|
|
341
|
-
</svg>
|
|
342
|
-
Link more account
|
|
179
|
+
<X size={16} />
|
|
343
180
|
</button>
|
|
344
181
|
</div>
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
onDragOver={handleDragOver}
|
|
355
|
-
onDrop={handleDrop}
|
|
356
|
-
className={cn(
|
|
357
|
-
"mb-6 flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed p-16 transition-colors",
|
|
358
|
-
isDragging
|
|
359
|
-
? "border-[#3368ef] bg-[#f0f5ff]"
|
|
360
|
-
: "border-[#e4e4e7] hover:border-[#3368ef] hover:bg-[#f0f5ff]",
|
|
361
|
-
)}
|
|
362
|
-
>
|
|
363
|
-
<p className="font-inter mb-1 text-sm">
|
|
364
|
-
<span className="font-semibold text-[#3368ef]">Click to upload</span>
|
|
365
|
-
<span className="text-[#71717a]"> or drag and drop</span>
|
|
366
|
-
</p>
|
|
367
|
-
<p className="text-xs text-[#71717a]">PNG, JPG or GIF (up to 5MB)</p>
|
|
368
|
-
</div>
|
|
369
|
-
) : (
|
|
370
|
-
<div className="mb-6 w-full">
|
|
371
|
-
<div className="aspect-square w-full overflow-hidden rounded-xl bg-[#f4f4f5]">
|
|
372
|
-
<img src={previewUrl || ""} alt="Preview" className="h-full w-full object-cover" />
|
|
373
|
-
</div>
|
|
374
|
-
</div>
|
|
375
|
-
)}
|
|
376
|
-
</>
|
|
182
|
+
|
|
183
|
+
{/* File Info */}
|
|
184
|
+
<div className="space-y-1 text-center">
|
|
185
|
+
<p className="text-b3-grey font-neue-montreal-semibold text-sm">{selectedFile.name}</p>
|
|
186
|
+
<p className="text-b3-foreground-muted font-neue-montreal-medium text-xs">
|
|
187
|
+
{(selectedFile.size / 1024 / 1024).toFixed(2)} MB
|
|
188
|
+
</p>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
377
191
|
)}
|
|
378
192
|
|
|
379
193
|
{/* Hidden file input */}
|
|
380
194
|
<input ref={fileInputRef} type="file" accept="image/*" onChange={handleFileSelect} className="hidden" />
|
|
381
195
|
</div>
|
|
382
196
|
|
|
383
|
-
{/*
|
|
384
|
-
<div className="
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
197
|
+
{/* Action Buttons */}
|
|
198
|
+
<div className="flex w-full max-w-md gap-3">
|
|
199
|
+
{selectedFile && (
|
|
200
|
+
<Button
|
|
201
|
+
onClick={handleUpload}
|
|
202
|
+
disabled={isLoading}
|
|
203
|
+
className="bg-b3-primary-blue hover:bg-b3-primary-blue/90 flex-1 text-white"
|
|
204
|
+
>
|
|
205
|
+
{isLoading ? (
|
|
206
|
+
<>
|
|
207
|
+
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
|
208
|
+
{isUploading ? "Uploading..." : "Saving..."}
|
|
209
|
+
</>
|
|
210
|
+
) : (
|
|
211
|
+
<>
|
|
212
|
+
<Check className="mr-2 h-4 w-4" />
|
|
213
|
+
{hasAvatar ? "Update Avatar" : "Set Avatar"}
|
|
214
|
+
</>
|
|
215
|
+
)}
|
|
216
|
+
</Button>
|
|
217
|
+
)}
|
|
218
|
+
|
|
219
|
+
<Button variant="outline" onClick={handleFileInputClick} disabled={isLoading} className="flex-1">
|
|
220
|
+
<Upload className="mr-2 h-4 w-4" />
|
|
221
|
+
{selectedFile ? "Change Image" : "Select Image"}
|
|
406
222
|
</Button>
|
|
407
223
|
</div>
|
|
224
|
+
|
|
225
|
+
{/* Help Text */}
|
|
226
|
+
<div className="text-b3-foreground-muted font-neue-montreal-medium max-w-md text-center text-xs">
|
|
227
|
+
<p>
|
|
228
|
+
Your avatar will be uploaded to IPFS and stored securely. Make sure you have the rights to use this image.
|
|
229
|
+
</p>
|
|
230
|
+
</div>
|
|
408
231
|
</div>
|
|
409
232
|
);
|
|
410
233
|
}
|
|
@@ -19,13 +19,10 @@ import { useEffect, useRef } from "react";
|
|
|
19
19
|
import { useSetActiveWallet } from "thirdweb/react";
|
|
20
20
|
import { AvatarEditor } from "./AvatarEditor/AvatarEditor";
|
|
21
21
|
import { useB3 } from "./B3Provider/useB3";
|
|
22
|
-
import { Deposit } from "./Deposit/Deposit";
|
|
23
22
|
import { LinkAccount } from "./LinkAccount/LinkAccount";
|
|
24
|
-
import { LinkNewAccount } from "./LinkAccount/LinkNewAccount";
|
|
25
|
-
import { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
26
23
|
import { ProfileEditor } from "./ProfileEditor/ProfileEditor";
|
|
24
|
+
import { ManageAccount } from "./ManageAccount/ManageAccount";
|
|
27
25
|
import { RequestPermissions } from "./RequestPermissions/RequestPermissions";
|
|
28
|
-
import { Send } from "./Send/Send";
|
|
29
26
|
import { SignInWithB3Flow } from "./SignInWithB3/SignInWithB3Flow";
|
|
30
27
|
import { Dialog, DialogContent, DialogDescription, DialogTitle } from "./ui/dialog";
|
|
31
28
|
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/drawer";
|
|
@@ -33,10 +30,7 @@ import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "./ui/draw
|
|
|
33
30
|
const debug = debugB3React("B3DynamicModal");
|
|
34
31
|
|
|
35
32
|
export function B3DynamicModal() {
|
|
36
|
-
const isOpen = useModalStore(
|
|
37
|
-
const setB3ModalOpen = useModalStore(state => state.setB3ModalOpen);
|
|
38
|
-
const contentType = useModalStore(state => state.contentType);
|
|
39
|
-
const navigateBack = useModalStore(state => state.navigateBack);
|
|
33
|
+
const { isOpen, setB3ModalOpen, contentType, history, navigateBack } = useModalStore();
|
|
40
34
|
const { theme } = useB3();
|
|
41
35
|
const isMobile = useIsMobile();
|
|
42
36
|
const prevIsOpenRef = useRef(isOpen);
|
|
@@ -70,10 +64,7 @@ export function B3DynamicModal() {
|
|
|
70
64
|
"anySpendSignatureMint",
|
|
71
65
|
"anySpendBondKit",
|
|
72
66
|
"linkAccount",
|
|
73
|
-
"linkNewAccount",
|
|
74
67
|
"avatarEditor",
|
|
75
|
-
"deposit",
|
|
76
|
-
"send",
|
|
77
68
|
"profileEditor",
|
|
78
69
|
];
|
|
79
70
|
|
|
@@ -92,7 +83,7 @@ export function B3DynamicModal() {
|
|
|
92
83
|
|
|
93
84
|
// Check if current content type is in freestyle types
|
|
94
85
|
const isFreestyleType = freestyleTypes.includes(contentType?.type as string);
|
|
95
|
-
const hideCloseButton =
|
|
86
|
+
const hideCloseButton = isFreestyleType;
|
|
96
87
|
|
|
97
88
|
// Build content class using cn utility
|
|
98
89
|
// eslint-disable-next-line tailwindcss/no-custom-classname
|
|
@@ -130,7 +121,7 @@ export function B3DynamicModal() {
|
|
|
130
121
|
case "anySpendFundTournament":
|
|
131
122
|
return <AnySpendTournament {...contentType} mode="modal" action="fund" />;
|
|
132
123
|
case "anySpendOrderHistory":
|
|
133
|
-
return <OrderHistory {
|
|
124
|
+
return <OrderHistory onBack={() => {}} mode="modal" />;
|
|
134
125
|
case "anySpendStakeB3":
|
|
135
126
|
return <AnySpendStakeB3 {...contentType} mode="modal" />;
|
|
136
127
|
case "anySpendStakeB3ExactIn":
|
|
@@ -147,16 +138,10 @@ export function B3DynamicModal() {
|
|
|
147
138
|
return <AnySpendBondKit {...contentType} />;
|
|
148
139
|
case "linkAccount":
|
|
149
140
|
return <LinkAccount {...contentType} />;
|
|
150
|
-
case "linkNewAccount":
|
|
151
|
-
return <LinkNewAccount {...contentType} />;
|
|
152
141
|
case "anySpendDepositHype":
|
|
153
142
|
return <AnySpendDepositHype {...contentType} mode="modal" />;
|
|
154
143
|
case "avatarEditor":
|
|
155
144
|
return <AvatarEditor onSetAvatar={contentType.onSuccess} />;
|
|
156
|
-
case "deposit":
|
|
157
|
-
return <Deposit />;
|
|
158
|
-
case "send":
|
|
159
|
-
return <Send {...contentType} />;
|
|
160
145
|
case "profileEditor":
|
|
161
146
|
return <ProfileEditor onSuccess={contentType.onSuccess} />;
|
|
162
147
|
// Add other modal types here
|
|
@@ -177,12 +162,6 @@ export function B3DynamicModal() {
|
|
|
177
162
|
contentClass,
|
|
178
163
|
"rounded-2xl bg-white shadow-xl dark:bg-gray-900",
|
|
179
164
|
"border border-gray-200 dark:border-gray-800",
|
|
180
|
-
(contentType?.type === "manageAccount" ||
|
|
181
|
-
contentType?.type === "deposit" ||
|
|
182
|
-
contentType?.type === "send" ||
|
|
183
|
-
contentType?.type === "avatarEditor") &&
|
|
184
|
-
"p-0",
|
|
185
|
-
"mx-auto w-full max-w-md sm:max-w-lg", // TODO CHECK THIS
|
|
186
165
|
// Remove default width classes for avatar editor and profile editor
|
|
187
166
|
contentType?.type === "avatarEditor" || contentType?.type === "profileEditor"
|
|
188
167
|
? "!w-[90vw] !max-w-none" // Use !important to override default styles
|
|
@@ -192,9 +171,8 @@ export function B3DynamicModal() {
|
|
|
192
171
|
>
|
|
193
172
|
<ModalTitle className="sr-only hidden">{contentType?.type || "Modal"}</ModalTitle>
|
|
194
173
|
<ModalDescription className="sr-only hidden">{contentType?.type || "Modal Body"}</ModalDescription>
|
|
195
|
-
|
|
196
174
|
<div className={cn("no-scrollbar max-h-[90dvh] overflow-auto sm:max-h-[80dvh]")}>
|
|
197
|
-
{
|
|
175
|
+
{history.length > 0 && contentType?.showBackButton && (
|
|
198
176
|
<button
|
|
199
177
|
onClick={navigateBack}
|
|
200
178
|
className="flex items-center gap-2 px-6 py-4 text-gray-600 transition-colors hover:text-gray-900 dark:text-gray-400 dark:hover:text-white"
|
|
@@ -215,7 +193,7 @@ export function B3DynamicModal() {
|
|
|
215
193
|
strokeLinejoin="round"
|
|
216
194
|
/>
|
|
217
195
|
</svg>
|
|
218
|
-
<span className="
|
|
196
|
+
<span className="text-sm font-medium">Back</span>
|
|
219
197
|
</button>
|
|
220
198
|
)}
|
|
221
199
|
{renderContent()}
|