Skip to content

Commit 044f897

Browse files
committed
Nebula: Add Move funds page (#7298)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the user experience in the `Nebula` application by adding new features, improving existing components, and ensuring better handling of user authentication and fund transfers. ### Detailed summary - Updated redirect logic in `middleware.ts` to preserve search params and prevent redirect from certain paths. - Added `placeholder` prop to `DecimalInput` in `decimal-input.tsx`. - Integrated `TWAutoConnect` component in `ChatPageLayout.tsx`. - Enhanced `TransactionButton` in `TransactionButton.tsx` to manage a new `disableNoFundsPopup` prop. - Refactored `NebulaProviders` to remove redundant `TWAutoConnect` usage. - Created a new `RecoverPage` component in `move-funds/page.tsx` for fund recovery. - Introduced `MoveFundsConnectButton` for connecting wallets in `connect-button.tsx`. - Implemented a new `MoveFundsPage` for managing fund transfers. - Updated `MismatchButton` to handle the new `disableNoFundsPopup` prop. - Enhanced token management and user feedback within the `MoveFundsPage`. - Added new components and functions for improved token selection and balance rendering. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a Move Funds page for transferring cryptocurrency between wallets, featuring wallet connection, chain and token selection, and transaction handling. - Added a customizable connect button supporting multiple authentication methods and theme adaptation. - Added the ability to display placeholder text in decimal input fields. - Enhanced button components with an option to disable the "Not Enough Funds" popup. - Added a dedicated page layout combining header, theme toggle, support link, and Move Funds functionality. - Integrated automatic wallet connection within the chat page layout for seamless user experience. - **Bug Fixes** - Updated middleware to allow unauthenticated access to the Move Funds page without redirecting to the login page. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 7fa5be5 commit 044f897

File tree

9 files changed

+1119
-10
lines changed

9 files changed

+1119
-10
lines changed

apps/dashboard/src/@/components/ui/decimal-input.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export function DecimalInput(props: {
55
maxValue?: number;
66
id?: string;
77
className?: string;
8+
placeholder?: string;
89
}) {
910
return (
1011
<Input
@@ -13,6 +14,7 @@ export function DecimalInput(props: {
1314
value={props.value}
1415
className={props.className}
1516
inputMode="decimal"
17+
placeholder={props.placeholder}
1618
onChange={(e) => {
1719
const number = Number(e.target.value);
1820
// ignore if string becomes invalid number

apps/dashboard/src/app/nebula-app/(app)/components/ChatPageLayout.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { cn } from "@/lib/utils";
2+
import { TWAutoConnect } from "../../../(app)/components/autoconnect";
3+
import { nebulaAAOptions } from "../../login/account-abstraction";
24
import type { TruncatedSessionInfo } from "../api/types";
5+
import { nebulaAppThirdwebClient } from "../utils/nebulaThirdwebClient";
36
import { ChatSidebar } from "./ChatSidebar";
47
import { MobileNav } from "./NebulaMobileNav";
58

@@ -27,6 +30,11 @@ export function ChatPageLayout(props: {
2730

2831
<MobileNav sessions={props.sessions} authToken={props.authToken} />
2932

33+
<TWAutoConnect
34+
accountAbstraction={nebulaAAOptions}
35+
client={nebulaAppThirdwebClient}
36+
/>
37+
3038
{props.children}
3139
</div>
3240
);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"use client";
2+
3+
import { useTheme } from "next-themes";
4+
import { ConnectButton } from "thirdweb/react";
5+
import { inAppWallet } from "thirdweb/wallets";
6+
import { getSDKTheme } from "../../(app)/components/sdk-component-theme";
7+
import { getClientThirdwebClient } from "../../../@/constants/thirdweb-client.client";
8+
import { nebulaAAOptions } from "../login/account-abstraction";
9+
10+
// use dashboard client to allow users to connect to their original wallet and move funds to a different wallet
11+
const dashboardClient = getClientThirdwebClient();
12+
13+
// since only the inApp and smart wallets were affected, only show in-app option
14+
const loginOptions = [
15+
inAppWallet({
16+
auth: {
17+
options: [
18+
"google",
19+
"apple",
20+
"facebook",
21+
"github",
22+
"email",
23+
"phone",
24+
"passkey",
25+
],
26+
},
27+
}),
28+
];
29+
30+
// Note: This component has autoConnect enabled
31+
export function MoveFundsConnectButton(props: {
32+
btnClassName?: string;
33+
connectLabel?: string;
34+
}) {
35+
const { theme } = useTheme();
36+
37+
return (
38+
<ConnectButton
39+
wallets={loginOptions}
40+
client={dashboardClient}
41+
theme={getSDKTheme(theme === "light" ? "light" : "dark")}
42+
accountAbstraction={nebulaAAOptions}
43+
connectButton={{
44+
className: props.btnClassName,
45+
label: props.connectLabel,
46+
}}
47+
detailsButton={{
48+
className: props.btnClassName,
49+
}}
50+
/>
51+
);
52+
}

0 commit comments

Comments
 (0)