-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move /connect/in-app-wallets to app router
- Loading branch information
Showing
9 changed files
with
152 additions
and
143 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
apps/dashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/PageHeader.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { TrackedLinkTW } from "@/components/ui/tracked-link"; | ||
|
||
export function PageHeader() { | ||
return ( | ||
<div> | ||
<h1 className="font-semibold text-3xl tracking-tigher">In-App Wallets</h1> | ||
<div className="h-3" /> | ||
<p className="max-w-[500px] text-muted-foreground "> | ||
A wallet infrastructure that enables apps to create, manage, and control | ||
their users wallets. Email login, social login, and bring-your-own auth | ||
supported.{" "} | ||
<TrackedLinkTW | ||
target="_blank" | ||
href="https://portal.thirdweb.com/connect/in-app-wallet/overview" | ||
label="learn-more" | ||
category="embedded-wallet" | ||
className="text-link-foreground hover:text-foreground" | ||
> | ||
Learn more | ||
</TrackedLinkTW> | ||
</p> | ||
</div> | ||
); | ||
} |
50 changes: 50 additions & 0 deletions
50
apps/dashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/[clientId]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { redirect } from "next/navigation"; | ||
import { EmbeddedWallets } from "../../../../../../components/embedded-wallets"; | ||
import { getAuthToken } from "../../../../../api/lib/getAuthToken"; | ||
import { PageHeader } from "../PageHeader"; | ||
import { getInAppWalletSupportedAPIKeys } from "../getInAppWalletSupportedAPIKeys"; | ||
import { InAppWalletsAPIKeysMenu } from "../inAppWalletsAPIKeysMenu"; | ||
|
||
export default async function Page(props: { | ||
params: { | ||
clientId: string; | ||
}; | ||
searchParams: { | ||
tab?: string; | ||
}; | ||
}) { | ||
const authToken = getAuthToken(); | ||
const { clientId } = props.params; | ||
|
||
if (!authToken) { | ||
redirect( | ||
`/login?next=${encodeURIComponent(`/dashboard/connect/in-app-wallets/${clientId}`)}`, | ||
); | ||
} | ||
|
||
const apiKeys = await getInAppWalletSupportedAPIKeys(); | ||
const apiKey = apiKeys.find((key) => key.key === clientId); | ||
|
||
if (!apiKey) { | ||
redirect("/dashboard/connect/in-app-wallets"); | ||
} | ||
|
||
return ( | ||
<div> | ||
{/* header */} | ||
<div className="flex flex-col gap-4 lg:flex-row lg:justify-between"> | ||
<PageHeader /> | ||
<div> | ||
<InAppWalletsAPIKeysMenu apiKeys={apiKeys} selectedAPIKey={apiKey} /> | ||
</div> | ||
</div> | ||
|
||
<div className="h-8" /> | ||
<EmbeddedWallets | ||
apiKey={apiKey} | ||
trackingCategory="embedded-wallet" | ||
defaultTab={props.searchParams.tab === "1" ? 1 : 0} | ||
/> | ||
</div> | ||
); | ||
} |
7 changes: 7 additions & 0 deletions
7
...rd/src/app/(dashboard)/dashboard/connect/in-app-wallets/getInAppWalletSupportedAPIKeys.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { getApiKeys } from "../../../../api/lib/getAPIKeys"; | ||
|
||
export async function getInAppWalletSupportedAPIKeys() { | ||
return (await getApiKeys()).filter((key) => { | ||
return !!(key.services || []).find((srv) => srv.name === "embeddedWallets"); | ||
}); | ||
} |
21 changes: 21 additions & 0 deletions
21
...ashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/inAppWalletsAPIKeysMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"use client"; | ||
|
||
import { useDashboardRouter } from "@/lib/DashboardRouter"; | ||
import type { ApiKey } from "@3rdweb-sdk/react/hooks/useApi"; | ||
import { ApiKeysMenu } from "../../../../../components/settings/ApiKeys/Menu"; | ||
|
||
export function InAppWalletsAPIKeysMenu(props: { | ||
apiKeys: Pick<ApiKey, "name" | "key">[]; | ||
selectedAPIKey: Pick<ApiKey, "name" | "key">; | ||
}) { | ||
const router = useDashboardRouter(); | ||
return ( | ||
<ApiKeysMenu | ||
apiKeys={props.apiKeys} | ||
selectedKey={props.selectedAPIKey} | ||
onSelect={(key) => { | ||
router.push(`/dashboard/connect/in-app-wallets/${key.key}`); | ||
}} | ||
/> | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
apps/dashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { AnalyticsCallout } from "../../../../team/[team_slug]/[project_slug]/connect/in-app-wallets/_components/AnalyticsCallout"; | ||
import { InAppWaletFooterSection } from "../../../../team/[team_slug]/[project_slug]/connect/in-app-wallets/_components/footer"; | ||
|
||
export default function Layout(props: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<div> | ||
{props.children} | ||
<div className="h-16" /> | ||
{/* Footer */} | ||
<AnalyticsCallout trackingCategory="embedded-wallet" /> | ||
<div className="h-5" /> | ||
<InAppWaletFooterSection trackingCategory="embedded-wallet" /> | ||
</div> | ||
); | ||
} |
30 changes: 30 additions & 0 deletions
30
apps/dashboard/src/app/(dashboard)/dashboard/connect/in-app-wallets/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { redirect } from "next/navigation"; | ||
import { NoApiKeys } from "../../../../../components/settings/ApiKeys/NoApiKeys"; | ||
import { getAuthToken } from "../../../../api/lib/getAuthToken"; | ||
import { PageHeader } from "./PageHeader"; | ||
import { getInAppWalletSupportedAPIKeys } from "./getInAppWalletSupportedAPIKeys"; | ||
|
||
export default async function Page() { | ||
const authToken = getAuthToken(); | ||
|
||
if (!authToken) { | ||
redirect( | ||
`/login?next=${encodeURIComponent("/dashboard/connect/in-app-wallets")}`, | ||
); | ||
} | ||
|
||
const apiKeys = await getInAppWalletSupportedAPIKeys(); | ||
const firstKey = apiKeys[0]; | ||
|
||
if (firstKey) { | ||
redirect(`/dashboard/connect/in-app-wallets/${firstKey.key}`); | ||
} | ||
|
||
return ( | ||
<div> | ||
<PageHeader /> | ||
<div className="h-8" /> | ||
<NoApiKeys service="in-app wallets" /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 0 additions & 137 deletions
137
apps/dashboard/src/pages/dashboard/connect/in-app-wallets.tsx
This file was deleted.
Oops, something went wrong.