diff --git a/.changeset/curly-crews-sleep.md b/.changeset/curly-crews-sleep.md new file mode 100644 index 00000000000..244e4b88be4 --- /dev/null +++ b/.changeset/curly-crews-sleep.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Minor UI adjustments in CheckoutWidget diff --git a/apps/dashboard/public/assets/pay/general-pay.png b/apps/dashboard/public/assets/pay/general-pay.png new file mode 100644 index 00000000000..8729bb7c2fb Binary files /dev/null and b/apps/dashboard/public/assets/pay/general-pay.png differ diff --git a/apps/dashboard/src/@/utils/sdk-component-theme.ts b/apps/dashboard/src/@/utils/sdk-component-theme.ts index 5541d2e530b..8a3dfc2da03 100644 --- a/apps/dashboard/src/@/utils/sdk-component-theme.ts +++ b/apps/dashboard/src/@/utils/sdk-component-theme.ts @@ -21,8 +21,8 @@ export function getSDKTheme(theme: "light" | "dark"): Theme { primaryButtonText: "hsl(var(--inverted-foreground))", primaryText: "hsl(var(--foreground))", scrollbarBg: "hsl(var(--muted))", - secondaryButtonBg: "hsl(var(--secondary))", - secondaryButtonHoverBg: "hsl(var(--secondary)/80%)", + secondaryButtonBg: "hsl(var(--secondary)/70%)", + secondaryButtonHoverBg: "hsl(var(--secondary))", secondaryButtonText: "hsl(var(--secondary-foreground))", secondaryIconColor: "hsl(var(--secondary-foreground))", secondaryIconHoverBg: "hsl(var(--accent))", @@ -33,7 +33,7 @@ export function getSDKTheme(theme: "light" | "dark"): Theme { separatorLine: "hsl(var(--border))", skeletonBg: "hsl(var(--secondary-foreground)/15%)", success: "hsl(var(--success-text))", - tertiaryBg: "hsl(var(--muted)/30%)", + tertiaryBg: "hsl(var(--muted)/50%)", tooltipBg: "hsl(var(--popover))", tooltipText: "hsl(var(--popover-foreground))", }, diff --git a/apps/dashboard/src/app/pay/[id]/header.tsx b/apps/dashboard/src/app/pay/[id]/header.tsx new file mode 100644 index 00000000000..eea5b92ddf8 --- /dev/null +++ b/apps/dashboard/src/app/pay/[id]/header.tsx @@ -0,0 +1,72 @@ +"use client"; +import { Img } from "@workspace/ui/components/img"; +import { MoonIcon, SunIcon } from "lucide-react"; +import { useTheme } from "next-themes"; +import { ClientOnly } from "@/components/blocks/client-only"; +import { Button } from "@/components/ui/button"; +import { Skeleton } from "@/components/ui/skeleton"; +import { cn } from "@/lib/utils"; +import { resolveSchemeWithErrorHandler } from "@/utils/resolveSchemeWithErrorHandler"; +import { payAppThirdwebClient } from "../constants"; + +export function PayIdPageHeader(props: { + projectName: string; + projectIcon: string | undefined; +}) { + return ( +
+
+
+ {props.projectIcon && ( + + )} + +

+ {props.projectName} +

+
+ +
+ +
+
+
+ ); +} + +function ToggleThemeButton(props: { className?: string }) { + const { setTheme, theme } = useTheme(); + + return ( + } + > + + + ); +} diff --git a/apps/dashboard/src/app/pay/[id]/page.tsx b/apps/dashboard/src/app/pay/[id]/page.tsx index 3e46240c99e..24694c29ace 100644 --- a/apps/dashboard/src/app/pay/[id]/page.tsx +++ b/apps/dashboard/src/app/pay/[id]/page.tsx @@ -1,21 +1,16 @@ -import { ShieldCheckIcon } from "lucide-react"; +import { cn } from "@workspace/ui/lib/utils"; import type { Metadata } from "next"; import { ThemeProvider } from "next-themes"; -import { Bridge, defineChain, toTokens } from "thirdweb"; -import { getChainMetadata } from "thirdweb/chains"; -import { shortenAddress } from "thirdweb/utils"; +import { Bridge } from "thirdweb"; import { getPaymentLink } from "@/api/universal-bridge/links"; -import { Badge } from "@/components/ui/badge"; import { NEXT_PUBLIC_THIRDWEB_API_HOST } from "@/constants/public-envs"; import { API_SERVER_SECRET, DASHBOARD_THIRDWEB_SECRET_KEY, } from "@/constants/server-envs"; import { getConfiguredThirdwebClient } from "@/constants/thirdweb.server"; -import { resolveEns } from "@/lib/ens"; -import { resolveSchemeWithErrorHandler } from "@/utils/resolveSchemeWithErrorHandler"; import { PayPageWidget } from "../components/client/PayPageWidget.client"; -import { payAppThirdwebClient } from "../constants"; +import { PayIdPageHeader } from "./header"; const title = "thirdweb Pay"; const description = "Fast, secure, and simple payments."; @@ -54,26 +49,10 @@ export default async function PayPage({ tokenAddress: paymentLink.destinationToken.address, }); - const chainPromise = getChainMetadata( - // eslint-disable-next-line no-restricted-syntax - defineChain(Number(paymentLink.destinationToken.chainId)), - ); - - const recipientPromise = resolveEns( - paymentLink.receiver, - getConfiguredThirdwebClient({ - secretKey: DASHBOARD_THIRDWEB_SECRET_KEY, - teamId: undefined, - }), - ); - - const [tokens, projectMetadata, chain, recipientEnsOrAddress] = - await Promise.all([ - tokensPromise, - projectMetadataPromise, - chainPromise, - recipientPromise, - ]); + const [tokens, projectMetadata] = await Promise.all([ + tokensPromise, + projectMetadataPromise, + ]); const token = tokens[0]; if (!token) { @@ -81,144 +60,33 @@ export default async function PayPage({ } return ( -
+
-
-
-
-
- {projectMetadata.image && ( - {projectMetadata.name} - )} -

{projectMetadata.name}

-
- {projectMetadata.description && ( -

- {projectMetadata.description} -

- )} -
- -
- {paymentLink.amount && ( -
- Details -
-
- {token.iconUri && ( - {token.name} - )} - {toTokens(BigInt(paymentLink.amount), token.decimals)}{" "} - {token.symbol} -
- {token.prices.USD && ( - - $ - {( - Number(token.prices.USD) * - Number( - toTokens( - BigInt(paymentLink.amount), - token.decimals, - ), - ) - ).toFixed(2)} - - )} -
-
- )} - {chain && ( -
- Network -
-
- {chain.icon?.url && ( - {chain.name} - )} - {chain.name} -
-
-
- )} - {recipientEnsOrAddress.ensName || - (recipientEnsOrAddress.address && ( -
- - Seller - -
- {recipientEnsOrAddress.ensName ?? - shortenAddress(recipientEnsOrAddress.address)} -
-
- ))} -
+ -
- - - Secured by thirdweb - -
-
-
- -
-
+
+ + +
); @@ -237,7 +105,24 @@ async function getProjectMetadata(clientId: string) { } const { data } = (await response.json()) as { - data: { name: string; image: string | null; description: string | null }; + data: { name: string; image: string | null }; }; return data; } + +function DotsBackgroundPattern(props: { className?: string }) { + return ( +