Skip to content

Commit e8fb417

Browse files
authored
[Dashboard] Feature: bridge UI (#6727)
1 parent 3f42f52 commit e8fb417

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use client";
2+
import { getThirdwebClient } from "@/constants/thirdweb.server";
3+
import { getSDKTheme } from "app/components/sdk-component-theme";
4+
import { useV5DashboardChain } from "lib/v5-adapter";
5+
import { useTheme } from "next-themes";
6+
import { PayEmbed } from "thirdweb/react";
7+
8+
export function UniversalBridgeEmbed({ chainId }: { chainId?: number }) {
9+
const { theme } = useTheme();
10+
const chain = useV5DashboardChain(chainId || 1);
11+
12+
return (
13+
<PayEmbed
14+
client={getThirdwebClient()}
15+
payOptions={{
16+
mode: "fund_wallet",
17+
prefillBuy: {
18+
chain,
19+
amount: "0.01",
20+
},
21+
}}
22+
theme={getSDKTheme(theme === "light" ? "light" : "dark")}
23+
/>
24+
);
25+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { Metadata } from "next";
2+
import { UniversalBridgeEmbed } from "./components/client/UniversalBridgeEmbed";
3+
4+
const title = "Universal Bridge: Swap, Bridge, and On-Ramp";
5+
const description =
6+
"Swap, bridge, and on-ramp to any EVM chain with thirdweb's Universal Bridge.";
7+
8+
export const metadata: Metadata = {
9+
title,
10+
description,
11+
openGraph: {
12+
title,
13+
description,
14+
},
15+
};
16+
17+
export default async function RoutesPage({
18+
searchParams,
19+
}: { searchParams: Record<string, string | string[]> }) {
20+
const { chainId } = searchParams;
21+
return (
22+
<div className="relative mx-auto flex h-screen w-full flex-col items-center justify-center overflow-hidden border py-10">
23+
<main className="container z-10 flex justify-center">
24+
<UniversalBridgeEmbed chainId={chainId ? Number(chainId) : undefined} />
25+
</main>
26+
27+
{/* eslint-disable-next-line @next/next/no-img-element */}
28+
<img
29+
alt=""
30+
src="/assets/login/background.svg"
31+
className="-bottom-12 -right-12 pointer-events-none absolute lg:right-0 lg:bottom-0"
32+
/>
33+
</div>
34+
);
35+
}

0 commit comments

Comments
 (0)