import React from 'react'; import PropTypes from 'prop-types'; import moment from 'moment'; import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap'; import { gettext, siteRoot, serviceURL } from '../../utils/constants'; import { Utils } from '../../utils/utils'; const propTypes = { activity: PropTypes.object.isRequired, toggleCancel: PropTypes.func.isRequired, }; class ListCreatedFileDialog extends React.Component { toggle = (activity) => { this.props.toggleCancel(activity); } render() { let activity = this.props.activity; return ( {gettext('Created Files')} { activity.createdFilesList.map((item, index) => { let fileURL = `${siteRoot}lib/${item.repo_id}/file${Utils.encodePath(item.path)}`; if (item.name.endsWith('(draft).md')) { fileURL = serviceURL + '/drafts/' + item.draft_id + '/'; } let fileLink = {item.name}; if (item.name.endsWith('(draft).md') && !item.draft_id) { fileLink = item.name; } return ( ); }) }
{gettext('Name')} {gettext('Time')}
{fileLink} {moment(item.time).fromNow()}
); } } ListCreatedFileDialog.propTypes = propTypes; export default ListCreatedFileDialog;