import React from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; import { createSubscribedElement } from '../UnstatedUtils'; import AppContainer from '../../services/AppContainer'; import PageContainer from '../../services/PageContainer'; import UserPicture from '../User/UserPicture'; const TrashPageAlert = (props) => { const { t, appContainer, pageContainer } = props; const { path, isDeleted, revisionAuthor, updatedAt, hasChildren, isAbleToDeleteCompletely, } = pageContainer.state; const { currentUser } = appContainer; function renderEmptyButton() { return ( ); } function renderTrashPageManagementButtons() { return ( <> ); } return (
This page is in the trash . {isDeleted &&
Deleted by {revisionAuthor.name} at {updatedAt}
}
{(currentUser.admin && path === '/trash' && hasChildren) && renderEmptyButton()} {(isDeleted && currentUser != null) && renderTrashPageManagementButtons()}
); }; /** * Wrapper component for using unstated */ const TrashPageAlertWrapper = (props) => { return createSubscribedElement(TrashPageAlert, props, [AppContainer, PageContainer]); }; TrashPageAlert.propTypes = { t: PropTypes.func.isRequired, // i18next appContainer: PropTypes.instanceOf(AppContainer).isRequired, pageContainer: PropTypes.instanceOf(PageContainer).isRequired, }; export default withTranslation()(TrashPageAlertWrapper);