Skip to content

Commit c5fa3b1

Browse files
authored
Dashboard: Move In-app-wallets page (#7378)
1 parent 6113f3d commit c5fa3b1

File tree

116 files changed

+542
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+542
-370
lines changed

apps/dashboard/redirects.js

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,51 @@ const legacyDashboardToTeamRedirects = [
6262
},
6363
];
6464

65+
const projectRoute = "/team/:team_slug/:project_slug";
66+
67+
const projectPageRedirects = [
68+
{
69+
source: `${projectRoute}/connect/pay/:path*`,
70+
destination: `${projectRoute}/universal-bridge/:path*`,
71+
permanent: false,
72+
},
73+
{
74+
source: `${projectRoute}/connect/universal-bridge/:path*`,
75+
destination: `${projectRoute}/universal-bridge/:path*`,
76+
permanent: false,
77+
},
78+
{
79+
source: `${projectRoute}/connect/account-abstraction/:path*`,
80+
destination: `${projectRoute}/account-abstraction/:path*`,
81+
permanent: false,
82+
},
83+
{
84+
source: `${projectRoute}/connect/in-app-wallets/:path*`,
85+
destination: `${projectRoute}/wallets/:path*`,
86+
permanent: false,
87+
},
88+
{
89+
source: `${projectRoute}/engine/cloud/vault/:path*`,
90+
destination: `${projectRoute}/vault/:path*`,
91+
permanent: false,
92+
},
93+
{
94+
source: `${projectRoute}/engine/cloud/:path*`,
95+
destination: `${projectRoute}/transactions/:path*`,
96+
permanent: false,
97+
},
98+
{
99+
source: `${projectRoute}/assets/:path*`,
100+
destination: `${projectRoute}/tokens/:path*`,
101+
permanent: false,
102+
},
103+
{
104+
source: `${projectRoute}/nebula/:path*`,
105+
destination: projectRoute,
106+
permanent: false,
107+
},
108+
];
109+
65110
/** @type {import('next').NextConfig['redirects']} */
66111
async function redirects() {
67112
return [
@@ -326,14 +371,6 @@ async function redirects() {
326371
destination: "/",
327372
permanent: false,
328373
},
329-
// pay > universal-bridge redirect
330-
{
331-
source: "/team/:team_slug/:project_slug/connect/pay/:path*",
332-
destination:
333-
"/team/:team_slug/:project_slug/connect/universal-bridge/:path*",
334-
permanent: false,
335-
},
336-
337374
// all /learn/tutorials (and sub-routes) -> /learn/guides
338375
{
339376
source: "/learn/tutorials/:path*",
@@ -382,8 +419,8 @@ async function redirects() {
382419
destination: "/transactions",
383420
permanent: false,
384421
},
385-
386422
...legacyDashboardToTeamRedirects,
423+
...projectPageRedirects,
387424
];
388425
}
389426

apps/dashboard/src/@/analytics/report.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type { Team } from "../api/team";
1010
* ### Why do we need to report this event?
1111
* - To track the number of contracts deployed
1212
* - To track the number of contracts deployed on each chain
13-
* - To track if the contract was deployed on the asset page vs on the deploy page
13+
* - To track if the contract was deployed on the token page vs on the deploy page
1414
*
1515
* ### Who is responsible for this event?
1616
* @jnsdls
@@ -230,7 +230,7 @@ type AssetContractType = "DropERC20" | "DropERC1155" | "DropERC721";
230230

231231
/**
232232
* ### Why do we need to report this event?
233-
* - To track number of successful asset purchases from the asset page
233+
* - To track number of successful asset purchases from the token page
234234
* - To track which asset and contract types are being purchased the most
235235
*
236236
* ### Who is responsible for this event?
@@ -250,7 +250,7 @@ export function reportAssetBuySuccessful(properties: {
250250

251251
/**
252252
* ### Why do we need to report this event?
253-
* - To track number of failed asset purchases from the asset page
253+
* - To track number of failed asset purchases from the token page
254254
* - To track the errors that users encounter when trying to purchase an asset
255255
*
256256
* ### Who is responsible for this event?

apps/dashboard/src/@/components/blocks/Sidebar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type SidebarBaseLink = {
99
label: React.ReactNode;
1010
exactMatch?: boolean;
1111
icon?: React.FC<{ className?: string }>;
12+
isActive?: (pathname: string) => boolean;
1213
};
1314

1415
export type SidebarLink =

apps/dashboard/src/@/components/blocks/SidebarLayout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ function RenderSidebarGroup(props: {
123123
className="flex items-center gap-2 text-muted-foreground text-sm hover:bg-accent"
124124
activeClassName="text-foreground bg-accent"
125125
exactMatch={link.exactMatch}
126+
isActive={link.isActive}
126127
onClick={() => {
127128
sidebar.setOpenMobile(false);
128129
}}

apps/dashboard/src/@/components/ui/NavLink.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ export type NavButtonProps = {
1111
href: string;
1212
exactMatch?: boolean;
1313
onClick?: () => void;
14+
isActive?: (pathname: string) => boolean;
1415
};
1516

1617
export function NavLink(props: React.PropsWithChildren<NavButtonProps>) {
1718
const pathname = usePathname();
18-
const isActive = pathname
19-
? props.exactMatch
20-
? pathname === props.href
21-
: pathname.startsWith(props.href)
22-
: false;
19+
const isActive = props.isActive
20+
? props.isActive(pathname)
21+
: pathname
22+
? props.exactMatch
23+
? pathname === props.href
24+
: pathname.startsWith(props.href)
25+
: false;
2326
return (
2427
<Link
2528
href={props.href}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_layout/primary-dashboard-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const PrimaryDashboardButton: React.FC<AddToDashboardCardProps> = ({
8787
rel="noopener noreferrer"
8888
className="gap-2"
8989
>
90-
View Asset Page <ExternalLinkIcon className="size-3.5" />
90+
View Token Page <ExternalLinkIcon className="size-3.5" />
9191
</Link>
9292
</Button>
9393
);

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/ContractOverviewPage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ export const ContractOverviewPage: React.FC<ContractOverviewPageProps> = ({
4545
<div className="flex grow flex-col gap-10 overflow-hidden">
4646
{isErc20 && (
4747
<UpsellBannerCard
48-
title="Public asset page available"
49-
description="A public page is available for this contract for anyone to buy this asset"
48+
title="Public token page available"
49+
description="A public page is available for this contract for anyone to buy this token"
5050
cta={{
51-
text: "View asset page",
51+
text: "View token page",
5252
icon: <ExternalLinkIcon className="size-4" />,
5353
target: "_blank",
5454
link: `/${chainSlug}/${contract.address}`,

apps/dashboard/src/app/(app)/account/contracts/DeployedContractsPageHeader.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function DeployedContractsPageHeader(props: {
1616
const [importModalOpen, setImportModalOpen] = useState(false);
1717

1818
return (
19-
<div className="border-b">
19+
<div>
2020
<ImportModal
2121
client={props.client}
2222
isOpen={importModalOpen}
@@ -28,24 +28,28 @@ export function DeployedContractsPageHeader(props: {
2828
type="contract"
2929
/>
3030

31-
<div className="container flex max-w-7xl flex-col gap-3 py-10 lg:flex-row lg:items-center lg:justify-between">
31+
<div className="container flex max-w-7xl flex-col gap-3 pt-10 pb-5 lg:flex-row lg:items-center lg:justify-between">
3232
<div>
3333
<h1 className="font-semibold text-2xl tracking-tight lg:text-3xl">
3434
Contracts
3535
</h1>
36+
<p className="text-muted-foreground">
37+
Deploy and manage contracts for your project
38+
</p>
3639
</div>
3740
<div className="flex gap-3 [&>*]:grow">
3841
<Button
39-
className="gap-2 bg-card"
42+
className="gap-1.5 bg-card"
43+
size="sm"
4044
variant="outline"
4145
onClick={() => {
4246
setImportModalOpen(true);
4347
}}
4448
>
45-
<DownloadIcon className="size-4" />
49+
<DownloadIcon className="size-4 text-muted-foreground" />
4650
Import contract
4751
</Button>
48-
<Button asChild className="gap-2">
52+
<Button asChild className="gap-1.5" size="sm">
4953
<Link href="/explore">
5054
<PlusIcon className="size-4" />
5155
Deploy contract

apps/dashboard/src/app/(app)/account/contracts/_components/DeployedContractsPage.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Spinner } from "@/components/ui/Spinner/Spinner";
33
import { ContractTable } from "components/contract-components/tables/contract-table";
44
import { Suspense } from "react";
55
import type { ThirdwebClient } from "thirdweb";
6-
import { DeployedContractsPageHeader } from "../DeployedContractsPageHeader";
76
import { DeployViaCLIOrImportCard } from "./DeployViaCLIOrImportCard";
87
import { getSortedDeployedContracts } from "./getSortedDeployedContracts";
98

@@ -16,24 +15,16 @@ export function DeployedContractsPage(props: {
1615
projectSlug: string;
1716
}) {
1817
return (
19-
<div className="flex grow flex-col">
20-
<DeployedContractsPageHeader
18+
<div className="container flex max-w-7xl grow flex-col">
19+
<Suspense fallback={<Loading />}>
20+
<DeployedContractsPageAsync {...props} />
21+
</Suspense>
22+
<div className="h-8" />
23+
<DeployViaCLIOrImportCard
24+
client={props.client}
2125
teamId={props.teamId}
2226
projectId={props.projectId}
23-
client={props.client}
2427
/>
25-
<div className="h-6" />
26-
<div className="container flex max-w-7xl grow flex-col">
27-
<Suspense fallback={<Loading />}>
28-
<DeployedContractsPageAsync {...props} />
29-
</Suspense>
30-
<div className="h-8" />
31-
<DeployViaCLIOrImportCard
32-
client={props.client}
33-
teamId={props.teamId}
34-
projectId={props.projectId}
35-
/>
36-
</div>
3728
</div>
3829
);
3930
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FooterLinksSection } from "../../components/footer/FooterLinksSection";
1+
import { FooterLinksSection } from "../components/footer/FooterLinksSection";
22

33
export function AAFooter() {
44
return (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function AccountAbstractionLayout(props: {
1717
children: React.ReactNode;
1818
hasSmartWalletsWithoutBilling: boolean;
1919
}) {
20-
const smartWalletsLayoutSlug = `/team/${props.teamSlug}/${props.projectSlug}/connect/account-abstraction`;
20+
const smartWalletsLayoutSlug = `/team/${props.teamSlug}/${props.projectSlug}/account-abstraction`;
2121

2222
return (
2323
<div className="flex grow flex-col">
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import { UnderlineLink } from "@/components/ui/UnderlineLink";
66
import { Button } from "@/components/ui/button";
77
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
88
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
9+
import { getSortedDeployedContracts } from "@app/account/contracts/_components/getSortedDeployedContracts";
10+
import { getAuthToken } from "@app/api/lib/getAuthToken";
11+
import { loginRedirect } from "@app/login/loginRedirect";
912
import { DefaultFactoriesSection } from "components/smart-wallets/AccountFactories";
1013
import { FactoryContracts } from "components/smart-wallets/AccountFactories/factory-contracts";
1114
import { PlusIcon } from "lucide-react";
@@ -14,9 +17,6 @@ import { redirect } from "next/navigation";
1417
import { Suspense } from "react";
1518
import { type ThirdwebClient, defineChain, getContract } from "thirdweb";
1619
import { getCompilerMetadata } from "thirdweb/contract";
17-
import { getSortedDeployedContracts } from "../../../../../../../account/contracts/_components/getSortedDeployedContracts";
18-
import { getAuthToken } from "../../../../../../../api/lib/getAuthToken";
19-
import { loginRedirect } from "../../../../../../../login/loginRedirect";
2020

2121
export default async function Page(props: {
2222
params: Promise<{ team_slug: string; project_slug: string }>;
@@ -31,7 +31,7 @@ export default async function Page(props: {
3131

3232
if (!authToken) {
3333
loginRedirect(
34-
`/team/${params.team_slug}/${params.project_slug}/connect/account-abstraction/factories`,
34+
`/team/${params.team_slug}/${params.project_slug}/account-abstraction/factories`,
3535
);
3636
}
3737

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { getUserOpUsage } from "@/api/analytics";
22
import { getProject } from "@/api/projects";
33
import { getTeamBySlug } from "@/api/team";
44
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
5+
import { getAuthToken } from "@app/api/lib/getAuthToken";
56
import {
67
type Range,
78
getLastNDaysRange,
@@ -10,7 +11,6 @@ import { AccountAbstractionAnalytics } from "components/smart-wallets/AccountAbs
1011
import { AccountAbstractionSummary } from "components/smart-wallets/AccountAbstractionAnalytics/AccountAbstractionSummary";
1112
import { notFound, redirect } from "next/navigation";
1213
import type { SearchParams } from "nuqs/server";
13-
import { getAuthToken } from "../../../../../../api/lib/getAuthToken";
1414
import { searchParamLoader } from "./search-params";
1515

1616
interface PageParams {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { ChakraProviderSetup } from "@/components/ChakraProviderSetup";
44
import { UnderlineLink } from "@/components/ui/UnderlineLink";
55
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
66
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
7+
import { getAuthToken } from "@app/api/lib/getAuthToken";
8+
import { getValidTeamPlan } from "@app/team/components/TeamHeader/getValidTeamPlan";
79
import { AccountAbstractionSettingsPage } from "components/smart-wallets/SponsorshipPolicies";
810
import { CircleAlertIcon } from "lucide-react";
911
import { redirect } from "next/navigation";
10-
import { getAuthToken } from "../../../../../../../api/lib/getAuthToken";
11-
import { getValidTeamPlan } from "../../../../../../components/TeamHeader/getValidTeamPlan";
1212

1313
export default async function Page(props: {
1414
params: Promise<{ team_slug: string; project_slug: string }>;

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import { SmartAccountIcon } from "../../../../../(dashboard)/(chain)/components/
1919

2020
export function ProjectSidebarLayout(props: {
2121
layoutPath: string;
22+
engineLinkType: "cloud" | "dedicated";
2223
children: React.ReactNode;
2324
}) {
24-
const { layoutPath, children } = props;
25+
const { layoutPath, engineLinkType, children } = props;
2526

2627
return (
2728
<FullWidthSidebarLayout
@@ -34,16 +35,16 @@ export function ProjectSidebarLayout(props: {
3435
},
3536
{
3637
label: "Wallets",
37-
href: `${layoutPath}/connect/in-app-wallets`,
38+
href: `${layoutPath}/wallets`,
3839
icon: WalletIcon,
3940
},
4041
{
4142
label: "Account Abstraction",
42-
href: `${layoutPath}/connect/account-abstraction`,
43+
href: `${layoutPath}/account-abstraction`,
4344
icon: SmartAccountIcon,
4445
},
4546
{
46-
href: `${layoutPath}/connect/universal-bridge`,
47+
href: `${layoutPath}/universal-bridge`,
4748
icon: PayIcon,
4849
label: "Universal Bridge",
4950
},
@@ -62,9 +63,18 @@ export function ProjectSidebarLayout(props: {
6263
icon: CoinsIcon,
6364
},
6465
{
65-
href: `${layoutPath}/engine`,
66+
href:
67+
engineLinkType === "cloud"
68+
? `${layoutPath}/transactions`
69+
: `${layoutPath}/engine/dedicated`,
6670
label: "Transactions",
6771
icon: ArrowLeftRightIcon,
72+
isActive: (pathname) => {
73+
return (
74+
pathname.startsWith(`${layoutPath}/transactions`) ||
75+
pathname.startsWith(`${layoutPath}/engine/dedicated`)
76+
);
77+
},
6878
},
6979
{
7080
href: `${layoutPath}/insight`,

0 commit comments

Comments
 (0)