diff --git a/apps/dashboard/src/@/components/ui/tabs.tsx b/apps/dashboard/src/@/components/ui/tabs.tsx index f74a9e74e6c..e06596e4540 100644 --- a/apps/dashboard/src/@/components/ui/tabs.tsx +++ b/apps/dashboard/src/@/components/ui/tabs.tsx @@ -199,6 +199,7 @@ export function TabPathLinks(props: { path: string; exactMatch?: boolean; isDisabled?: boolean; + isActive?: (pathname: string) => boolean; }[]; className?: string; tabContainerClassName?: string; @@ -212,9 +213,11 @@ export function TabPathLinks(props: { links={links.map((l) => ({ name: l.name, href: l.path, - isActive: l.exactMatch - ? pathname === l.path - : pathname.startsWith(l.path), + isActive: l.isActive + ? l.isActive(pathname) + : l.exactMatch + ? pathname === l.path + : pathname.startsWith(l.path), isDisabled: l.isDisabled, }))} /> diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/page.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/page.tsx index e8c8a734c52..1b134327574 100644 --- a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/page.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/connect/page.tsx @@ -1,5 +1,4 @@ -import { getProject } from "@/api/projects"; -import { notFound, redirect } from "next/navigation"; +import { redirect } from "next/navigation"; export default async function Page(props: { params: Promise<{ @@ -8,11 +7,6 @@ export default async function Page(props: { }>; }) { const params = await props.params; - const project = await getProject(params.team_slug, params.project_slug); - - if (!project) { - notFound(); - } redirect( `/team/${params.team_slug}/${params.project_slug}/connect/in-app-wallets`, diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/layout.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/layout.tsx index 1f092a1a322..82e97357209 100644 --- a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/layout.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/layout.tsx @@ -1,9 +1,9 @@ import { getProjects } from "@/api/projects"; import { getTeamNebulaWaitList, getTeams } from "@/api/team"; -import { TabPathLinks } from "@/components/ui/tabs"; import { notFound, redirect } from "next/navigation"; import { getValidAccount } from "../../../account/settings/getAccount"; import { TeamHeaderLoggedIn } from "../../components/TeamHeader/team-header-logged-in.client"; +import { ProjectTabs } from "./tabs"; export default async function TeamLayout(props: { children: React.ReactNode; @@ -55,39 +55,9 @@ export default async function TeamLayout(props: { teamsAndProjects={teamsAndProjects} account={account} /> -
{props.children}
diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/tabs.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/tabs.tsx new file mode 100644 index 00000000000..dfa2212db26 --- /dev/null +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/tabs.tsx @@ -0,0 +1,49 @@ +"use client"; + +import { TabPathLinks } from "@/components/ui/tabs"; + +export function ProjectTabs(props: { + layoutPath: string; + isOnNebulaWaitList: boolean; +}) { + const { layoutPath, isOnNebulaWaitList } = props; + + return ( + path.startsWith(`${layoutPath}/connect`), + }, + { + path: `${layoutPath}/contracts`, + name: "Contracts", + }, + ...(isOnNebulaWaitList + ? [ + { + path: `${layoutPath}/nebula`, + name: "Nebula", + }, + ] + : []), + { + path: `${layoutPath}/insight`, + name: "Insight", + }, + { + path: `${layoutPath}/settings`, + name: "Settings", + }, + ]} + /> + ); +}