diff -r 000000000000 -r 5f4fcbc80b37 clientjs/packages/dashboard-components/src/pages/annotations.jsx --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clientjs/packages/dashboard-components/src/pages/annotations.jsx Fri Sep 14 17:57:34 2018 +0200 @@ -0,0 +1,48 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { connect } from 'react-redux'; + +import _ from 'lodash'; +import AnnotationsCards from '../ui/AnnotationsCards'; + +const AnnotationsPage = ({ + annotations, + viaBaseUrl, + metacategories, + topics, +}) => ( + +); + +AnnotationsPage.propTypes = { + // title: PropTypes.string, + annotations: PropTypes.array.isRequired, + viaBaseUrl: PropTypes.string.isRequired, + metacategories: PropTypes.arrayOf(PropTypes.object).isRequired, + topics: PropTypes.arrayOf(PropTypes.string).isRequired, +}; + +export default connect( + (state, props) => { + let annotations = state.annotations.items; + let tag = (props.match.params || {}).tagName; + if (tag) { + tag = tag.toLowerCase(); + annotations = _.filter( + annotations, + annot => _.find( + annot.tags, + t => t.toLowerCase() === tag, + ), + ); + } + return { + annotations, + }; + }, +)(AnnotationsPage);