import React, { Component, Fragment } from 'react'; import { Dropdown, DropdownToggle, DropdownItem } from 'reactstrap'; import PropTypes from 'prop-types'; import moment from 'moment'; import { gettext } from '../../utils/constants'; import { Utils } from '../../utils/utils'; import { seafileAPI } from '../../utils/seafile-api'; import InvitationsToolbar from '../../components/toolbar/invitations-toolbar'; import InvitePeopleDialog from '../../components/dialog/invite-people-dialog'; import InvitationRevokeDialog from '../../components/dialog/invitation-revoke-dialog'; import Loading from '../../components/loading'; import toaster from '../../components/toast'; import EmptyTip from '../../components/empty-tip'; import '../../css/invitations.css'; class Item extends React.Component { constructor(props) { super(props); this.state = { isOpIconShown: false, isOpMenuOpen: false, // for mobile isRevokeDialogOpen: false }; } toggleOpMenu = () => { this.setState({ isOpMenuOpen: !this.state.isOpMenuOpen }); } onMouseEnter = () => { this.setState({ isOpIconShown: true }); } onMouseLeave = () => { this.setState({ isOpIconShown: false }); } deleteItem = () => { // make the icon avoid being clicked repeatedly this.setState({ isOpIconShown: false }); const token = this.props.invitation.token; seafileAPI.deleteInvitation(token).then((res) => { this.setState({deleted: true}); toaster.success(gettext('Successfully deleted 1 item.')); }).catch((error) => { const errorMsg = Utils.getErrorMsg(error); toaster.danger(errorMsg); this.setState({ isOpIconShown: true }); }); } revokeItem = () => { this.setState({deleted: true}); } toggleRevokeDialog = () => { this.setState({ isRevokeDialogOpen: !this.state.isRevokeDialogOpen }); } render() { const { isOpIconShown, deleted, isRevokeDialogOpen } = this.state; if (deleted) { return null; } const item = this.props.invitation; const desktopItem = (
{errorMsg}
; } if (!invitationsList.length) { return ({gettext('You have not invited any guests yet. A guest can access shared libraries through the web interface allowing more efficient ways to collaborate than through links. You can invite a guest by clicking the "Invite Guest" button in the menu bar.')}
{gettext('Email')} | {gettext('Invite Time')} | {gettext('Expiration')} | {gettext('Accepted')} | |
---|---|---|---|---|