import { useState } from "react"; import { inferQueryOutput, trpc } from "@calcom/trpc/react"; import showToast from "@calcom/ui/v2/core/notifications"; import TeamListItem from "./TeamListItem"; interface Props { teams: inferQueryOutput<"viewer.teams.list">; } export default function TeamList(props: Props) { const utils = trpc.useContext(); const [hideDropdown, setHideDropdown] = useState(false); function selectAction(action: string, teamId: number) { switch (action) { case "disband": deleteTeam(teamId); break; } } const deleteTeamMutation = trpc.useMutation("viewer.teams.delete", { async onSuccess() { await utils.invalidateQueries(["viewer.teams.list"]); }, async onError(err) { showToast(err.message, "error"); }, }); function deleteTeam(teamId: number) { deleteTeamMutation.mutate({ teamId }); } return (