Skip to content

Commit 96f43e1

Browse files
MananTankjnsdls
authored andcommitted
Dashboard: Move In-app-wallets page (#7378)
1 parent 6b67978 commit 96f43e1

File tree

109 files changed

+486
-314
lines changed

Some content is hidden

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

109 files changed

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

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

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

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
@@ -90,7 +90,7 @@ export const PrimaryDashboardButton: React.FC<AddToDashboardCardProps> = ({
9090
rel="noopener noreferrer"
9191
target="_blank"
9292
>
93-
View Asset Page <ExternalLinkIcon className="size-3.5" />
93+
View Token Page <ExternalLinkIcon className="size-3.5" />
9494
</Link>
9595
</Button>
9696
);

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

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

1717
return (
18-
<div className="border-b">
18+
<div>
1919
<ImportModal
2020
client={props.client}
2121
isOpen={importModalOpen}
@@ -27,24 +27,28 @@ export function DeployedContractsPageHeader(props: {
2727
type="contract"
2828
/>
2929

30-
<div className="container flex max-w-7xl flex-col gap-3 py-10 lg:flex-row lg:items-center lg:justify-between">
30+
<div className="container flex max-w-7xl flex-col gap-3 pt-10 pb-5 lg:flex-row lg:items-center lg:justify-between">
3131
<div>
3232
<h1 className="font-semibold text-2xl tracking-tight lg:text-3xl">
3333
Contracts
3434
</h1>
35+
<p className="text-muted-foreground">
36+
Deploy and manage contracts for your project
37+
</p>
3538
</div>
3639
<div className="flex gap-3 [&>*]:grow">
3740
<Button
38-
className="gap-2 bg-card"
41+
className="gap-1.5 bg-card"
3942
onClick={() => {
4043
setImportModalOpen(true);
4144
}}
45+
size="sm"
4246
variant="outline"
4347
>
44-
<DownloadIcon className="size-4" />
48+
<DownloadIcon className="size-4 text-muted-foreground" />
4549
Import contract
4650
</Button>
47-
<Button asChild className="gap-2">
51+
<Button asChild className="gap-1.5" size="sm">
4852
<Link href="/explore">
4953
<PlusIcon className="size-4" />
5054
Deploy contract

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

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Suspense } from "react";
33
import type { ThirdwebClient } from "thirdweb";
44
import { ClientOnly } from "@/components/blocks/client-only";
55
import { Spinner } from "@/components/ui/Spinner/Spinner";
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
2124
client={props.client}
2225
projectId={props.projectId}
2326
teamId={props.teamId}
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-
projectId={props.projectId}
34-
teamId={props.teamId}
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
@@ -1,3 +1,6 @@
1+
import { getSortedDeployedContracts } from "@app/account/contracts/_components/getSortedDeployedContracts";
2+
import { getAuthToken } from "@app/api/lib/getAuthToken";
3+
import { loginRedirect } from "@app/login/loginRedirect";
14
import { DefaultFactoriesSection } from "components/smart-wallets/AccountFactories";
25
import { FactoryContracts } from "components/smart-wallets/AccountFactories/factory-contracts";
36
import { PlusIcon } from "lucide-react";
@@ -14,9 +17,6 @@ import { Button } from "@/components/ui/button";
1417
import { UnderlineLink } from "@/components/ui/UnderlineLink";
1518
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
1619
import { serverThirdwebClient } from "@/constants/thirdweb-client.server";
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
@@ -1,3 +1,4 @@
1+
import { getAuthToken } from "@app/api/lib/getAuthToken";
12
import {
23
getLastNDaysRange,
34
type Range,
@@ -10,7 +11,6 @@ import { getUserOpUsage } from "@/api/analytics";
1011
import { getProject } from "@/api/projects";
1112
import { getTeamBySlug } from "@/api/team";
1213
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
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
@@ -1,3 +1,5 @@
1+
import { getAuthToken } from "@app/api/lib/getAuthToken";
2+
import { getValidTeamPlan } from "@app/team/components/TeamHeader/getValidTeamPlan";
13
import { AccountAbstractionSettingsPage } from "components/smart-wallets/SponsorshipPolicies";
24
import { CircleAlertIcon } from "lucide-react";
35
import { redirect } from "next/navigation";
@@ -7,8 +9,6 @@ import { ChakraProviderSetup } from "@/components/ChakraProviderSetup";
79
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
810
import { UnderlineLink } from "@/components/ui/UnderlineLink";
911
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
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 }>;
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { DeployedContractsPageHeader } from "@app/account/contracts/DeployedContractsPageHeader";
2+
import { getAuthToken } from "@app/api/lib/getAuthToken";
3+
import { loginRedirect } from "@app/login/loginRedirect";
4+
import { redirect } from "next/navigation";
5+
import { getProject } from "@/api/projects";
6+
import { getTeamBySlug } from "@/api/team";
7+
import { TabPathLinks } from "@/components/ui/tabs";
8+
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
9+
10+
export default async function Layout(props: {
11+
children: React.ReactNode;
12+
params: Promise<{ team_slug: string; project_slug: string }>;
13+
}) {
14+
const params = await props.params;
15+
16+
const [authToken, team, project] = await Promise.all([
17+
getAuthToken(),
18+
getTeamBySlug(params.team_slug),
19+
getProject(params.team_slug, params.project_slug),
20+
]);
21+
22+
if (!authToken) {
23+
loginRedirect(`/team/${params.team_slug}/${params.project_slug}/contracts`);
24+
}
25+
26+
if (!team) {
27+
redirect("/team");
28+
}
29+
30+
if (!project) {
31+
redirect(`/team/${params.team_slug}`);
32+
}
33+
34+
const client = getClientThirdwebClient({
35+
jwt: authToken,
36+
teamId: team.id,
37+
});
38+
39+
const layoutPath = `/team/${params.team_slug}/${params.project_slug}/contracts`;
40+
41+
return (
42+
<div className="flex grow flex-col">
43+
<DeployedContractsPageHeader
44+
client={client}
45+
projectId={project.id}
46+
teamId={team.id}
47+
/>
48+
<TabPathLinks
49+
links={[
50+
{
51+
exactMatch: true,
52+
name: "Contracts",
53+
path: layoutPath,
54+
},
55+
{
56+
name: "Webhooks",
57+
path: `${layoutPath}/webhooks`,
58+
},
59+
]}
60+
scrollableClassName="container max-w-7xl"
61+
/>
62+
<div className="h-6" />
63+
{props.children}
64+
</div>
65+
);
66+
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/contracts/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { DeployedContractsPage } from "@app/account/contracts/_components/DeployedContractsPage";
2+
import { getAuthToken } from "@app/api/lib/getAuthToken";
3+
import { loginRedirect } from "@app/login/loginRedirect";
14
import { redirect } from "next/navigation";
25
import { getProject } from "@/api/projects";
36
import { getTeamBySlug } from "@/api/team";
47
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
5-
import { DeployedContractsPage } from "../../../../../account/contracts/_components/DeployedContractsPage";
6-
import { getAuthToken } from "../../../../../api/lib/getAuthToken";
7-
import { loginRedirect } from "../../../../../login/loginRedirect";
88
import { FooterLinksSection } from "../components/footer/FooterLinksSection";
99

1010
export default async function Page(props: {
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { getAuthToken } from "@app/api/lib/getAuthToken";
2+
import { loginRedirect } from "@app/login/loginRedirect";
3+
import { redirect } from "next/navigation";
4+
import { getProject } from "@/api/projects";
5+
import { getTeamBySlug } from "@/api/team";
6+
import { ContractsWebhooksPageContent } from "../../webhooks/contract-webhooks/contract-webhooks-page";
7+
8+
export default async function Page(props: {
9+
params: Promise<{ team_slug: string; project_slug: string }>;
10+
}) {
11+
const params = await props.params;
12+
13+
const [authToken, team, project] = await Promise.all([
14+
getAuthToken(),
15+
getTeamBySlug(params.team_slug),
16+
getProject(params.team_slug, params.project_slug),
17+
]);
18+
19+
if (!authToken) {
20+
loginRedirect(
21+
`/team/${params.team_slug}/${params.project_slug}/contracts/webhooks`,
22+
);
23+
}
24+
25+
if (!team) {
26+
redirect("/team");
27+
}
28+
29+
if (!project) {
30+
redirect(`/team/${params.team_slug}`);
31+
}
32+
33+
return (
34+
<div className="container flex max-w-7xl grow flex-col">
35+
<ContractsWebhooksPageContent authToken={authToken} project={project} />
36+
</div>
37+
);
38+
}

0 commit comments

Comments
 (0)