perf: move /teams route to (main-nav) route group (#19037)

This commit is contained in:
Benny Joo authored and GitHub committed 2025-01-31 21:12:12 +01:00
1 parent dde76ed74d
commit 8dd05dda70
3 files changed
+50 -48

No files matched your search

+15 -28
View File
@@ -1,7 +1,6 @@
"use client";
import { TeamsListing } from "@calcom/features/ee/teams/components";
import Shell from "@calcom/features/shell/Shell";
import { WEBAPP_URL } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
@@ -11,36 +10,24 @@ import { Button } from "@calcom/ui";
import type { getServerSideProps } from "@lib/teams/getServerSideProps";
export type PageProps = inferSSRProps<typeof getServerSideProps>;
function Teams(props: PageProps) {
export const TeamsCTA = () => {
const { t } = useLocale();
const [user] = trpc.viewer.me.useSuspenseQuery();
return !user.organizationId || user.organization.isOrgAdmin ? (
<Button
data-testid="new-team-btn"
variant="fab"
StartIcon="plus"
type="button"
href={`${WEBAPP_URL}/settings/teams/new?returnTo=${WEBAPP_URL}/teams`}>
{t("new")}
</Button>
) : null;
};
return (
<Shell
withoutMain={false}
withoutSeo={true}
heading={t("teams")}
subtitle={t("create_manage_teams_collaborative")}
title={t("teams")}
description={t("create_manage_teams_collaborative")}
hideHeadingOnMobile
CTA={
(!user.organizationId || user.organization.isOrgAdmin) && (
<Button
data-testid="new-team-btn"
variant="fab"
StartIcon="plus"
type="button"
href={`${WEBAPP_URL}/settings/teams/new?returnTo=${WEBAPP_URL}/teams`}>
{t("new")}
</Button>
)
}>
<TeamsListing />
</Shell>
);
function Teams(props: PageProps) {
return <TeamsListing />;
}
Teams.requiresLicense = false;
export default Teams;