diff -r 000000000000 -r 5f4fcbc80b37 clientjs/packages/dashboard-components/src/ui/Annotation.jsx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientjs/packages/dashboard-components/src/ui/Annotation.jsx Fri Sep 14 17:57:34 2018 +0200 @@ -0,0 +1,91 @@ +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { FormattedRelative } from 'react-intl'; +import ReactMarkdown from 'react-markdown'; + +import Tag from './Tag'; +import AnnotationQuote from './AnnotationQuote'; + +export default class Annotation extends Component { + user() { + const { annotation } = this.props; + + const [userName, instanceName] = annotation.user.replace('acct:', '').split('@'); + + return ( + + { userName } + {`@${instanceName}`} + + ); + } + + tags() { + const { annotation, metacategories, categories } = this.props; + + const tagMetacategories = []; + const others = []; + + annotation.tags.forEach((tagStr) => { + if (tagStr.startsWith('cat:')) { + tagMetacategories.push(tagStr); + } else { + others.push(tagStr); + } + }); + + /* eslint-disable max-len */ + return ( +
+ { tagMetacategories.map(tag => ) } + { others.map(tag => ) } +
+ ); + /* eslint-enable max-len */ + } + + render() { + const { annotation, metacategories } = this.props; + + const dateUpdated = ( + + ); + + let body = ''; + + if (annotation.text || annotation.text !== '') { + body = ( +
+ +
+ ); + } + + return ( +
+
+ { annotation.document.title } +
+ +
+ ); + } +} + +Annotation.propTypes = { + annotation: PropTypes.isRequired, + metacategories: PropTypes.isRequired, + categories: PropTypes.isRequired, +};