Skip to content

Commit 6a7b556

Browse files
committed
[BLD-389] Dashboard: Project Wallet section UI improvements and refactor (#8291)
<!-- ## 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 primarily focuses on refactoring and improving the handling of project wallets within the application. It removes unused components, simplifies props, and enhances the user interface for wallet management. ### Detailed summary - Deleted unused files: `ProjectWalletSetup.client.tsx` and `ProjectWalletControls.client.tsx`. - Updated `ProjectFTUX` to remove `managementAccessToken` prop. - Simplified `CreateSolanaWallet` and `CreateServerWallet` components by removing unnecessary props. - Enhanced styling in the `ProjectFTUX` story and the wallet-related components. - Improved state management for wallet selection and transactions. - Refactored `ProjectWalletSection` to streamline wallet creation and management processes. > ✨ 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** * Added comprehensive project wallet management interface with send, receive, view transactions, and change wallet actions through an interactive dashboard. * **Refactor** * Reorganized wallet functionality into a dedicated module for improved code organization. * Simplified component interfaces by removing redundant authentication parameters throughout the dashboard. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent e0ace73 commit 6a7b556

File tree

15 files changed

+1261
-1122
lines changed

15 files changed

+1261
-1122
lines changed

apps/dashboard/src/@/components/blocks/wallet-address.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,12 @@ export function WalletAddressUI(
5151
};
5252
},
5353
) {
54-
// default back to zero address if no address provided
55-
const address = useMemo(() => props.address || ZERO_ADDRESS, [props.address]);
56-
57-
const [shortenedAddress, _lessShortenedAddress] = useMemo(() => {
58-
return [
59-
props.shortenAddress !== false
60-
? `${address.slice(0, 6)}...${address.slice(-4)}`
61-
: address,
62-
`${address.slice(0, 14)}...${address.slice(-12)}`,
63-
];
64-
}, [address, props.shortenAddress]);
54+
const address = props.address || ZERO_ADDRESS;
55+
56+
const shortenedAddress =
57+
props.shortenAddress !== false
58+
? `${address.slice(0, 6)}...${address.slice(-4)}`
59+
: address;
6560

6661
if (!isAddress(address)) {
6762
return (

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/ProjectFTUX/ProjectFTUX.stories.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ import { ProjectFTUX } from "./ProjectFTUX";
44

55
const meta = {
66
component: ProjectFTUX,
7+
parameters: {
8+
nextjs: {
9+
appDirectory: true,
10+
},
11+
},
712
decorators: [
813
(Story) => (
9-
<div className="container py-8 pb-20">
14+
<div className="container py-8 pb-20 max-w-7xl">
1015
<Story />
1116
</div>
1217
),
@@ -31,6 +36,5 @@ export const Default: Story = {
3136
],
3237
},
3338
teamSlug: "bar",
34-
managementAccessToken: undefined,
3539
},
3640
};

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/components/ProjectFTUX/ProjectFTUX.tsx

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,12 @@ import { UnrealIcon } from "@/icons/brand-icons/UnrealIcon";
1515
import { ContractIcon } from "@/icons/ContractIcon";
1616
import { InsightIcon } from "@/icons/InsightIcon";
1717
import { PayIcon } from "@/icons/PayIcon";
18-
import { WalletProductIcon } from "@/icons/WalletProductIcon";
19-
import { getProjectWalletLabel } from "@/lib/project-wallet";
20-
import {
21-
getProjectWallet,
22-
type ProjectWalletSummary,
23-
} from "@/lib/server/project-wallet";
2418
import { ClientIDSection } from "./ClientIDSection";
25-
import { ProjectWalletControls } from "./ProjectWalletControls.client";
26-
import { ProjectWalletSetup } from "./ProjectWalletSetup.client";
2719
import { SecretKeySection } from "./SecretKeySection";
2820

29-
export async function ProjectFTUX(props: {
30-
project: Project;
31-
teamSlug: string;
32-
wallet?: ProjectWalletSummary | undefined;
33-
managementAccessToken: string | undefined;
34-
}) {
35-
const projectWallet = props.wallet ?? (await getProjectWallet(props.project));
36-
21+
export function ProjectFTUX(props: { project: Project; teamSlug: string }) {
3722
return (
3823
<div className="flex flex-col gap-10">
39-
<ProjectWalletSection
40-
project={props.project}
41-
teamSlug={props.teamSlug}
42-
wallet={projectWallet}
43-
managementAccessToken={props.managementAccessToken}
44-
/>
4524
<IntegrateAPIKeySection project={props.project} />
4625
<ProductsSection
4726
projectSlug={props.project.slug}
@@ -53,64 +32,6 @@ export async function ProjectFTUX(props: {
5332
);
5433
}
5534

56-
export function ProjectWalletSection(props: {
57-
project: Project;
58-
teamSlug: string;
59-
wallet: ProjectWalletSummary | undefined;
60-
managementAccessToken: string | undefined;
61-
}) {
62-
const defaultLabel = getProjectWalletLabel(props.project.name);
63-
const walletAddress = props.wallet?.address;
64-
const label = props.wallet?.label ?? defaultLabel;
65-
66-
return (
67-
<section>
68-
<div className="rounded-lg border border-border bg-card p-4">
69-
<div className="flex flex-col gap-4">
70-
<div className="flex items-center gap-3">
71-
<div className="rounded-full border border-border bg-background p-2">
72-
<WalletProductIcon className="size-5 text-muted-foreground" />
73-
</div>
74-
<div>
75-
<p className="font-semibold text-lg tracking-tight">
76-
Project Wallet
77-
</p>
78-
<p className="text-muted-foreground text-sm">
79-
Use it for deployments, payments, and API integrations.
80-
</p>
81-
</div>
82-
</div>
83-
84-
{walletAddress ? (
85-
<>
86-
<ProjectWalletControls
87-
label={label}
88-
project={props.project}
89-
walletAddress={walletAddress}
90-
/>
91-
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end">
92-
<Link
93-
className="inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline"
94-
href={`/team/${props.teamSlug}/${props.project.slug}/transactions`}
95-
>
96-
View Transactions
97-
<ChevronRightIcon className="size-4" />
98-
</Link>
99-
</div>
100-
</>
101-
) : (
102-
<ProjectWalletSetup
103-
managementAccessToken={props.managementAccessToken}
104-
project={props.project}
105-
teamSlug={props.teamSlug}
106-
/>
107-
)}
108-
</div>
109-
</div>
110-
</section>
111-
);
112-
}
113-
11435
// Integrate API key section ------------------------------------------------------------
11536

11637
function IntegrateAPIKeySection({ project }: { project: Project }) {

0 commit comments

Comments
 (0)