* add team profile * first version for team members page * finish up design of member list item * fix dialog buttons * add missing seats and upgrading information * add v2 dialog for changing role * finish basic version of member's schedule * remove modalContainer * design fixes team profile page * show only team info to non admins * allow all member to check availabilities * make time available heading sticky * add dropdown for mobile view * create team appearance view * finish appearance page * use settings layout and add danger zone for member * add fallback logo * Add teams to sidebar and fix UI * add team invitations * Clean up * code clean up * add impersontation and disable autofocus on calendar * improve team info * refactor teaminvitelist code and fix leaving a team * add team pages to settings shell * add link to create new team * small fixes * clean up comments * V2 Multi-select (Team Select) (#4324) * --init * design improved * further fine tuning * more fixes * removed extra JSX tag * added story * NIT * revert to use of CheckedTeamSelect * Removes comments Co-authored-by: Peer Richelsen <[email protected]> * fix: toggle alligment (#4361) * fix: add checked tranform for switch (#4357) * fixed input size on mobile, fixed settings (#4360) * fix image uploader button in safari * code clean up * fixing type errors * Moved v2 team components to features Adds deprecation notices * Update SettingsLayout.tsx * Migrated to features and build fixes Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: Syed Ali Shahbaz <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> Co-authored-by: zomars <[email protected]>
65 lines
1.6 KiB
TypeScript
65 lines
1.6 KiB
TypeScript
import { useState } from "react";
|
|
|
|
import { MembershipRole } from "@calcom/prisma/client";
|
|
import { trpc } from "@calcom/trpc/react";
|
|
import { showToast } from "@calcom/ui/v2";
|
|
|
|
import TeamInviteListItem from "./TeamInviteListItem";
|
|
|
|
interface Props {
|
|
teams: {
|
|
id?: number;
|
|
name?: string | null;
|
|
slug?: string | null;
|
|
logo?: string | null;
|
|
bio?: string | null;
|
|
hideBranding?: boolean | undefined;
|
|
role: MembershipRole;
|
|
accepted: boolean;
|
|
}[];
|
|
}
|
|
|
|
export default function TeamInviteList(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 (
|
|
<div>
|
|
<ul className="mb-8 divide-y divide-neutral-200 rounded bg-white">
|
|
{props.teams.map((team) => (
|
|
<TeamInviteListItem
|
|
key={team?.id as number}
|
|
team={team}
|
|
onActionSelect={(action: string) => selectAction(action, team?.id as number)}
|
|
isLoading={deleteTeamMutation.isLoading}
|
|
hideDropdown={hideDropdown}
|
|
setHideDropdown={setHideDropdown}
|
|
/>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
);
|
|
}
|