import Head from "next/head"; import { useRouter } from "next/router"; import { useState } from "react"; import { z } from "zod"; // import TeamGeneralSettings from "@calcom/features/teams/createNewTeam/TeamGeneralSettings"; import AddNewTeamMembers from "@calcom/features/ee/teams/components/v2/AddNewTeamMembers"; import CreateNewTeam from "@calcom/features/ee/teams/components/v2/CreateNewTeam"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { StepCard } from "@components/getting-started/components/StepCard"; import { Steps } from "@components/getting-started/components/Steps"; const INITIAL_STEP = "create-a-new-team"; // TODO: Add teams general settings "general-settings" const steps = ["create-a-new-team", "add-team-members"] as const; const stepTransform = (step: typeof steps[number]) => { const stepIndex = steps.indexOf(step); if (stepIndex > -1) { return steps[stepIndex]; } return INITIAL_STEP; }; const stepRouteSchema = z.object({ step: z.array(z.enum(steps)).default([INITIAL_STEP]), }); const CreateNewTeamPage = () => { const router = useRouter(); const { t } = useLocale(); const [teamId, setTeamId] = useState(); const result = stepRouteSchema.safeParse(router.query); const currentStep = result.success ? result.data.step[0] : INITIAL_STEP; const headers = [ { title: `${t("create_new_team")}`, subtitle: [`${t("create_new_team_description")}`], }, // { // title: `${t("general_settings")}`, // subtitle: [`${t("general_settings_description")}`], // }, { title: `${t("add_team_members")}`, subtitle: [`${t("add_team_members_description")}`], }, ]; const goToIndex = (index: number) => { const newStep = steps[index]; router.push( { pathname: `/settings/teams/new/${stepTransform(newStep)}`, }, undefined ); }; const currentStepIndex = steps.indexOf(currentStep); return (
Create a new Team

{headers[currentStepIndex]?.title || "Undefined title"}

{headers[currentStepIndex]?.subtitle}

{currentStep === "create-a-new-team" && ( { goToIndex(1); }} setTeamId={(teamId: number) => setTeamId(teamId)} /> )} {/* {currentStep === "general-settings" && ( goToIndex(2)} /> )} */} {currentStep === "add-team-members" && teamId && }
); }; export default CreateNewTeamPage;