2023-07-07 16:48:51 +00:00
|
|
|
import type { GetServerSidePropsContext } from "next";
|
2023-04-11 16:09:02 +00:00
|
|
|
|
2022-11-10 20:23:56 +00:00
|
|
|
import { TeamsListing } from "@calcom/features/ee/teams/components";
|
2023-01-10 15:39:29 +00:00
|
|
|
import Shell from "@calcom/features/shell/Shell";
|
2022-11-10 20:23:56 +00:00
|
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
2022-09-17 17:53:31 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2023-07-07 16:48:51 +00:00
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2023-01-23 23:08:01 +00:00
|
|
|
import { Button } from "@calcom/ui";
|
2023-04-12 15:26:31 +00:00
|
|
|
import { Plus } from "@calcom/ui/components/icon";
|
2022-09-17 17:53:31 +00:00
|
|
|
|
2023-04-18 18:45:32 +00:00
|
|
|
import PageWrapper from "@components/PageWrapper";
|
|
|
|
|
2023-07-07 16:48:51 +00:00
|
|
|
import { ssrInit } from "@server/lib/ssr";
|
|
|
|
|
2022-09-17 17:53:31 +00:00
|
|
|
function Teams() {
|
|
|
|
const { t } = useLocale();
|
2023-07-07 16:48:51 +00:00
|
|
|
const [user] = trpc.viewer.me.useSuspenseQuery();
|
|
|
|
|
2022-09-17 17:53:31 +00:00
|
|
|
return (
|
|
|
|
<Shell
|
|
|
|
heading={t("teams")}
|
2023-04-19 20:17:54 +00:00
|
|
|
hideHeadingOnMobile
|
2022-09-17 17:53:31 +00:00
|
|
|
subtitle={t("create_manage_teams_collaborative")}
|
|
|
|
CTA={
|
2023-07-07 16:48:51 +00:00
|
|
|
(!user.organizationId || user.organization.isOrgAdmin) && (
|
|
|
|
<Button
|
|
|
|
variant="fab"
|
|
|
|
StartIcon={Plus}
|
|
|
|
type="button"
|
|
|
|
href={`${WEBAPP_URL}/settings/teams/new?returnTo=${WEBAPP_URL}/teams`}>
|
|
|
|
{t("new")}
|
|
|
|
</Button>
|
|
|
|
)
|
2022-09-17 17:53:31 +00:00
|
|
|
}>
|
2022-11-10 20:23:56 +00:00
|
|
|
<TeamsListing />
|
2022-09-17 17:53:31 +00:00
|
|
|
</Shell>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-07-07 16:48:51 +00:00
|
|
|
export const getServerSideProps = async (context: GetServerSidePropsContext) => {
|
|
|
|
const ssr = await ssrInit(context);
|
|
|
|
await ssr.viewer.me.prefetch();
|
|
|
|
|
|
|
|
return { props: { trpcState: ssr.dehydrate() } };
|
2023-04-11 16:09:02 +00:00
|
|
|
};
|
|
|
|
|
2022-09-17 17:53:31 +00:00
|
|
|
Teams.requiresLicense = false;
|
2023-04-18 18:45:32 +00:00
|
|
|
Teams.PageWrapper = PageWrapper;
|
2022-09-17 17:53:31 +00:00
|
|
|
|
|
|
|
export default Teams;
|