Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dashboard/src/@/api/team/team-subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const CHAIN_PLAN_TO_INFRA = {
],
};

export async function getChainSubscriptions(slug: string) {
async function getChainSubscriptions(slug: string) {
const allSubscriptions = await getTeamSubscriptions(slug);
if (!allSubscriptions) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@ import {
HelpCircleIcon,
HomeIcon,
SettingsIcon,
WalletCardsIcon,
} from "lucide-react";
import { FullWidthSidebarLayout } from "@/components/blocks/full-width-sidebar-layout";

export function TeamSidebarLayout(props: {
layoutPath: string;
children: React.ReactNode;
ecosystems: Array<{ name: string; slug: string }>;
chainSubscriptions: Array<{
chainId: number;
chainName: string;
slug: string;
}>;
}) {
const { layoutPath, children } = props;

Expand Down Expand Up @@ -72,24 +66,6 @@ export function TeamSidebarLayout(props: {
{
separator: true,
} as const,
// infrastructure below here
// TODO: make this one link to an overview page that has a list of all the chains currently deployed
{
links: [
...props.chainSubscriptions.map((chainSubscription) => ({
href: `${layoutPath}/~/infrastructure/${chainSubscription.slug}`,
label: chainSubscription.chainName,
})),
{
href: `${layoutPath}/~/infrastructure/deploy`,
label: "Deploy Infrastructure",
},
],
subMenu: {
icon: WalletCardsIcon,
label: "Chain Infrastucture",
},
},
]}
footerSidebarLinks={[
{
Expand Down
61 changes: 15 additions & 46 deletions apps/dashboard/src/app/(app)/team/[team_slug]/(team)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import { getAuthToken, getAuthTokenWalletAddress } from "@/api/auth-token";
import { getProjects } from "@/api/project/projects";
import { fetchEcosystemList } from "@/api/team/ecosystems";
import { getTeamBySlug, getTeams } from "@/api/team/get-team";
import { getChainSubscriptions } from "@/api/team/team-subscription";
import { CustomChatButton } from "@/components/chat/CustomChatButton";
import { AnnouncementBanner } from "@/components/misc/AnnouncementBanner";
import { SidebarProvider } from "@/components/ui/sidebar";
import { siwaExamplePrompts } from "@/constants/siwa-example-prompts";
import { getClientThirdwebClient } from "@/constants/thirdweb-client.client";
import { getChain } from "../../../(dashboard)/(chain)/utils";
import { TeamHeaderLoggedIn } from "../../components/TeamHeader/team-header-logged-in.client";
import { StaffModeNotice } from "./_components/StaffModeNotice";
import { TeamSidebarLayout } from "./TeamSidebarLayout";
Expand All @@ -21,52 +19,26 @@ export default async function TeamLayout(props: {
}) {
const params = await props.params;

const [
accountAddress,
account,
teams,
authToken,
team,
ecosystems,
chainSubscriptions,
] = await Promise.all([
getAuthTokenWalletAddress(),
getValidAccount(`/team/${params.team_slug}`),
getTeams(),
getAuthToken(),
getTeamBySlug(params.team_slug),
fetchEcosystemList(params.team_slug),
getChainSubscriptions(params.team_slug),
]);
const [accountAddress, account, teams, authToken, team, ecosystems] =
await Promise.all([
getAuthTokenWalletAddress(),
getValidAccount(`/team/${params.team_slug}`),
getTeams(),
getAuthToken(),
getTeamBySlug(params.team_slug),
fetchEcosystemList(params.team_slug),
]);

if (!teams || !accountAddress || !authToken || !team) {
redirect("/login");
}

const [teamsAndProjects, chainSidebarLinks] = await Promise.all([
Promise.all(
teams.map(async (team) => ({
projects: await getProjects(team.slug),
team,
})),
),
chainSubscriptions
? await Promise.all(
chainSubscriptions.map(async (chainSubscription) => {
if (!chainSubscription.chainId) {
throw new Error("Chain ID is required");
}
const chain = await getChain(chainSubscription.chainId);

return {
chainId: chain.chainId,
chainName: chain.name,
slug: chain.slug,
};
}),
).catch(() => [])
: [],
]);
const teamsAndProjects = await Promise.all(
teams.map(async (team) => ({
projects: await getProjects(team.slug),
team,
})),
);

const client = getClientThirdwebClient({
jwt: authToken,
Expand All @@ -92,9 +64,6 @@ export default async function TeamLayout(props: {
</div>

<TeamSidebarLayout
chainSubscriptions={chainSidebarLinks.sort(
(a, b) => a.chainId - b.chainId,
)}
ecosystems={ecosystems.map((ecosystem) => ({
name: ecosystem.name,
slug: ecosystem.slug,
Expand Down
Loading