import { MembershipRole } from "@prisma/client"; import Link from "next/link"; import { useRouter } from "next/router"; import React from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { TeamWithMembers } from "@calcom/lib/server/queries/teams"; import { trpc } from "@calcom/trpc/react"; import ConfirmationDialogContent from "@calcom/ui/ConfirmationDialogContent"; import { Icon } from "@calcom/ui/Icon"; import { Dialog, DialogTrigger } from "@calcom/ui/v2/core/Dialog"; import LinkIconButton from "@calcom/ui/v2/core/LinkIconButton"; import showToast from "@calcom/ui/v2/core/notifications"; import CreateEventTypeButton from "../event-types/CreateEventType"; export default function TeamSettingsRightSidebar(props: { team: TeamWithMembers; role: MembershipRole }) { const { t } = useLocale(); const utils = trpc.useContext(); const router = useRouter(); const permalink = `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/${props.team?.slug}`; const deleteTeamMutation = trpc.useMutation("viewer.teams.delete", { async onSuccess() { await utils.invalidateQueries(["viewer.teams.get"]); router.push(`/settings/teams`); showToast(t("your_team_updated_successfully"), "success"); }, }); const acceptOrLeaveMutation = trpc.useMutation("viewer.teams.acceptOrLeave", { onSuccess: () => { utils.invalidateQueries(["viewer.teams.list"]); router.push(`/settings/teams`); }, }); function deleteTeam() { if (props.team?.id) deleteTeamMutation.mutate({ teamId: props.team.id }); } function leaveTeam() { if (props.team?.id) acceptOrLeaveMutation.mutate({ teamId: props.team.id, accept: false, }); } return (
See your team members availability at a glance.