diff --git a/apps/web/components/team/TeamList.tsx b/apps/web/components/team/TeamList.tsx
index fdb9466f72..a38edfb4f6 100644
--- a/apps/web/components/team/TeamList.tsx
+++ b/apps/web/components/team/TeamList.tsx
@@ -1,3 +1,5 @@
+import { useState } from "react";
+
import showToast from "@calcom/lib/notification";
import { inferQueryOutput, trpc } from "@calcom/trpc/react";
@@ -10,6 +12,8 @@ interface Props {
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":
@@ -40,6 +44,8 @@ export default function TeamList(props: Props) {
team={team}
onActionSelect={(action: string) => selectAction(action, team?.id as number)}
isLoading={deleteTeamMutation.isLoading}
+ hideDropdown={hideDropdown}
+ setHideDropdown={setHideDropdown}
/>
))}
diff --git a/apps/web/components/team/TeamListItem.tsx b/apps/web/components/team/TeamListItem.tsx
index ec5bd393d2..6187abdbe5 100644
--- a/apps/web/components/team/TeamListItem.tsx
+++ b/apps/web/components/team/TeamListItem.tsx
@@ -27,6 +27,8 @@ interface Props {
key: number;
onActionSelect: (text: string) => void;
isLoading?: boolean;
+ hideDropdown: boolean;
+ setHideDropdown: (value: boolean) => void;
}
export default function TeamListItem(props: Props) {
@@ -39,18 +41,21 @@ export default function TeamListItem(props: Props) {
utils.invalidateQueries(["viewer.teams.list"]);
},
});
+
function acceptOrLeave(accept: boolean) {
acceptOrLeaveMutation.mutate({
teamId: team?.id as number,
accept,
});
}
+
const acceptInvite = () => acceptOrLeave(true);
const declineInvite = () => acceptOrLeave(false);
const isOwner = props.team.role === MembershipRole.OWNER;
const isInvitee = !props.team.accepted;
const isAdmin = props.team.role === MembershipRole.OWNER || props.team.role === MembershipRole.ADMIN;
+ const { hideDropdown, setHideDropdown } = props;
if (!team) return <>>;
@@ -150,7 +155,7 @@ export default function TeamListItem(props: Props) {
-
+
{isAdmin && (
@@ -182,7 +187,7 @@ export default function TeamListItem(props: Props) {
{isOwner && (
-