diff -r 000000000000 -r 5f4fcbc80b37 clientjs/packages/dashboard-components/src/ui/DocumentAnnotation.jsx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientjs/packages/dashboard-components/src/ui/DocumentAnnotation.jsx Fri Sep 14 17:57:34 2018 +0200 @@ -0,0 +1,67 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { FormattedRelative } from 'react-intl'; +import ReactMarkdown from 'react-markdown'; + +import AnnotationQuote from './AnnotationQuote'; +import Tag from './Tag'; + +import './DocumentAnnotation.scss'; + +const User = ({ annotation }) => { + const [userName, instanceName] = annotation.user.replace('acct:', '').split('@'); + return ( + + { userName } + {`@${instanceName}`} + + ); +}; + +User.propTypes = { + annotation: PropTypes.object.isRequired, +}; + +const TagList = ({ annotation, metacategories, categories }) => annotation.tags.map( + tag => , +); + +TagList.propTypes = { + annotation: PropTypes.object.isRequired, + metacategories: PropTypes.arrayOf(PropTypes.object).isRequired, + categories: PropTypes.arrayOf(PropTypes.string).isRequired, +}; + + +const DocumentAnnotation = ({ annotation, metacategories, categories }) => ( +
  • + + + +
    + + {' - '} + + {' '} + # +
    + + { (annotation.text || annotation.text !== '') && ( +
    + +
    + )} + +
    + +
    +
  • +); + +DocumentAnnotation.propTypes = { + annotation: PropTypes.object.isRequired, + metacategories: PropTypes.arrayOf(PropTypes.object).isRequired, + categories: PropTypes.arrayOf(PropTypes.string).isRequired, +}; + +export default DocumentAnnotation;