import React from 'react'; import PropTypes from 'prop-types'; import { withTranslation } from 'react-i18next'; import { withUnstatedContainers } from './UnstatedUtils'; import PageContainer from '../services/PageContainer'; import { convertToNewAffiliationPath } from '../../../lib/util/path-utils'; function DuplicatedPathsTable(props) { const { pageContainer, oldPagePath, existingPaths, t, } = props; const { path } = pageContainer.state; return ( {existingPaths.map((existPath) => { const convertedPath = convertToNewAffiliationPath(oldPagePath, path, existPath); return ( ); })}
{t('original_path')} {t('duplicated_path')}
{convertedPath} {existPath}
); } /** * Wrapper component for using unstated */ const PageDuplicateModallWrapper = withUnstatedContainers(DuplicatedPathsTable, [PageContainer]); DuplicatedPathsTable.propTypes = { t: PropTypes.func.isRequired, // i18next pageContainer: PropTypes.instanceOf(PageContainer).isRequired, existingPaths: PropTypes.array.isRequired, oldPagePath: PropTypes.string.isRequired, }; export default withTranslation()(PageDuplicateModallWrapper);