import { MembershipRole } from "@prisma/client"; import { useSession } from "next-auth/react"; import { useRouter } from "next/router"; import { useState } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Icon } from "@calcom/ui/Icon"; import { Alert, Button } from "@calcom/ui/v2/core"; import Meta from "@calcom/ui/v2/core/Meta"; import { getLayout } from "@calcom/ui/v2/core/layouts/SettingsLayout"; import DisableTeamImpersonation from "../components/DisableTeamImpersonation"; import MemberInvitationModal from "../components/MemberInvitationModal"; import MemberListItem from "../components/MemberListItem"; import TeamInviteList from "../components/TeamInviteList"; import { UpgradeToFlexibleProModal } from "../components/UpgradeToFlexibleProModal"; const MembersView = () => { const { t } = useLocale(); const router = useRouter(); const session = useSession(); const { data: team, isLoading } = trpc.useQuery(["viewer.teams.get", { teamId: Number(router.query.id) }], { onError: () => { router.push("/settings"); }, }); const [showMemberInvitationModal, setShowMemberInvitationModal] = useState(false); const isInviteOpen = !team?.membership.accepted; const isAdmin = team && (team.membership.role === MembershipRole.OWNER || team.membership.role === MembershipRole.ADMIN); return ( <> {!isLoading && ( <>
{team && ( <> {isInviteOpen && ( )} {team.membership.role === MembershipRole.OWNER && team.membership.isMissingSeat && team.requiresUpgrade ? ( {t("hidden_team_owner_message")} } className="mb-4 " /> ) : ( <> {team.membership.isMissingSeat && ( )} {team.membership.role === MembershipRole.OWNER && team.requiresUpgrade && ( {t("upgrade_to_flexible_pro_message")}
} className="mb-4" /> )} )} )} {isAdmin && (
)}
    {team?.members.map((member) => { return ; })}

{team && session.data && ( )}
{showMemberInvitationModal && team && ( setShowMemberInvitationModal(false)} /> )} )} ); }; MembersView.getLayout = getLayout; export default MembersView;