);
diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemAnalyticsPage.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemAnalyticsPage.tsx
index 0433316c8c2..32c20c6c96c 100644
--- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemAnalyticsPage.tsx
+++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/components/EcosystemAnalyticsPage.tsx
@@ -5,25 +5,57 @@ import {
import { RangeSelector } from "components/analytics/range-selector";
import { getEcosystemWalletUsage } from "data/analytics/wallets/ecosystem";
import { EcosystemWalletUsersChartCard } from "./EcosystemWalletUsersChartCard";
+import { EcosystemWalletsSummary } from "./Summary";
export async function EcosystemAnalyticsPage({
ecosystemSlug,
interval,
range,
-}: { ecosystemSlug: string; interval: "day" | "week"; range?: Range }) {
+}: {
+ ecosystemSlug: string;
+ interval: "day" | "week";
+ range?: Range;
+}) {
if (!range) {
range = getLastNDaysRange("last-120");
}
- const stats = await getEcosystemWalletUsage({
+ const allTimeStatsPromise = getEcosystemWalletUsage({
+ ecosystemSlug,
+ from: new Date(2022, 0, 1),
+ to: new Date(),
+ period: "all",
+ });
+
+ const monthlyStatsPromise = getEcosystemWalletUsage({
+ ecosystemSlug,
+ from: new Date(new Date().getFullYear(), new Date().getMonth(), 1),
+ to: new Date(),
+ period: "month",
+ });
+
+ const statsPromise = getEcosystemWalletUsage({
ecosystemSlug,
from: range.from,
to: range.to,
period: interval,
}).catch(() => null);
+ const [allTimeStats, monthlyStats, stats] = await Promise.all([
+ allTimeStatsPromise,
+ monthlyStatsPromise,
+ statsPromise,
+ ]);
+
return (
+
+
+
+
diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/page.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/page.tsx
index 0b3f809d281..dc18b1becc9 100644
--- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/page.tsx
+++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/page.tsx
@@ -1,7 +1,7 @@
import type { Range } from "components/analytics/date-range-selector";
-import { fetchApiServer } from "data/analytics/fetch-api-server";
-import { FetchError } from "utils/error";
-import type { Ecosystem } from "../../../types";
+import { redirect } from "next/navigation";
+import { getAuthToken } from "../../../../../../../../api/lib/getAuthToken";
+import { fetchEcosystem } from "../../../utils/fetchEcosystem";
import { EcosystemAnalyticsPage } from "./components/EcosystemAnalyticsPage";
export default async function Page(props: {
@@ -19,7 +19,19 @@ export default async function Page(props: {
props.searchParams,
]);
- const ecosystem = await getEcosystem(params.slug);
+ const ecosystemLayoutPath = `/team/${params.team_slug}/~/ecosystem`;
+ const authToken = await getAuthToken();
+
+ if (!authToken) {
+ redirect(ecosystemLayoutPath);
+ }
+
+ const ecosystem = await fetchEcosystem(params.slug, authToken);
+
+ if (!ecosystem) {
+ redirect(ecosystemLayoutPath);
+ }
+
return (
);
}
-
-async function getEcosystem(ecosystemSlug: string) {
- const res = await fetchApiServer(`/v1/ecosystem-wallet/${ecosystemSlug}`);
-
- if (!res.ok) {
- const data = await res.json();
- console.error(data);
- throw new FetchError(
- res,
- data?.message ?? data?.error?.message ?? "Failed to fetch ecosystems",
- );
- }
-
- const data = (await res.json()) as { result: Ecosystem };
- return data.result;
-}
diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/EcosystemSlugLayout.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/EcosystemSlugLayout.tsx
index 90149874100..b53977e5974 100644
--- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/EcosystemSlugLayout.tsx
+++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/EcosystemSlugLayout.tsx
@@ -1,8 +1,7 @@
-import { COOKIE_ACTIVE_ACCOUNT, COOKIE_PREFIX_TOKEN } from "@/constants/cookie";
-import { getEcosystemWalletUsage } from "data/analytics/wallets/ecosystem";
-import { cookies } from "next/headers";
+import { SidebarLayout } from "@/components/blocks/SidebarLayout";
+import {} from "@/constants/cookie";
import { redirect } from "next/navigation";
-import { getAddress } from "thirdweb";
+import { getAuthToken } from "../../../../../../../../api/lib/getAuthToken";
import { fetchEcosystem } from "../../../utils/fetchEcosystem";
import { EcosystemHeader } from "./ecosystem-header.client";
@@ -15,12 +14,7 @@ export async function EcosystemLayoutSlug({
params: { slug: string };
ecosystemLayoutPath: string;
}) {
- const cookiesManager = await cookies();
- const activeAccount = cookiesManager.get(COOKIE_ACTIVE_ACCOUNT)?.value;
- const authToken = activeAccount
- ? (await cookies()).get(COOKIE_PREFIX_TOKEN + getAddress(activeAccount))
- ?.value
- : null;
+ const authToken = await getAuthToken();
if (!authToken) {
redirect(ecosystemLayoutPath);
@@ -32,34 +26,32 @@ export async function EcosystemLayoutSlug({
redirect(ecosystemLayoutPath);
}
- const allTimeStatsPromise = getEcosystemWalletUsage({
- ecosystemSlug: ecosystem.slug,
- from: new Date(2022, 0, 1),
- to: new Date(),
- period: "all",
- });
-
- const monthlyStatsPromise = getEcosystemWalletUsage({
- ecosystemSlug: ecosystem.slug,
- from: new Date(new Date().getFullYear(), new Date().getMonth(), 1),
- to: new Date(),
- period: "month",
- });
-
- const [allTimeStats, monthlyStats] = await Promise.all([
- allTimeStatsPromise,
- monthlyStatsPromise,
- ]);
-
return (
-
+
- {children}
+
+
+ {children}
+
);
}
diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/ecosystem-header.client.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/ecosystem-header.client.tsx
index 75e9c0054f0..d71bdb600f3 100644
--- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/ecosystem-header.client.tsx
+++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/ecosystem-header.client.tsx
@@ -1,5 +1,6 @@
"use client";
-import { CopyButton } from "@/components/ui/CopyButton";
+import { Img } from "@/components/blocks/Img";
+import { CopyTextButton } from "@/components/ui/CopyTextButton";
import { Spinner } from "@/components/ui/Spinner/Spinner";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
@@ -12,21 +13,18 @@ import {
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
import { Skeleton } from "@/components/ui/skeleton";
-import { TabPathLinks } from "@/components/ui/tabs";
import { useThirdwebClient } from "@/constants/thirdweb.client";
import { resolveSchemeWithErrorHandler } from "@/lib/resolveSchemeWithErrorHandler";
import {
AlertTriangleIcon,
CheckIcon,
ChevronsUpDown,
+ ExternalLinkIcon,
PlusCircleIcon,
} from "lucide-react";
-import Image from "next/image";
import Link from "next/link";
-import type { EcosystemWalletStats } from "types/analytics";
import { useEcosystemList } from "../../../hooks/use-ecosystem-list";
import type { Ecosystem } from "../../../types";
-import { EcosystemWalletsSummary } from "../analytics/components/Summary";
import { useEcosystem } from "../hooks/use-ecosystem";
function EcosystemAlertBanner({ ecosystem }: { ecosystem: Ecosystem }) {
@@ -111,8 +109,6 @@ function EcosystemSelect(props: {
export function EcosystemHeader(props: {
ecosystem: Ecosystem;
ecosystemLayoutPath: string;
- allTimeStats: EcosystemWalletStats[];
- monthlyStats: EcosystemWalletStats[];
}) {
const { data: fetchedEcosystem } = useEcosystem({
slug: props.ecosystem.slug,
@@ -135,95 +131,72 @@ export function EcosystemHeader(props: {
});
return (
-
-
-
-
-
- {!ecosystem.imageUrl ? (
-
- ) : (
- ecosystemImageLink && (
-
-
+
+
+
+
+
+ {!ecosystem.imageUrl ? (
+
+ ) : (
+ ecosystemImageLink && (
+

-
- )
- )}
-
- {!ecosystem.name ? (
-
- ) : (
-
- {ecosystem.name}
-
+ )
)}
- {!ecosystem.slug ? (
-
- ) : (
-
-
-
- ecosystem.{ecosystem.slug}
-
-
-
-
- )}
+ )}
+
+
+
+
-
-
-
-
-
-
-
+
+
);
}
diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/page.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/page.tsx
deleted file mode 100644
index b62af1259e2..00000000000
--- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/page.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { getAuthToken } from "../../../../../../../../api/lib/getAuthToken";
-import { loginRedirect } from "../../../../../../../../login/loginRedirect";
-import { EcosystemPermissionsPage } from "./components/client/EcosystemPermissionsPage";
-
-export default async function Page(props: {
- params: Promise<{ team_slug: string; slug: string }>;
-}) {
- const params = await props.params;
- const authToken = await getAuthToken();
-
- if (!authToken) {
- loginRedirect(
- `/team/${params.team_slug}/~/ecosystem/${params.slug}/configuration`,
- );
- }
-
- return
;
-}
diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/loading.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/loading.tsx
index 6c54ef15def..0528bd15ae9 100644
--- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/loading.tsx
+++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/loading.tsx
@@ -1,3 +1,7 @@
"use client";
-export { GenericLoadingPage as default } from "@/components/blocks/skeletons/GenericLoadingPage";
+import { GenericLoadingPage } from "@/components/blocks/skeletons/GenericLoadingPage";
+
+export default function Loading() {
+ return
;
+}
diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/EcosystemCreatePage.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/EcosystemCreatePage.tsx
index ba3fcdfbadb..d4813ff4820 100644
--- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/EcosystemCreatePage.tsx
+++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/EcosystemCreatePage.tsx
@@ -3,22 +3,12 @@ import { EcosystemWalletPricingCard } from "./components/pricing-card";
export async function EcosystemCreatePage(props: { teamSlug: string }) {
return (
-
-
-
-
-
+
);
diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx
index 65a5fb4a19a..11ee2de0a1c 100644
--- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx
+++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/create/components/client/create-ecosystem-form.client.tsx
@@ -1,4 +1,5 @@
"use client";
+import { Spinner } from "@/components/ui/Spinner/Spinner";
import { Button } from "@/components/ui/button";
import {
Form,
@@ -14,7 +15,7 @@ import { ImageUpload } from "@/components/ui/image-upload";
import { Input } from "@/components/ui/input";
import { RadioGroup, RadioGroupItemButton } from "@/components/ui/radio-group";
import { zodResolver } from "@hookform/resolvers/zod";
-import { Loader2 } from "lucide-react";
+import { ArrowRightIcon } from "lucide-react";
import Link from "next/link";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
@@ -45,138 +46,159 @@ export function CreateEcosystemForm(props: { teamSlug: string }) {
});
return (
- <>
-