import React from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { Table, Alert, Button } from 'react-bootstrap'; import { timeago, monthDayYearAtTime } from '@cleverbeagle/dates'; import { Meteor } from 'meteor/meteor'; import { createContainer } from 'meteor/react-meteor-data'; import { Bert } from 'meteor/themeteorchef:bert'; import DocumentsCollection from '../../../api/Documents/Documents'; import './Documents.scss'; const handleRemove = (documentId) => { if (confirm('Are you sure? This is permanent!')) { Meteor.call('documents.remove', documentId, (error) => { if (error) { Bert.alert(error.reason, 'danger'); } else { Bert.alert('Document deleted!', 'success'); } }); } }; const Documents = ({ documents, match, history }) => (

Documents

Add Document
{documents.length ? {documents.map(({ _id, title, createdAt, updatedAt }) => ( ))}
Title Last Updated Created
{title} {timeago(updatedAt)} {monthDayYearAtTime(createdAt)}
: No documents yet!}
); Documents.propTypes = { documents: PropTypes.arrayOf(PropTypes.object).isRequired, match: PropTypes.object.isRequired, history: PropTypes.object.isRequired, }; export default createContainer(() => { const subscription = Meteor.subscribe('documents'); return { loading: !subscription.ready(), documents: DocumentsCollection.find().fetch(), }; }, Documents);