import React from 'react'; import { useTranslation } from 'react-i18next'; // import axios from 'axios'; import InviteLink from '../../common/InviteLink'; import Team from '../../icons/Team'; import { MyTeamProps } from '../../../model/components/profile'; // import CloseSmall from '../../icons/CloseSmall'; // import IconButton from '../../common/IconButton'; // import RoundedButton from '../../common/RoundedButton'; // import { CustomResponse } from '../../../model/common'; const MAX_TEAM_LENGTH = 10; // const MyTeam: React.FC = ({ user, team, onChangeTeam }) => { const MyTeam: React.FC = ({ user, team }) => { const { t } = useTranslation(); // const [userToDelete, setUserToDelete] = useState(null); // const [deletingUser, setDeletingUser] = useState(false); // const onDeleteUser = (userId: string): void => { // setDeletingUser(true); // setUserToDelete(userId); // }; // const onConfirmDelete = async (): Promise => { // await axios // .post>('/api/deleteUserFromTeam', { // userId: userToDelete, // }) // .then(({ data: { ok, data } }) => { // if (ok) { // const editedTeam = team; // editedTeam.users = team.users.filter( // (teamUser) => teamUser._id !== data, // ); // onChangeTeam(editedTeam); // } // setDeletingUser(false); // setUserToDelete(null); // }); // }; // const onCancelDelete = (): void => { // setDeletingUser(false); // setUserToDelete(null); // }; return team ? (

{t('YOUR_TEAM')}{' '} {`${team.users.length}/${MAX_TEAM_LENGTH}`}

{team.name}

    {team.users.map((teamUser) => { return teamUser._id === user._id ? (
  • {user.username}

  • ) : (
  • {teamUser.username}

    {/* onDeleteUser(teamUser._id)} isDisabled={deletingUser} > */}
    {/* {deletingUser && userToDelete === teamUser._id ? (

    {t('DELETE')}

    ) : null} */}
  • ); })} {Array.from({ length: MAX_TEAM_LENGTH - team.users.length }, (_, i) => (
  • ))}
) : (

{t('NO_TEAM')}

); }; export default MyTeam;