diff --git a/.changeset/easy-teams-agree.md b/.changeset/easy-teams-agree.md new file mode 100644 index 00000000000..87af1ce1e65 --- /dev/null +++ b/.changeset/easy-teams-agree.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +TransactionWidget UI improvements diff --git a/packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx b/packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx index ee3239b4d18..c36bc64a4da 100644 --- a/packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx +++ b/packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx @@ -16,6 +16,7 @@ import { getWalletBalance } from "../../../../wallets/utils/getWalletBalance.js" import { useCustomTheme } from "../../../core/design-system/CustomThemeProvider.js"; import { fontSize, + radius, spacing, type Theme, } from "../../../core/design-system/index.js"; @@ -29,7 +30,9 @@ import { formatCurrencyAmount } from "../ConnectWallet/screens/formatTokenBalanc import { Container, Line } from "../components/basic.js"; import { Button } from "../components/buttons.js"; import { ChainName } from "../components/ChainName.js"; +import { Skeleton } from "../components/Skeleton.js"; import { Spacer } from "../components/Spacer.js"; +import { Spinner } from "../components/Spinner.js"; import { Text } from "../components/text.js"; import type { PayEmbedConnectOptions } from "../PayEmbed.js"; import { ChainIcon } from "./common/TokenAndChain.js"; @@ -161,36 +164,34 @@ export function TransactionPayment({ - + - + {/* Loading Rows */} - - - - - - - - - + + + + + + - + - + {/* Loading Button */} -
+ {showThirdwebBranding ? (
@@ -227,7 +228,7 @@ export function TransactionPayment({ {/* Function Name */} - + - + - {/* Contract Info */} - {contractName !== "UnknownContract" && - contractName !== undefined && - contractName !== "Unknown Contract" && ( - <> + + {/* Contract Info */} + {contractName !== "UnknownContract" && + contractName !== undefined && + contractName !== "Unknown Contract" && ( + )} - - - )} - - {/* Address */} - - - Address - - - {shortenAddress(transaction.to as string)} - - - - - - {/* Network */} - - - Network - - - - + Address + + + target="_blank" + > + {shortenAddress(transaction.to as string)} + - - + {/* Network */} + + + Network + + + + + + - {/* Cost */} - {transactionDataQuery.data?.txCostDisplay && ( - <> + {/* Cost */} + {transactionDataQuery.data?.txCostDisplay && ( {transactionDataQuery.data?.txCostDisplay} + )} - - - )} - - {/* Network Fees */} - {transactionDataQuery.data?.gasCostDisplay && ( - <> + {/* Network Fees */} + {transactionDataQuery.data?.gasCostDisplay && ( + )} + - - - )} + - + @@ -432,7 +425,7 @@ export function TransactionPayment({ }} style={{ fontSize: fontSize.md, - padding: `${spacing.sm} ${spacing.md}`, + borderRadius: radius.full, }} variant="primary" > @@ -443,6 +436,9 @@ export function TransactionPayment({ client={client} connectButton={{ label: buttonLabel, + style: { + borderRadius: radius.full, + }, }} theme={theme} {...connectOptions} @@ -467,67 +463,39 @@ export function TransactionPayment({ ); } -const SkeletonHeader = (props: { theme: Theme }) => ( +const SkeletonHeader = (_props: { theme: Theme }) => ( - {/* USD Value Skeleton */} -
- - {/* Function Name Skeleton */} -
); -// Skeleton component for loading state -const SkeletonRow = ({ - width = "100%", - theme, -}: { - width?: string; - theme: Theme; -}) => ( - -
-
- -); + > + + + + ); +} diff --git a/packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx b/packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx index ae6ff80a061..65f7e8b6281 100644 --- a/packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx +++ b/packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx @@ -14,7 +14,6 @@ const meta: Meta = { onError: () => {}, onCancel: () => {}, currency: "USD", - ...TRANSACTION_UI_OPTIONS.ethTransfer, }, component: StoryVariant, title: "Bridge/Transaction/TransactionWidget", @@ -23,9 +22,24 @@ const meta: Meta = { export default meta; type Story = StoryObj; -export const EthereumTransfer: Story = { +export const BaseEthTransfer: Story = { + args: { + ...TRANSACTION_UI_OPTIONS.ethTransfer, + }, +}; + +export const BaseEthTransferWithDescription: Story = { + args: { + ...TRANSACTION_UI_OPTIONS.ethTransfer, + description: "This is a description of the transaction", + }, +}; + +export const BaseEthTransferWithImage: Story = { args: { ...TRANSACTION_UI_OPTIONS.ethTransfer, + description: "This is a description of the transaction", + image: "https://picsum.photos/400/600", }, }; diff --git a/packages/thirdweb/src/stories/Bridge/fixtures.ts b/packages/thirdweb/src/stories/Bridge/fixtures.ts index 51b8ec900b9..bdd93fc69e7 100644 --- a/packages/thirdweb/src/stories/Bridge/fixtures.ts +++ b/packages/thirdweb/src/stories/Bridge/fixtures.ts @@ -1,7 +1,6 @@ import { stringify } from "viem"; import type { TokenWithPrices } from "../../bridge/types/Token.js"; import { base } from "../../chains/chain-definitions/base.js"; -import { baseSepolia } from "../../chains/chain-definitions/base-sepolia.js"; import { polygon } from "../../chains/chain-definitions/polygon.js"; import { defineChain } from "../../chains/utils.js"; import { NATIVE_TOKEN_ADDRESS } from "../../constants/addresses.js"; @@ -608,7 +607,7 @@ export const simpleBuyRequest: BridgePrepareRequest = { // mintTo raw transaction const ethTransferTransaction = prepareTransaction({ - chain: baseSepolia, + chain: base, client: storyClient, data: "0x449a52f80000000000000000000000008447c7a30d18e9adf2abe362689fc994cc6a340d00000000000000000000000000000000000000000000000000038d7ea4c68000", to: "0x87C52295891f208459F334975a3beE198fE75244",