import { TrashIcon, DotsHorizontalIcon, LinkIcon, PencilAltIcon, ExternalLinkIcon, } from "@heroicons/react/outline"; import Dropdown, { DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/Dropdown"; import { useState } from "react"; import { Tooltip } from "@components/Tooltip"; import Link from "next/link"; import { Dialog, DialogTrigger } from "@components/Dialog"; import ConfirmationDialogContent from "@components/dialog/ConfirmationDialogContent"; import Avatar from "@components/ui/Avatar"; import Button from "@components/ui/Button"; import showToast from "@lib/notification"; interface Team { id: number; name: string | null; slug: string | null; logo: string | null; bio: string | null; role: string | null; hideBranding: boolean; prevState: null; } export default function TeamListItem(props: { onChange: () => void; key: number; team: Team; onActionSelect: (text: string) => void; }) { const [team, setTeam] = useState(props.team); const acceptInvite = () => invitationResponse(true); const declineInvite = () => invitationResponse(false); const invitationResponse = (accept: boolean) => fetch("/api/user/membership", { method: accept ? "PATCH" : "DELETE", body: JSON.stringify({ teamId: props.team.id }), headers: { "Content-Type": "application/json", }, }).then(() => { // success setTeam(null); props.onChange(); }); return ( team && (
  • {props.team.name} {window.location.hostname}/{props.team.slug}
    {props.team.role === "INVITEE" && (
    )} {props.team.role === "MEMBER" && (
    )} {props.team.role === "OWNER" && (
    Owner props.onActionSelect("disband")}> Are you sure you want to disband this team? Anyone who you've shared this team link with will no longer be able to book using it.
    )}
  • ) ); }