From 25b0223a987853c19342807597d6abb5eaa30ce2 Mon Sep 17 00:00:00 2001 From: QSchlegel Date: Mon, 15 Dec 2025 18:34:11 +0100 Subject: [PATCH] Refactor wallet info components for improved UI and functionality - Updated card components to enhance layout and styling consistency. - Refactored InspectMultisigScript and InspectScript to use CardUI for better presentation. - Improved the handling of wallet state and balance display in ShowInfo and related components. - Enhanced user experience with collapsible sections for advanced script details and improved messaging for wallet actions. - Adjusted styles for alerts and buttons to ensure better visibility and interaction. - Added Discord integration for signer profiles to enhance user engagement. --- .../multisig/inspect-multisig-script.tsx | 59 ++- .../pages/wallet/info/archive-wallet.tsx | 41 ++- .../pages/wallet/info/card-info.tsx | 339 ++++++++++++++++-- src/components/pages/wallet/info/index.tsx | 30 +- .../pages/wallet/info/inspect-script.tsx | 94 ++++- .../pages/wallet/info/migrate-wallet.tsx | 18 +- .../info/migration/FundTransferStep.tsx | 14 +- .../info/migration/MigrationCompleteStep.tsx | 2 +- .../info/migration/MigrationPreChecks.tsx | 12 +- .../info/migration/NewWalletCreationStep.tsx | 4 +- .../wallet/info/migration/ProxySetupStep.tsx | 4 +- .../info/migration/ProxyTransferStep.tsx | 10 +- .../pages/wallet/info/proxy-control.tsx | 20 +- .../pages/wallet/info/register-wallet.tsx | 7 +- .../wallet/info/signers/card-edit-signers.tsx | 24 +- .../wallet/info/signers/card-show-signers.tsx | 97 ++--- .../wallet/info/upgrade-governance-wallet.tsx | 55 +-- .../wallet/info/upgrade-staking-wallet.tsx | 57 +-- src/components/ui/card-content.tsx | 12 +- src/components/ui/card.tsx | 2 +- src/components/ui/code.tsx | 5 +- src/components/ui/row-label-info.tsx | 18 +- 22 files changed, 653 insertions(+), 271 deletions(-) diff --git a/src/components/multisig/inspect-multisig-script.tsx b/src/components/multisig/inspect-multisig-script.tsx index 86f2e878..ef2ef3f2 100644 --- a/src/components/multisig/inspect-multisig-script.tsx +++ b/src/components/multisig/inspect-multisig-script.tsx @@ -1,5 +1,5 @@ -import CardUI from "@/components/common/card-content"; -import Code from "@/components/common/code"; +import CardUI from "@/components/ui/card-content"; +import Code from "@/components/ui/code"; import RowLabelInfo from "@/components/common/row-label-info"; import { type MultisigWallet } from "@/utils/multisigSDK"; import { Carousel } from "@/components/ui/carousel"; @@ -88,37 +88,36 @@ export default function InspectMultisigScript({ } return ( -
-
-

Native Script

-
-
+ +
-
- {mWallet.stakingEnabled() && {mWallet.getScript().address}} - copyString={mWallet.getScript().address} - />} - {`${balance} ₳`}} /> - {mWallet.stakingEnabled() && ( - {mWallet.getStakeAddress()}} - copyString={mWallet.getStakeAddress()} - /> - )} - {/* add pending rewards like balance */} - {mWallet.isGovernanceEnabled() && {mWallet.getDRepId()}} - copyString={mWallet.getDRepId()} - />} + {mWallet.stakingEnabled() && {mWallet.getScript().address}} + copyString={mWallet.getScript().address} + />} + {`${balance} ₳`}} /> + {mWallet.stakingEnabled() && ( + {mWallet.getStakeAddress()}} + copyString={mWallet.getStakeAddress()} + /> + )} + {/* add pending rewards like balance */} + {mWallet.isGovernanceEnabled() && {mWallet.getDRepId()}} + copyString={mWallet.getDRepId()} + />} - -
+
-
+ ); } diff --git a/src/components/pages/wallet/info/archive-wallet.tsx b/src/components/pages/wallet/info/archive-wallet.tsx index 11dda93c..9ba33441 100644 --- a/src/components/pages/wallet/info/archive-wallet.tsx +++ b/src/components/pages/wallet/info/archive-wallet.tsx @@ -42,23 +42,34 @@ export function ArchiveWallet({ appWallet }: { appWallet: Wallet }) { return ( -

- Archiving this wallet will remove it from your list of wallets. You can - always restore it later. -

-
- {appWallet.isArchived ? ( - - ) : ( - - )} +
+

+ {appWallet.isArchived + ? "This wallet is currently archived and hidden from your wallet list." + : "Archiving this wallet will remove it from your list of wallets. You can always restore it later."} +

+
+ {appWallet.isArchived ? ( + + ) : ( + + )} +
); diff --git a/src/components/pages/wallet/info/card-info.tsx b/src/components/pages/wallet/info/card-info.tsx index 39f1491a..8bbe3ae2 100644 --- a/src/components/pages/wallet/info/card-info.tsx +++ b/src/components/pages/wallet/info/card-info.tsx @@ -1,10 +1,14 @@ -import { useState } from "react"; +import { useState, useEffect } from "react"; import { Wallet } from "@/types/wallet"; -import { MoreVertical } from "lucide-react"; +import { MoreVertical, Users, Archive, User } from "lucide-react"; import { api } from "@/utils/api"; import { useToast } from "@/hooks/use-toast"; import { useUserStore } from "@/lib/zustand/user"; import useMultisigWallet from "@/hooks/useMultisigWallet"; +import useAppWallet from "@/hooks/useAppWallet"; +import { deserializeAddress } from "@meshsdk/core"; +import { getBalanceFromUtxos } from "@/utils/getBalance"; +import { useWalletsStore } from "@/lib/zustand/wallets"; import { DropdownMenu, @@ -26,6 +30,15 @@ import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import CardUI from "@/components/ui/card-content"; import RowLabelInfo from "@/components/ui/row-label-info"; +import RowLabelInfoCommon from "@/components/common/row-label-info"; +import { NativeScriptSection } from "./inspect-script"; +import { Badge } from "@/components/ui/badge"; +import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@/components/ui/collapsible"; +import { ChevronDown, ChevronUp, Code2, Sparkles } from "lucide-react"; +import Code from "@/components/ui/code"; +import { Carousel } from "@/components/ui/carousel"; +import { type MultisigWallet } from "@/utils/multisigSDK"; +import { getFirstAndLast } from "@/utils/strings"; export default function CardInfo({ appWallet }: { appWallet: Wallet }) { const [showEdit, setShowEdit] = useState(false); @@ -107,8 +120,8 @@ function EditInfo({ }); } return ( -
-
+
+
setName(e.target.value)} />
-
+