import { MembershipRole } from "@prisma/client"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import SAMLConfiguration from "@calcom/features/ee/common/components/SamlConfiguration"; import { getPlaceholderAvatar } from "@calcom/lib/getPlaceholderAvatar"; import showToast from "@calcom/lib/notification"; import { trpc } from "@calcom/trpc/react"; import { SkeletonAvatar, SkeletonText } from "@calcom/ui"; import { Alert } from "@calcom/ui/Alert"; import { Button } from "@calcom/ui/Button"; import { Icon } from "@calcom/ui/Icon"; import Shell from "@calcom/ui/Shell"; import { QueryCell } from "@lib/QueryCell"; import useCurrentUserId from "@lib/hooks/useCurrentUserId"; import { useLocale } from "@lib/hooks/useLocale"; import DisableTeamImpersonation from "@components/team/DisableTeamImpersonation"; import MemberInvitationModal from "@components/team/MemberInvitationModal"; import MemberList from "@components/team/MemberList"; import TeamSettings from "@components/team/TeamSettings"; import TeamSettingsRightSidebar from "@components/team/TeamSettingsRightSidebar"; import { UpgradeToFlexibleProModal } from "@components/team/UpgradeToFlexibleProModal"; import Avatar from "@components/ui/Avatar"; export function TeamSettingsPage() { const { t } = useLocale(); const router = useRouter(); const userId = useCurrentUserId(); const upgraded = router.query.upgraded as string; useEffect(() => { if (upgraded) { showToast(t("team_upgraded_successfully"), "success"); } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const [showMemberInvitationModal, setShowMemberInvitationModal] = useState(false); const [errorMessage, setErrorMessage] = useState(""); const query = trpc.useQuery(["viewer.teams.get", { teamId: Number(router.query.id) }], { onError: (e) => { setErrorMessage(e.message); }, }); return ( { return ( } subtitle={} HeadingLeftIcon={}> <>
); }} success={({ data: team }) => { const isAdmin = team && (team.membership.role === MembershipRole.OWNER || team.membership.role === MembershipRole.ADMIN); return ( ) }> {!!errorMessage && } {team && ( <>
{team.membership.role === MembershipRole.OWNER && team.membership.isMissingSeat && team.requiresUpgrade ? ( {t("hidden_team_owner_message")} {/* {"https://cal.com/upgrade"} */} } className="mb-4 " /> ) : ( <> {team.membership.isMissingSeat && ( )} {team.membership.role === MembershipRole.OWNER && team.requiresUpgrade && ( {t("upgrade_to_flexible_pro_message")}
} className="mb-4" /> )} )}
{isAdmin ? ( ) : (
{t("team_info")}

{team.bio}

)}

{t("members")}

{isAdmin && (
)}
{isAdmin && } {userId && }
{showMemberInvitationModal && ( setShowMemberInvitationModal(false)} /> )} )}
); }} /> ); } export default TeamSettingsPage;