Cal 262 refactor edit teams according to the design reference (#516)
* refactored settings/team landing page
* changed team edit flow, WIP
* merge conflict fix for teams.tsx
* minor fixes to edit team, WIP
* invite-member and disband team APIs attached inside edit-team page
* added remove-member API in edit-team page, minor fixes
* minor code fix, WIP
* WIP
* add logo, bio, branding to team schema
* bio, logo, branding, slug patch API and minor code fix-- WIP
* fn to Disband team directly from the dropdown menu in settings/teams page, removed debug remnants --WIP
* Pull latest data after an action in settings/teams-edit page
* added slug conflict check at Patch time
* code clean-up
* initial change request fixes --WIP
* prop type fix and add warn button color theme --WIP
* added warn Button to Dialog
* remaining change request fixes
* added noop from react-query
* updated invited team-list design
* prettier fix for api/teams/profile
* removed noop import and added custom noop
* minor Button fix
* requested changes addressed
2021-09-06 13:22:22 +00:00
|
|
|
import Link from "next/link";
|
2022-11-10 20:23:56 +00:00
|
|
|
import { useRouter } from "next/router";
|
2023-01-21 15:32:00 +00:00
|
|
|
import { useState } from "react";
|
2021-09-22 19:52:38 +00:00
|
|
|
|
2023-06-06 23:34:14 +00:00
|
|
|
import InviteLinkSettingsModal from "@calcom/ee/teams/components/InviteLinkSettingsModal";
|
2023-01-21 15:32:00 +00:00
|
|
|
import MemberInvitationModal from "@calcom/ee/teams/components/MemberInvitationModal";
|
2023-06-15 16:55:45 +00:00
|
|
|
import { useOrgBrandingValues } from "@calcom/features/ee/organizations/hooks";
|
2022-07-28 19:58:26 +00:00
|
|
|
import classNames from "@calcom/lib/classNames";
|
2023-03-10 22:10:56 +00:00
|
|
|
import { getPlaceholderAvatar } from "@calcom/lib/defaultAvatarImage";
|
2022-03-16 23:36:43 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2023-05-02 11:44:05 +00:00
|
|
|
import { MembershipRole } from "@calcom/prisma/enums";
|
2023-03-10 22:10:56 +00:00
|
|
|
import type { RouterOutputs } from "@calcom/trpc/react";
|
|
|
|
import { trpc } from "@calcom/trpc/react";
|
2022-11-23 02:55:25 +00:00
|
|
|
import {
|
|
|
|
Avatar,
|
|
|
|
Button,
|
|
|
|
ButtonGroup,
|
|
|
|
ConfirmationDialogContent,
|
|
|
|
Dialog,
|
|
|
|
DialogTrigger,
|
|
|
|
Dropdown,
|
2022-11-10 20:23:56 +00:00
|
|
|
DropdownItem,
|
2022-03-16 19:55:18 +00:00
|
|
|
DropdownMenuContent,
|
|
|
|
DropdownMenuItem,
|
|
|
|
DropdownMenuSeparator,
|
2022-05-14 18:47:23 +00:00
|
|
|
DropdownMenuTrigger,
|
2022-11-23 02:55:25 +00:00
|
|
|
showToast,
|
|
|
|
Tooltip,
|
|
|
|
} from "@calcom/ui";
|
2023-01-23 23:08:01 +00:00
|
|
|
import {
|
2023-04-12 15:26:31 +00:00
|
|
|
Check,
|
|
|
|
Edit2,
|
|
|
|
ExternalLink,
|
|
|
|
Globe,
|
2023-06-06 23:34:14 +00:00
|
|
|
Link as LinkIcon,
|
|
|
|
LogOut,
|
|
|
|
MoreHorizontal,
|
2023-04-12 15:26:31 +00:00
|
|
|
Send,
|
2023-06-06 23:34:14 +00:00
|
|
|
Trash,
|
|
|
|
X,
|
2023-01-23 23:08:01 +00:00
|
|
|
} from "@calcom/ui/components/icon";
|
2022-03-16 19:55:18 +00:00
|
|
|
|
2022-02-07 23:35:26 +00:00
|
|
|
import { TeamRole } from "./TeamPill";
|
2021-06-05 22:53:33 +00:00
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
interface Props {
|
2022-11-10 23:40:01 +00:00
|
|
|
team: RouterOutputs["viewer"]["teams"]["list"][number];
|
Cal 262 refactor edit teams according to the design reference (#516)
* refactored settings/team landing page
* changed team edit flow, WIP
* merge conflict fix for teams.tsx
* minor fixes to edit team, WIP
* invite-member and disband team APIs attached inside edit-team page
* added remove-member API in edit-team page, minor fixes
* minor code fix, WIP
* WIP
* add logo, bio, branding to team schema
* bio, logo, branding, slug patch API and minor code fix-- WIP
* fn to Disband team directly from the dropdown menu in settings/teams page, removed debug remnants --WIP
* Pull latest data after an action in settings/teams-edit page
* added slug conflict check at Patch time
* code clean-up
* initial change request fixes --WIP
* prop type fix and add warn button color theme --WIP
* added warn Button to Dialog
* remaining change request fixes
* added noop from react-query
* updated invited team-list design
* prettier fix for api/teams/profile
* removed noop import and added custom noop
* minor Button fix
* requested changes addressed
2021-09-06 13:22:22 +00:00
|
|
|
key: number;
|
|
|
|
onActionSelect: (text: string) => void;
|
2022-05-14 18:47:23 +00:00
|
|
|
isLoading?: boolean;
|
2022-07-31 19:48:17 +00:00
|
|
|
hideDropdown: boolean;
|
|
|
|
setHideDropdown: (value: boolean) => void;
|
2021-12-09 23:51:30 +00:00
|
|
|
}
|
2021-06-05 22:53:33 +00:00
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
export default function TeamListItem(props: Props) {
|
2023-01-21 15:32:00 +00:00
|
|
|
const { t, i18n } = useLocale();
|
2023-06-06 23:34:14 +00:00
|
|
|
|
|
|
|
const router = useRouter();
|
2021-12-09 23:51:30 +00:00
|
|
|
const utils = trpc.useContext();
|
|
|
|
const team = props.team;
|
2023-06-06 23:34:14 +00:00
|
|
|
|
2023-05-24 01:01:31 +00:00
|
|
|
const showDialog = router.query.inviteModal === "true";
|
|
|
|
const [openMemberInvitationModal, setOpenMemberInvitationModal] = useState(showDialog);
|
2023-06-06 23:34:14 +00:00
|
|
|
const [openInviteLinkSettingsModal, setOpenInviteLinkSettingsModal] = useState(false);
|
|
|
|
|
2023-01-21 15:32:00 +00:00
|
|
|
const teamQuery = trpc.viewer.teams.get.useQuery({ teamId: team?.id });
|
2023-06-16 12:45:20 +00:00
|
|
|
const inviteMemberMutation = trpc.viewer.teams.inviteMember.useMutation();
|
2021-06-05 22:53:33 +00:00
|
|
|
|
2022-11-10 23:40:01 +00:00
|
|
|
const acceptOrLeaveMutation = trpc.viewer.teams.acceptOrLeave.useMutation({
|
2021-12-09 23:51:30 +00:00
|
|
|
onSuccess: () => {
|
2022-11-10 23:40:01 +00:00
|
|
|
utils.viewer.teams.list.invalidate();
|
2023-01-24 15:27:05 +00:00
|
|
|
utils.viewer.teams.listInvites.invalidate();
|
2021-12-09 23:51:30 +00:00
|
|
|
},
|
|
|
|
});
|
2022-07-31 19:48:17 +00:00
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
function acceptOrLeave(accept: boolean) {
|
|
|
|
acceptOrLeaveMutation.mutate({
|
|
|
|
teamId: team?.id as number,
|
|
|
|
accept,
|
2021-08-02 20:51:57 +00:00
|
|
|
});
|
2021-12-09 23:51:30 +00:00
|
|
|
}
|
2022-07-31 19:48:17 +00:00
|
|
|
|
2021-12-09 23:51:30 +00:00
|
|
|
const acceptInvite = () => acceptOrLeave(true);
|
|
|
|
const declineInvite = () => acceptOrLeave(false);
|
2023-06-15 16:55:45 +00:00
|
|
|
const orgBranding = useOrgBrandingValues();
|
2021-12-09 23:51:30 +00:00
|
|
|
|
|
|
|
const isOwner = props.team.role === MembershipRole.OWNER;
|
|
|
|
const isInvitee = !props.team.accepted;
|
|
|
|
const isAdmin = props.team.role === MembershipRole.OWNER || props.team.role === MembershipRole.ADMIN;
|
2022-07-31 19:48:17 +00:00
|
|
|
const { hideDropdown, setHideDropdown } = props;
|
2021-12-09 23:51:30 +00:00
|
|
|
|
|
|
|
if (!team) return <></>;
|
|
|
|
|
|
|
|
const teamInfo = (
|
2023-01-24 15:27:05 +00:00
|
|
|
<div className="item-center flex px-5 py-5">
|
2021-12-09 23:51:30 +00:00
|
|
|
<Avatar
|
2023-01-24 15:27:05 +00:00
|
|
|
size="md"
|
2021-12-09 23:51:30 +00:00
|
|
|
imageSrc={getPlaceholderAvatar(team?.logo, team?.name as string)}
|
|
|
|
alt="Team Logo"
|
2023-01-24 15:27:05 +00:00
|
|
|
className="inline-flex justify-center"
|
2021-12-09 23:51:30 +00:00
|
|
|
/>
|
2023-04-19 20:17:54 +00:00
|
|
|
<div className="ms-3 inline-block truncate">
|
2023-04-05 18:14:46 +00:00
|
|
|
<span className="text-default text-sm font-bold">{team.name}</span>
|
|
|
|
<span className="text-muted block text-xs">
|
2023-06-15 16:55:45 +00:00
|
|
|
{team.slug
|
|
|
|
? orgBranding
|
2023-07-03 08:06:12 +00:00
|
|
|
? `${orgBranding.fullDomain}${team.slug}`
|
2023-06-15 16:55:45 +00:00
|
|
|
: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/${team.slug}`
|
|
|
|
: "Unpublished team"}
|
2021-12-09 23:51:30 +00:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2021-06-05 22:53:33 +00:00
|
|
|
|
2021-08-02 20:51:57 +00:00
|
|
|
return (
|
2023-01-24 15:27:05 +00:00
|
|
|
<li className="">
|
2023-01-21 15:32:00 +00:00
|
|
|
<MemberInvitationModal
|
|
|
|
isOpen={openMemberInvitationModal}
|
2023-06-06 23:34:14 +00:00
|
|
|
teamId={team.id}
|
|
|
|
token={team.inviteToken?.token}
|
2023-01-21 15:32:00 +00:00
|
|
|
onExit={() => {
|
|
|
|
setOpenMemberInvitationModal(false);
|
|
|
|
}}
|
2023-07-06 09:33:31 +00:00
|
|
|
isLoading={inviteMemberMutation.isLoading}
|
2023-06-16 12:45:20 +00:00
|
|
|
onSubmit={(values, resetFields) => {
|
|
|
|
inviteMemberMutation.mutate(
|
|
|
|
{
|
|
|
|
teamId: team.id,
|
|
|
|
language: i18n.language,
|
|
|
|
role: values.role,
|
|
|
|
usernameOrEmail: values.emailOrUsername,
|
|
|
|
sendEmailInvitation: values.sendInviteEmail,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
onSuccess: async (data) => {
|
|
|
|
await utils.viewer.teams.get.invalidate();
|
|
|
|
setOpenMemberInvitationModal(false);
|
|
|
|
if (data.sendEmailInvitation) {
|
|
|
|
if (Array.isArray(data.usernameOrEmail)) {
|
|
|
|
showToast(
|
|
|
|
t("email_invite_team_bulk", {
|
|
|
|
userCount: data.usernameOrEmail.length,
|
|
|
|
}),
|
|
|
|
"success"
|
|
|
|
);
|
|
|
|
resetFields();
|
|
|
|
} else {
|
|
|
|
showToast(
|
|
|
|
t("email_invite_team", {
|
|
|
|
email: data.usernameOrEmail,
|
|
|
|
}),
|
|
|
|
"success"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onError: (error) => {
|
|
|
|
showToast(error.message, "error");
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
2023-01-21 15:32:00 +00:00
|
|
|
}}
|
2023-06-06 23:34:14 +00:00
|
|
|
onSettingsOpen={() => {
|
|
|
|
setOpenMemberInvitationModal(false);
|
|
|
|
setOpenInviteLinkSettingsModal(true);
|
|
|
|
}}
|
2023-01-21 15:32:00 +00:00
|
|
|
members={teamQuery?.data?.members || []}
|
|
|
|
/>
|
2023-06-06 23:34:14 +00:00
|
|
|
{team.inviteToken && (
|
|
|
|
<InviteLinkSettingsModal
|
|
|
|
isOpen={openInviteLinkSettingsModal}
|
|
|
|
teamId={team.id}
|
|
|
|
token={team.inviteToken?.token}
|
|
|
|
expiresInDays={team.inviteToken?.expiresInDays || undefined}
|
|
|
|
onExit={() => {
|
|
|
|
setOpenInviteLinkSettingsModal(false);
|
|
|
|
setOpenMemberInvitationModal(true);
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
2023-04-05 18:14:46 +00:00
|
|
|
<div className={classNames("flex items-center justify-between", !isInvitee && "hover:bg-muted group")}>
|
2021-12-09 23:51:30 +00:00
|
|
|
{!isInvitee ? (
|
2023-01-06 12:13:56 +00:00
|
|
|
<Link
|
|
|
|
href={"/settings/teams/" + team.id + "/profile"}
|
|
|
|
className="flex-grow cursor-pointer truncate text-sm"
|
|
|
|
title={`${team.name}`}>
|
|
|
|
{teamInfo}
|
2021-12-09 23:51:30 +00:00
|
|
|
</Link>
|
|
|
|
) : (
|
|
|
|
teamInfo
|
|
|
|
)}
|
|
|
|
<div className="px-5 py-5">
|
2022-11-10 20:23:56 +00:00
|
|
|
{isInvitee ? (
|
2021-12-09 23:51:30 +00:00
|
|
|
<>
|
2023-01-24 15:27:05 +00:00
|
|
|
<div className="hidden justify-center sm:flex">
|
2022-07-01 18:29:59 +00:00
|
|
|
<Button type="button" color="secondary" onClick={declineInvite}>
|
|
|
|
{t("reject")}
|
|
|
|
</Button>
|
2023-01-04 07:38:45 +00:00
|
|
|
<Button
|
|
|
|
type="button"
|
2023-01-24 15:27:05 +00:00
|
|
|
color="secondary"
|
2023-04-13 02:10:23 +00:00
|
|
|
data-testid={`accept-invitation-${team.id}`}
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={Check}
|
2023-06-22 22:25:37 +00:00
|
|
|
className="me-2 ms-2"
|
2023-01-04 07:38:45 +00:00
|
|
|
onClick={acceptInvite}>
|
2022-07-01 18:29:59 +00:00
|
|
|
{t("accept")}
|
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
<div className="block sm:hidden">
|
|
|
|
<Dropdown>
|
2022-07-27 02:24:00 +00:00
|
|
|
<DropdownMenuTrigger asChild>
|
2023-04-12 15:26:31 +00:00
|
|
|
<Button type="button" color="minimal" variant="icon" StartIcon={MoreHorizontal} />
|
2022-07-01 18:29:59 +00:00
|
|
|
</DropdownMenuTrigger>
|
|
|
|
<DropdownMenuContent>
|
|
|
|
<DropdownMenuItem>
|
2023-04-12 15:26:31 +00:00
|
|
|
<DropdownItem type="button" StartIcon={Check} onClick={acceptInvite}>
|
2022-07-01 18:29:59 +00:00
|
|
|
{t("accept")}
|
2023-01-15 11:40:40 +00:00
|
|
|
</DropdownItem>
|
2022-07-01 18:29:59 +00:00
|
|
|
</DropdownMenuItem>
|
|
|
|
<DropdownMenuItem>
|
2023-04-12 15:26:31 +00:00
|
|
|
<DropdownItem color="destructive" type="button" StartIcon={X} onClick={declineInvite}>
|
2022-07-01 18:29:59 +00:00
|
|
|
{t("reject")}
|
2023-01-15 11:40:40 +00:00
|
|
|
</DropdownItem>
|
2022-07-01 18:29:59 +00:00
|
|
|
</DropdownMenuItem>
|
|
|
|
</DropdownMenuContent>
|
|
|
|
</Dropdown>
|
|
|
|
</div>
|
2021-12-09 23:51:30 +00:00
|
|
|
</>
|
2022-11-10 20:23:56 +00:00
|
|
|
) : (
|
2022-07-27 02:24:00 +00:00
|
|
|
<div className="flex space-x-2 rtl:space-x-reverse">
|
2022-02-07 23:35:26 +00:00
|
|
|
<TeamRole role={team.role} />
|
2022-09-18 11:32:54 +00:00
|
|
|
<ButtonGroup combined>
|
2022-11-10 20:23:56 +00:00
|
|
|
{team.slug && (
|
|
|
|
<Tooltip content={t("copy_link_team")}>
|
|
|
|
<Button
|
|
|
|
color="secondary"
|
|
|
|
onClick={() => {
|
|
|
|
navigator.clipboard.writeText(
|
2023-07-03 08:06:12 +00:00
|
|
|
`${
|
|
|
|
orgBranding
|
|
|
|
? `${orgBranding.fullDomain}`
|
|
|
|
: process.env.NEXT_PUBLIC_WEBSITE_URL + "/team/"
|
|
|
|
}${team.slug}`
|
2022-11-10 20:23:56 +00:00
|
|
|
);
|
|
|
|
showToast(t("link_copied"), "success");
|
|
|
|
}}
|
2023-01-19 14:55:32 +00:00
|
|
|
variant="icon"
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={LinkIcon}
|
2022-11-10 20:23:56 +00:00
|
|
|
/>
|
|
|
|
</Tooltip>
|
|
|
|
)}
|
2022-09-18 11:32:54 +00:00
|
|
|
<Dropdown>
|
2023-01-22 00:03:59 +00:00
|
|
|
<DropdownMenuTrigger asChild>
|
2023-01-19 14:55:32 +00:00
|
|
|
<Button
|
2023-01-22 00:03:59 +00:00
|
|
|
className="radix-state-open:rounded-r-md"
|
2023-01-19 14:55:32 +00:00
|
|
|
type="button"
|
|
|
|
color="secondary"
|
|
|
|
variant="icon"
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={MoreHorizontal}
|
2023-01-19 14:55:32 +00:00
|
|
|
/>
|
2022-09-18 11:32:54 +00:00
|
|
|
</DropdownMenuTrigger>
|
|
|
|
<DropdownMenuContent hidden={hideDropdown}>
|
|
|
|
{isAdmin && (
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
|
|
|
href={"/settings/teams/" + team.id + "/profile"}
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={Edit2}>
|
2022-09-18 11:32:54 +00:00
|
|
|
{t("edit_team") as string}
|
|
|
|
</DropdownItem>
|
|
|
|
</DropdownMenuItem>
|
|
|
|
)}
|
2022-11-10 20:23:56 +00:00
|
|
|
{!team.slug && <TeamPublishButton teamId={team.id} />}
|
|
|
|
{team.slug && (
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
|
|
|
target="_blank"
|
2023-07-03 08:06:12 +00:00
|
|
|
href={`${
|
|
|
|
orgBranding
|
|
|
|
? `${orgBranding.fullDomain}`
|
|
|
|
: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/team/`
|
|
|
|
}${team.slug}`}
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={ExternalLink}>
|
2022-11-10 20:23:56 +00:00
|
|
|
{t("preview_team") as string}
|
|
|
|
</DropdownItem>
|
|
|
|
</DropdownMenuItem>
|
|
|
|
)}
|
2023-07-07 13:34:57 +00:00
|
|
|
{isAdmin && (
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
|
|
|
onClick={() => {
|
|
|
|
setOpenMemberInvitationModal(true);
|
|
|
|
}}
|
|
|
|
StartIcon={Send}>
|
|
|
|
{t("invite_team_member") as string}
|
|
|
|
</DropdownItem>
|
|
|
|
</DropdownMenuItem>
|
|
|
|
)}
|
2023-01-15 11:40:40 +00:00
|
|
|
<DropdownMenuSeparator />
|
2022-09-18 11:32:54 +00:00
|
|
|
{isOwner && (
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<Dialog open={hideDropdown} onOpenChange={setHideDropdown}>
|
|
|
|
<DialogTrigger asChild>
|
2023-01-15 11:40:40 +00:00
|
|
|
<DropdownItem
|
|
|
|
color="destructive"
|
|
|
|
type="button"
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={Trash}
|
2022-09-18 11:32:54 +00:00
|
|
|
onClick={(e) => {
|
|
|
|
e.stopPropagation();
|
2023-01-15 11:40:40 +00:00
|
|
|
}}>
|
2022-09-18 11:32:54 +00:00
|
|
|
{t("disband_team")}
|
2023-01-15 11:40:40 +00:00
|
|
|
</DropdownItem>
|
2022-09-18 11:32:54 +00:00
|
|
|
</DialogTrigger>
|
|
|
|
<ConfirmationDialogContent
|
|
|
|
variety="danger"
|
|
|
|
title={t("disband_team")}
|
|
|
|
confirmBtnText={t("confirm_disband_team")}
|
|
|
|
isLoading={props.isLoading}
|
|
|
|
onConfirm={() => {
|
|
|
|
props.onActionSelect("disband");
|
2021-12-09 23:51:30 +00:00
|
|
|
}}>
|
2022-09-18 11:32:54 +00:00
|
|
|
{t("disband_team_confirmation_message")}
|
|
|
|
</ConfirmationDialogContent>
|
|
|
|
</Dialog>
|
|
|
|
</DropdownMenuItem>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{!isOwner && (
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<Dialog>
|
|
|
|
<DialogTrigger asChild>
|
2023-04-02 10:03:40 +00:00
|
|
|
<DropdownItem
|
2022-09-18 11:32:54 +00:00
|
|
|
color="destructive"
|
2023-04-02 10:03:40 +00:00
|
|
|
type="button"
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={LogOut}
|
2022-09-18 11:32:54 +00:00
|
|
|
onClick={(e) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
}}>
|
|
|
|
{t("leave_team")}
|
2023-04-02 10:03:40 +00:00
|
|
|
</DropdownItem>
|
2022-09-18 11:32:54 +00:00
|
|
|
</DialogTrigger>
|
|
|
|
<ConfirmationDialogContent
|
|
|
|
variety="danger"
|
|
|
|
title={t("leave_team")}
|
|
|
|
confirmBtnText={t("confirm_leave_team")}
|
|
|
|
onConfirm={declineInvite}>
|
|
|
|
{t("leave_team_confirmation_message")}
|
|
|
|
</ConfirmationDialogContent>
|
|
|
|
</Dialog>
|
|
|
|
</DropdownMenuItem>
|
|
|
|
)}
|
|
|
|
</DropdownMenuContent>
|
|
|
|
</Dropdown>
|
|
|
|
</ButtonGroup>
|
2021-08-02 20:51:57 +00:00
|
|
|
</div>
|
|
|
|
)}
|
2021-06-05 22:53:33 +00:00
|
|
|
</div>
|
2021-12-09 23:51:30 +00:00
|
|
|
</div>
|
|
|
|
</li>
|
2021-08-02 20:51:57 +00:00
|
|
|
);
|
2021-07-30 23:05:38 +00:00
|
|
|
}
|
2022-11-10 20:23:56 +00:00
|
|
|
|
|
|
|
const TeamPublishButton = ({ teamId }: { teamId: number }) => {
|
|
|
|
const { t } = useLocale();
|
|
|
|
const router = useRouter();
|
2022-11-10 23:40:01 +00:00
|
|
|
const publishTeamMutation = trpc.viewer.teams.publish.useMutation({
|
2022-11-10 20:23:56 +00:00
|
|
|
onSuccess(data) {
|
|
|
|
router.push(data.url);
|
|
|
|
},
|
|
|
|
onError: (error) => {
|
|
|
|
showToast(error.message, "error");
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<DropdownMenuItem>
|
|
|
|
<DropdownItem
|
|
|
|
type="button"
|
|
|
|
onClick={() => {
|
|
|
|
publishTeamMutation.mutate({ teamId });
|
|
|
|
}}
|
2023-04-12 15:26:31 +00:00
|
|
|
StartIcon={Globe}>
|
2022-11-10 20:23:56 +00:00
|
|
|
{t("team_publish")}
|
|
|
|
</DropdownItem>
|
|
|
|
</DropdownMenuItem>
|
|
|
|
);
|
|
|
|
};
|