-
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.
- Loading branch information
Showing
19 changed files
with
316 additions
and
211 deletions.
There are no files selected for viewing
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
99 changes: 99 additions & 0 deletions
99
apps/dashboard/src/app/(dashboard)/dashboard/connect/ecosystem/EcosystemLandingPage.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,99 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { Card } from "@/components/ui/card"; | ||
import { ToolTipLabel } from "@/components/ui/tooltip"; | ||
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie"; | ||
import { BookMarkedIcon, ExternalLinkIcon, MoveRightIcon } from "lucide-react"; | ||
import { cookies } from "next/headers"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import { redirect } from "next/navigation"; | ||
import headerImage from "./assets/header.png"; | ||
import { fetchEcosystemList } from "./utils/fetchEcosystemList"; | ||
|
||
export async function EcosystemLandingPage(props: { | ||
ecosystemLayoutPath: string; | ||
}) { | ||
const cookiesManager = cookies(); | ||
const activeAccount = cookiesManager.get(COOKIE_ACTIVE_ACCOUNT)?.value; | ||
const authToken = activeAccount | ||
? cookiesManager.get(`${COOKIE_PREFIX_TOKEN}${activeAccount}`)?.value | ||
: null; | ||
|
||
// if user is logged in and has an ecosystem, redirect to the first ecosystem | ||
if (authToken) { | ||
const ecosystems = await fetchEcosystemList(authToken).catch((err) => { | ||
console.error("failed to fetch ecosystems", err); | ||
return []; | ||
}); | ||
if (ecosystems.length > 0) { | ||
redirect(`${props.ecosystemLayoutPath}/${ecosystems[0].slug}`); | ||
} | ||
} | ||
|
||
// otherwise we fall through to the page | ||
|
||
return ( | ||
<main className="container flex flex-col max-w-2xl gap-8 pb-6 mx-auto"> | ||
<Image | ||
src={headerImage} | ||
alt="Ecosystems" | ||
sizes="100vw" | ||
className="w-full" | ||
/> | ||
<div className="flex flex-col gap-2 text-left"> | ||
<h2 className="text-2xl font-bold sm:text-3xl text-foreground text-balance"> | ||
One wallet, a whole ecosystem of apps and games | ||
</h2> | ||
<p className="text-muted-foreground"> | ||
With Ecosystem Wallets, your users can access their assets across | ||
hundreds of apps and games within your ecosystem. You can control | ||
which apps join your ecosystem and how their users interact with your | ||
wallet. | ||
</p> | ||
</div> | ||
<div className="flex flex-col gap-2 sm:flex-row sm:gap-4"> | ||
{!authToken ? ( | ||
<ToolTipLabel label="Connect your wallet to create an ecosystem"> | ||
<Button variant="primary" className="opacity-50"> | ||
Create Ecosystem | ||
</Button> | ||
</ToolTipLabel> | ||
) : ( | ||
<Button variant="primary" asChild> | ||
<Link href={`${props.ecosystemLayoutPath}/create`}> | ||
Create Ecosystem | ||
</Link> | ||
</Button> | ||
)} | ||
<Button variant="outline" asChild> | ||
<Link | ||
href="https://portal.thirdweb.com/connect/ecosystems/overview" | ||
target="_blank" | ||
className="flex flex-row gap-2" | ||
> | ||
Read The Docs | ||
<ExternalLinkIcon className="size-4" /> | ||
</Link> | ||
</Button> | ||
</div> | ||
<div className="w-full h-0 my-2 border-t" /> | ||
<Link | ||
href="https://portal.thirdweb.com/connect/ecosystems/overview" | ||
className="mb-6 group" | ||
> | ||
<Card className="flex flex-col gap-3 p-6 md:p-8 md:px-10"> | ||
<div className="flex items-center gap-2"> | ||
<BookMarkedIcon className="size-5 text-muted-foreground" /> | ||
<h4 className="text-lg font-bold">Learn more</h4> | ||
</div> | ||
<p className="text-muted-foreground text-md"> | ||
Learn how to create and manage Ecosystem Wallets in our docs. | ||
</p> | ||
<div className="flex flex-row items-center gap-2 mt-4 transition-all group-hover:gap-3 group-hover:text-primary/80 text-primary text-md"> | ||
View Docs <MoveRightIcon className="size-4" /> | ||
</div> | ||
</Card> | ||
</Link> | ||
</main> | ||
); | ||
} |
19 changes: 19 additions & 0 deletions
19
.../app/(dashboard)/dashboard/connect/ecosystem/[slug]/(active)/EcosystemPermissionsPage.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,19 @@ | ||
"use client"; | ||
import { EcosystemPartnersSection } from "./components/server/ecosystem-partners-section"; | ||
import { IntegrationPermissionsSection } from "./components/server/integration-permissions-section"; | ||
import { useEcosystem } from "./hooks/use-ecosystem"; | ||
|
||
export function EcosystemPermissionsPage({ | ||
params, | ||
}: { params: { slug: string } }) { | ||
const { ecosystem } = useEcosystem({ slug: params.slug }); | ||
|
||
return ( | ||
<div className="flex flex-col gap-12"> | ||
<IntegrationPermissionsSection ecosystem={ecosystem} /> | ||
{ecosystem?.permission === "PARTNER_WHITELIST" && ( | ||
<EcosystemPartnersSection ecosystem={ecosystem} /> | ||
)} | ||
</div> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
...d/src/app/(dashboard)/dashboard/connect/ecosystem/[slug]/(active)/EcosystemSlugLayout.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,42 @@ | ||
import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie"; | ||
import { cookies } from "next/headers"; | ||
import { redirect } from "next/navigation"; | ||
import { getAddress } from "thirdweb"; | ||
import { fetchEcosystem } from "../../utils/fetchEcosystem"; | ||
import { EcosystemHeader } from "./components/client/ecosystem-header.client"; | ||
|
||
export async function EcosystemLayoutSlug({ | ||
children, | ||
params, | ||
ecosystemLayoutPath, | ||
}: { | ||
children: React.ReactNode; | ||
params: { slug: string }; | ||
ecosystemLayoutPath: string; | ||
}) { | ||
const cookiesManager = cookies(); | ||
const activeAccount = cookiesManager.get(COOKIE_ACTIVE_ACCOUNT)?.value; | ||
const authToken = activeAccount | ||
? cookies().get(COOKIE_PREFIX_TOKEN + getAddress(activeAccount))?.value | ||
: null; | ||
|
||
if (!authToken) { | ||
redirect(ecosystemLayoutPath); | ||
} | ||
|
||
const ecosystem = await fetchEcosystem(params.slug, authToken); | ||
|
||
if (!ecosystem) { | ||
redirect(ecosystemLayoutPath); | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col w-full gap-10 px-2 py-10 sm:px-4"> | ||
<EcosystemHeader | ||
ecosystem={ecosystem} | ||
ecosystemLayoutPath={ecosystemLayoutPath} | ||
/> | ||
{children} | ||
</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
50 changes: 6 additions & 44 deletions
50
apps/dashboard/src/app/(dashboard)/dashboard/connect/ecosystem/[slug]/(active)/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
5 changes: 5 additions & 0 deletions
5
apps/dashboard/src/app/(dashboard)/dashboard/connect/ecosystem/[slug]/(active)/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,5 @@ | ||
import { EcosystemPermissionsPage } from "./EcosystemPermissionsPage"; | ||
|
||
export default function Page({ params }: { params: { slug: string } }) { | ||
return <EcosystemPermissionsPage params={params} />; | ||
} |
17 changes: 0 additions & 17 deletions
17
...oard/src/app/(dashboard)/dashboard/connect/ecosystem/[slug]/(active)/permissions/page.tsx
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
.../dashboard/src/app/(dashboard)/dashboard/connect/ecosystem/create/EcosystemCreatePage.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,29 @@ | ||
import { CreateEcosystemForm } from "./components/client/create-ecosystem-form.client"; | ||
import { EcosystemWalletPricingCard } from "./components/pricing-card"; | ||
|
||
export function EcosystemCreatePage(props: { | ||
ecosystemLayoutPath: string; | ||
}) { | ||
return ( | ||
<div className="flex flex-col w-full gap-10 px-2 py-10 sm:px-4"> | ||
<header className="flex flex-col gap-2"> | ||
<h2 className="text-4xl font-bold text-foreground"> | ||
Create an Ecosystem | ||
</h2> | ||
<p className="text-muted-foreground"> | ||
Create wallets that work across every chain and every app. | ||
</p> | ||
</header> | ||
<main className="grid w-full max-w-sm gap-8 md:max-w-lg lg:max-w-4xl xl:gap-12 lg:grid-cols-2"> | ||
<section className="flex items-start"> | ||
<EcosystemWalletPricingCard /> | ||
</section> | ||
<section className="mb-12 lg:px-4"> | ||
<CreateEcosystemForm | ||
ecosystemLayoutPath={props.ecosystemLayoutPath} | ||
/> | ||
</section> | ||
</main> | ||
</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
Oops, something went wrong.