Skip to content

Commit 7130592

Browse files
authored
Merge branch 'main' into origin/nir/depracate-pages
2 parents d10a940 + 834ed83 commit 7130592

File tree

23 files changed

+189
-57
lines changed

23 files changed

+189
-57
lines changed

.changeset/slick-eyes-reply.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/analytics/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default async function Page(props: {
2828
}
2929

3030
const [ecosystem, team] = await Promise.all([
31-
fetchEcosystem(params.slug, authToken),
31+
fetchEcosystem(params.slug, authToken, params.team_slug),
3232
getTeamBySlug(params.team_slug),
3333
]);
3434

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/EcosystemSlugLayout.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export async function EcosystemLayoutSlug({
1010
ecosystemLayoutPath,
1111
}: {
1212
children: React.ReactNode;
13-
params: { slug: string };
13+
params: { slug: string; team_slug: string };
1414
ecosystemLayoutPath: string;
1515
}) {
1616
const authToken = await getAuthToken();
@@ -19,7 +19,11 @@ export async function EcosystemLayoutSlug({
1919
redirect(ecosystemLayoutPath);
2020
}
2121

22-
const ecosystem = await fetchEcosystem(params.slug, authToken);
22+
const ecosystem = await fetchEcosystem(
23+
params.slug,
24+
authToken,
25+
params.team_slug,
26+
);
2327

2428
if (!ecosystem) {
2529
redirect(ecosystemLayoutPath);
@@ -30,6 +34,7 @@ export async function EcosystemLayoutSlug({
3034
<EcosystemHeader
3135
ecosystem={ecosystem}
3236
ecosystemLayoutPath={ecosystemLayoutPath}
37+
teamIdOrSlug={params.team_slug}
3338
/>
3439

3540
<SidebarLayout

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/ecosystem-header.client.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@ function EcosystemAlertBanner({ ecosystem }: { ecosystem: Ecosystem }) {
6262
function EcosystemSelect(props: {
6363
ecosystem: Ecosystem;
6464
ecosystemLayoutPath: string;
65+
teamIdOrSlug: string;
6566
}) {
66-
const { data: ecosystems, isPending } = useEcosystemList();
67+
const { data: ecosystems, isPending } = useEcosystemList({
68+
teamIdOrSlug: props.teamIdOrSlug,
69+
});
6770

6871
return isPending ? (
6972
<Skeleton className="h-10 w-full md:w-[160px]" />
@@ -109,8 +112,10 @@ function EcosystemSelect(props: {
109112
export function EcosystemHeader(props: {
110113
ecosystem: Ecosystem;
111114
ecosystemLayoutPath: string;
115+
teamIdOrSlug: string;
112116
}) {
113117
const { data: fetchedEcosystem } = useEcosystem({
118+
teamIdOrSlug: props.teamIdOrSlug,
114119
slug: props.ecosystem.slug,
115120
refetchInterval:
116121
props.ecosystem.status === "requested"
@@ -192,6 +197,7 @@ export function EcosystemHeader(props: {
192197
<EcosystemSelect
193198
ecosystem={ecosystem}
194199
ecosystemLayoutPath={props.ecosystemLayoutPath}
200+
teamIdOrSlug={props.teamIdOrSlug}
195201
/>
196202
</div>
197203
</div>

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/EcosystemPermissionsPage.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import { IntegrationPermissionsSection } from "../server/integration-permissions
77
export function EcosystemPermissionsPage({
88
params,
99
authToken,
10-
}: { params: { slug: string }; authToken: string }) {
11-
const { data: ecosystem } = useEcosystem({ slug: params.slug });
10+
}: { params: { slug: string; team_slug: string }; authToken: string }) {
11+
const { data: ecosystem } = useEcosystem({
12+
slug: params.slug,
13+
teamIdOrSlug: params.team_slug,
14+
});
1215

1316
return (
1417
<div className="flex flex-col gap-8">

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/hooks/use-ecosystem.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@ import { useQuery } from "@tanstack/react-query";
33
import type { Ecosystem } from "../../../types";
44

55
export function useEcosystem({
6+
teamIdOrSlug,
67
slug,
78
refetchInterval,
89
refetchOnWindowFocus,
910
initialData,
1011
}: {
12+
teamIdOrSlug: string;
1113
slug: string;
1214
refetchInterval?: number;
1315
refetchOnWindowFocus?: boolean;
1416
initialData?: Ecosystem;
1517
}) {
1618
return useQuery({
17-
queryKey: ["ecosystems", slug],
19+
queryKey: ["ecosystems", teamIdOrSlug, slug],
1820
queryFn: async () => {
1921
const res = await apiServerProxy({
20-
pathname: `/v1/ecosystem-wallet/${slug}`,
22+
pathname: `/v1/teams/${teamIdOrSlug}/ecosystem-wallet/${slug}`,
2123
method: "GET",
2224
});
2325

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/hooks/use-ecosystem-list.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@ import { useQuery } from "@tanstack/react-query";
33
import { useActiveAccount } from "thirdweb/react";
44
import type { Ecosystem } from "../types";
55

6-
export function useEcosystemList() {
6+
export function useEcosystemList({
7+
teamIdOrSlug,
8+
}: {
9+
teamIdOrSlug: string;
10+
}) {
711
const address = useActiveAccount()?.address;
812
return useQuery({
9-
queryKey: ["ecosystems", address],
13+
queryKey: ["ecosystems", teamIdOrSlug, address],
1014
queryFn: async () => {
1115
const res = await apiServerProxy({
12-
pathname: "/v1/ecosystem-wallet/list",
16+
pathname: `/v1/teams/${teamIdOrSlug}/ecosystem-wallet`,
1317
method: "GET",
1418
});
1519

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/page.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ export default async function Page(props: {
2020
loginRedirect(ecosystemLayoutPath);
2121
}
2222

23-
const ecosystems = await fetchEcosystemList(authToken).catch((err) => {
24-
console.error("failed to fetch ecosystems", err);
25-
return [];
26-
});
23+
const ecosystems = await fetchEcosystemList(authToken, team_slug).catch(
24+
(err) => {
25+
console.error("failed to fetch ecosystems", err);
26+
return [];
27+
},
28+
);
2729
if (ecosystems[0]) {
2830
redirect(`${ecosystemLayoutPath}/${ecosystems[0].slug}`);
2931
}

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/utils/fetchEcosystem.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { API_SERVER_URL } from "@/constants/env";
22
import type { Ecosystem } from "../types";
33

4-
export async function fetchEcosystem(slug: string, authToken: string) {
5-
const res = await fetch(`${API_SERVER_URL}/v1/ecosystem-wallet/${slug}`, {
6-
headers: {
7-
Authorization: `Bearer ${authToken}`,
4+
export async function fetchEcosystem(
5+
slug: string,
6+
authToken: string,
7+
teamIdOrSlug: string,
8+
) {
9+
const res = await fetch(
10+
`${API_SERVER_URL}/v1/teams/${teamIdOrSlug}/ecosystem-wallet/${slug}`,
11+
{
12+
headers: {
13+
Authorization: `Bearer ${authToken}`,
14+
},
815
},
9-
});
16+
);
1017
if (!res.ok) {
1118
const data = await res.json();
1219
console.error(data);

apps/dashboard/src/app/team/[team_slug]/(team)/~/ecosystem/utils/fetchEcosystemList.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { API_SERVER_URL } from "@/constants/env";
22
import type { Ecosystem } from "../types";
33

4-
export async function fetchEcosystemList(authToken: string) {
5-
const res = await fetch(`${API_SERVER_URL}/v1/ecosystem-wallet/list`, {
6-
headers: {
7-
Authorization: `Bearer ${authToken}`,
4+
export async function fetchEcosystemList(
5+
authToken: string,
6+
teamIdOrSlug: string,
7+
) {
8+
const res = await fetch(
9+
`${API_SERVER_URL}/v1/teams/${teamIdOrSlug}/ecosystem-wallet`,
10+
{
11+
headers: {
12+
Authorization: `Bearer ${authToken}`,
13+
},
814
},
9-
});
15+
);
1016

1117
if (!res.ok) {
1218
const data = await res.json();

0 commit comments

Comments
 (0)