diff --git a/localization/react-intl/src/app/components/search/AddFilterMenu.json b/localization/react-intl/src/app/components/search/AddFilterMenu.json index 7da23d3d46..0e7fb395d2 100644 --- a/localization/react-intl/src/app/components/search/AddFilterMenu.json +++ b/localization/react-intl/src/app/components/search/AddFilterMenu.json @@ -19,11 +19,6 @@ "description": "Menu option to enable searching items by channel", "defaultMessage": "Channel" }, - { - "id": "addFilterMenu.claim", - "description": "Menu option to enable searching items by claim", - "defaultMessage": "Claim" - }, { "id": "addFilterMenu.createdBy", "description": "Menu option to enable searching items by author", diff --git a/localization/react-intl/src/app/components/search/LanguageFilter.json b/localization/react-intl/src/app/components/search/LanguageFilter.json index f54a1c854d..e1794d209e 100644 --- a/localization/react-intl/src/app/components/search/LanguageFilter.json +++ b/localization/react-intl/src/app/components/search/LanguageFilter.json @@ -5,9 +5,9 @@ "defaultMessage": "Media language" }, { - "id": "search.reportLanguage", - "description": "Label for report language filter", - "defaultMessage": "Report language" + "id": "search.articleLanguage", + "description": "Label for article language filter", + "defaultMessage": "Article language" }, { "id": "search.requestLanguage", diff --git a/src/app/components/article/ArticleFilters.js b/src/app/components/article/ArticleFilters.js index 3d874210ab..43b79d4c6c 100644 --- a/src/app/components/article/ArticleFilters.js +++ b/src/app/components/article/ArticleFilters.js @@ -44,6 +44,8 @@ const ArticleFilters = ({ teamSlug, type, }) => { + console.log('currentFilters', currentFilters); // eslint-disable-line + const [filters, setFilters] = React.useState({ ...currentFilters }); const [typeFilter, setTypeFilter] = React.useState([type]); @@ -118,6 +120,11 @@ const ArticleFilters = ({ const value = filters[filter]; const connector = ((i === 0) ? null : filterConnector); + console.log('connector', connector); // eslint-disable-line + console.log('filter', filter); // eslint-disable-line + console.log('i', i); // eslint-disable-line + + if (filter === 'imported') { return ( diff --git a/src/app/components/article/Explainers.js b/src/app/components/article/Explainers.js index 7f571b0e81..b194198cea 100644 --- a/src/app/components/article/Explainers.js +++ b/src/app/components/article/Explainers.js @@ -1,4 +1,3 @@ -/* eslint-disable react/sort-prop-types */ import React from 'react'; import { graphql } from 'react-relay/compat'; import PropTypes from 'prop-types'; @@ -44,7 +43,7 @@ const Explainers = ({ intl, routeParams }) => { return ( } sortOptions={sortOptions} teamSlug={routeParams.team} @@ -58,10 +57,10 @@ const Explainers = ({ intl, routeParams }) => { Explainers.defaultProps = {}; Explainers.propTypes = { + intl: intlShape.isRequired, routeParams: PropTypes.shape({ team: PropTypes.string.isRequired, // slug }).isRequired, - intl: intlShape.isRequired, }; export default injectIntl(Explainers); diff --git a/src/app/components/article/FactChecks.js b/src/app/components/article/FactChecks.js index ac12e9adc1..ecd5f70c7b 100644 --- a/src/app/components/article/FactChecks.js +++ b/src/app/components/article/FactChecks.js @@ -1,4 +1,3 @@ -/* eslint-disable react/sort-prop-types */ import React from 'react'; import { graphql } from 'react-relay/compat'; import PropTypes from 'prop-types'; @@ -58,10 +57,10 @@ const FactChecks = ({ intl, routeParams }) => { FactChecks.defaultProps = {}; FactChecks.propTypes = { + intl: intlShape.isRequired, routeParams: PropTypes.shape({ team: PropTypes.string.isRequired, // slug }).isRequired, - intl: intlShape.isRequired, }; export default injectIntl(FactChecks); diff --git a/src/app/components/article/ImportedArticles.js b/src/app/components/article/ImportedArticles.js index 92ccd2a835..335a18805d 100644 --- a/src/app/components/article/ImportedArticles.js +++ b/src/app/components/article/ImportedArticles.js @@ -1,4 +1,3 @@ -/* eslint-disable react/sort-prop-types */ import React from 'react'; import { graphql } from 'react-relay/compat'; import PropTypes from 'prop-types'; @@ -45,7 +44,7 @@ const ImportedArticles = ({ intl, routeParams }) => { return ( } sortOptions={sortOptions} teamSlug={routeParams.team} @@ -59,10 +58,10 @@ const ImportedArticles = ({ intl, routeParams }) => { ImportedArticles.defaultProps = {}; ImportedArticles.propTypes = { + intl: intlShape.isRequired, routeParams: PropTypes.shape({ team: PropTypes.string.isRequired, // slug }).isRequired, - intl: intlShape.isRequired, }; export default injectIntl(ImportedArticles); diff --git a/src/app/components/article/PublishedArticles.js b/src/app/components/article/PublishedArticles.js index 954c1ee772..34640519fa 100644 --- a/src/app/components/article/PublishedArticles.js +++ b/src/app/components/article/PublishedArticles.js @@ -1,4 +1,3 @@ -/* eslint-disable react/sort-prop-types */ import React from 'react'; import { graphql } from 'react-relay/compat'; import PropTypes from 'prop-types'; @@ -45,7 +44,7 @@ const PublishedArticles = ({ intl, routeParams }) => { return ( } sortOptions={sortOptions} teamSlug={routeParams.team} @@ -59,10 +58,10 @@ const PublishedArticles = ({ intl, routeParams }) => { PublishedArticles.defaultProps = {}; PublishedArticles.propTypes = { + intl: intlShape.isRequired, routeParams: PropTypes.shape({ team: PropTypes.string.isRequired, // slug }).isRequired, - intl: intlShape.isRequired, }; export default injectIntl(PublishedArticles); diff --git a/src/app/components/search/AllItems.js b/src/app/components/search/AllItems.js index dff8061076..bae27db3c1 100644 --- a/src/app/components/search/AllItems.js +++ b/src/app/components/search/AllItems.js @@ -13,7 +13,10 @@ export default function AllItems({ routeParams }) { } listSubtitle={} diff --git a/src/app/components/search/LanguageFilter.js b/src/app/components/search/LanguageFilter.js index 6aaec23c18..710874e469 100644 --- a/src/app/components/search/LanguageFilter.js +++ b/src/app/components/search/LanguageFilter.js @@ -1,4 +1,3 @@ -/* eslint-disable react/sort-prop-types */ import React from 'react'; import { QueryRenderer, graphql } from 'react-relay/compat'; import Relay from 'react-relay/classic'; @@ -20,9 +19,9 @@ const messages = defineMessages({ defaultMessage: 'Media language', }, report_language: { - id: 'search.reportLanguage', - description: 'Label for report language filter', - defaultMessage: 'Report language', + id: 'search.articleLanguage', + description: 'Label for article language filter', + defaultMessage: 'Article language', }, request_language: { id: 'search.requestLanguage', @@ -121,12 +120,13 @@ const LanguageFilter = ({ LanguageFilter.defaultProps = { hide: false, - value: null, optionsToHide: [], + value: null, }; LanguageFilter.propTypes = { hide: PropTypes.bool, + intl: intlShape.isRequired, optionsToHide: PropTypes.arrayOf(PropTypes.string), value: PropTypes.oneOfType([ PropTypes.shape({ @@ -141,7 +141,6 @@ LanguageFilter.propTypes = { ]), onChange: PropTypes.func.isRequired, onRemove: PropTypes.func.isRequired, - intl: intlShape.isRequired, }; export default injectIntl(LanguageFilter); diff --git a/src/app/components/search/MultiSelectFilter.js b/src/app/components/search/MultiSelectFilter.js index 288d3ed308..812145d310 100644 --- a/src/app/components/search/MultiSelectFilter.js +++ b/src/app/components/search/MultiSelectFilter.js @@ -31,7 +31,6 @@ const Tag = ({ label, onDelete, readOnly, - ...props }) => ( <> {label ? @@ -43,7 +42,6 @@ const Tag = ({ [styles['filter-value-removable']]: !readOnly, }) } - {...props} > {label} { readOnly ? null : ( @@ -67,7 +65,7 @@ const Tag = ({ )} : -
+
@@ -111,6 +109,8 @@ const MultiSelectFilter = ({ return option ? option.label : ''; }; + const getOptionForValue = value => options.find(o => String(o.value) === String(value)); + const handleTagDelete = (value) => { const newValue = [...selectedArray.filter(o => o !== value)]; onChange(newValue); @@ -137,21 +137,31 @@ const MultiSelectFilter = ({ {label}
} - { !oneOption && selectedArray.map((value, index) => ( - - { index > 0 ? ( - - ) : null } - handleTagDelete(value)} - /> - - )) } + { !oneOption && selectedArray.map((value, index) => { + const option = getOptionForValue(value); + + return option.hasChildren ? null : ( + + { index > 0 ? ( + + ) : null } + {/* + If option has children it's a category. Don't render a Tag for it. + E.g.: "Social Media" in Media type filter + */} + { !getOptionForValue(value).hasChildren && + handleTagDelete(value)} + /> + } + + ); + }) } { !oneOption && selectedArray.length > 0 && showSelect ? ( (
} listActions={ { const newQuery = { ...stateQuery }; newQuery[filterKey] = value; + console.log('filterKey', filterKey); // eslint-disable-line + console.log('value', value); // eslint-disable-line setStateQuery(newQuery); }; diff --git a/src/app/components/search/SearchResults.js b/src/app/components/search/SearchResults.js index 4cbba1bd00..39f36ad965 100644 --- a/src/app/components/search/SearchResults.js +++ b/src/app/components/search/SearchResults.js @@ -1,4 +1,3 @@ -/* eslint-disable react/sort-prop-types */ import React from 'react'; import PropTypes from 'prop-types'; import Relay from 'react-relay/classic'; @@ -601,51 +600,51 @@ function SearchResultsComponent({ } SearchResultsComponent.defaultProps = { - showExpand: false, + extra: null, + feed: null, + feedTeam: null, + hideFields: [], icon: null, listActions: undefined, - resultType: 'default', - hideFields: [], + listSubtitle: null, readOnlyFields: [], + resultType: 'default', savedSearch: null, - feedTeam: null, - feed: null, - listSubtitle: null, - extra: null, + showExpand: false, }; SearchResultsComponent.propTypes = { - pusher: pusherShape.isRequired, clientSessionId: PropTypes.string.isRequired, - query: PropTypes.object.isRequired, - search: PropTypes.shape({ - id: PropTypes.string.isRequired, // TODO fill in props - medias: PropTypes.shape({ edges: PropTypes.array.isRequired }).isRequired, - }).isRequired, - feedTeam: PropTypes.shape({ - id: PropTypes.string.isRequired, - filters: PropTypes.object, - feedFilters: PropTypes.object, - }), // may be null + extra: PropTypes.func, // or null feed: PropTypes.shape({ - id: PropTypes.string.isRequired, dbid: PropTypes.number.isRequired, + id: PropTypes.string.isRequired, saved_search_id: PropTypes.number, }), // may be null - searchUrlPrefix: PropTypes.string.isRequired, - mediaUrlPrefix: PropTypes.string.isRequired, - showExpand: PropTypes.bool, - relay: PropTypes.object.isRequired, - title: PropTypes.node.isRequired, - listSubtitle: PropTypes.object, + feedTeam: PropTypes.shape({ + id: PropTypes.string.isRequired, + feedFilters: PropTypes.object, + filters: PropTypes.object, + }), // may be null + hideFields: PropTypes.arrayOf(PropTypes.string.isRequired), // or undefined icon: PropTypes.node, listActions: PropTypes.node, // or undefined + listSubtitle: PropTypes.object, + mediaUrlPrefix: PropTypes.string.isRequired, page: PropTypes.oneOf(['all-items', 'tipline-inbox', 'imported-fact-checks', 'suggested-matches', 'unmatched-media', 'published', 'list', 'feed', 'spam', 'trash', 'assigned-to-me']).isRequired, // FIXME Define listing types as a global constant - resultType: PropTypes.string, // 'default' or 'feed', for now - hideFields: PropTypes.arrayOf(PropTypes.string.isRequired), // or undefined + pusher: pusherShape.isRequired, + query: PropTypes.object.isRequired, readOnlyFields: PropTypes.arrayOf(PropTypes.string.isRequired), // or undefined + relay: PropTypes.object.isRequired, + resultType: PropTypes.string, // 'default' or 'feed', for now savedSearch: PropTypes.object, // or null - extra: PropTypes.func, // or null + search: PropTypes.shape({ + id: PropTypes.string.isRequired, // TODO fill in props + medias: PropTypes.shape({ edges: PropTypes.array.isRequired }).isRequired, + }).isRequired, + searchUrlPrefix: PropTypes.string.isRequired, + showExpand: PropTypes.bool, + title: PropTypes.node.isRequired, }; // eslint-disable-next-line import/no-unused-modules @@ -793,10 +792,10 @@ export default function SearchResults({ query, teamSlug, ...props }) { } SearchResults.propTypes = { + extra: PropTypes.func, listSubtitle: PropTypes.object, query: PropTypes.object.isRequired, teamSlug: PropTypes.string.isRequired, - extra: PropTypes.func, }; SearchResults.defaultProps = { diff --git a/src/app/components/team/AssignedToMe.js b/src/app/components/team/AssignedToMe.js index bdf87008ab..8cbcd9e0ef 100644 --- a/src/app/components/team/AssignedToMe.js +++ b/src/app/components/team/AssignedToMe.js @@ -37,7 +37,12 @@ const AssignedToMe = ({ routeParams }) => ( return ( } listSubtitle={} mediaUrlPrefix={`/${routeParams.team}/media`} diff --git a/src/app/components/team/Spam.js b/src/app/components/team/Spam.js index 80575c2422..6127c094d4 100644 --- a/src/app/components/team/Spam.js +++ b/src/app/components/team/Spam.js @@ -26,7 +26,14 @@ export default function Spam({ routeParams }) { } mediaUrlPrefix={`/${routeParams.team}/media`} page="spam" diff --git a/src/app/components/team/SuggestedMatches.js b/src/app/components/team/SuggestedMatches.js index 90c15f0e58..407c20f8d9 100644 --- a/src/app/components/team/SuggestedMatches.js +++ b/src/app/components/team/SuggestedMatches.js @@ -24,7 +24,12 @@ const SuggestedMatches = ({ routeParams }) => { } listSubtitle={} mediaUrlPrefix={`/${routeParams.team}/media`} diff --git a/src/app/components/team/TiplineInbox.js b/src/app/components/team/TiplineInbox.js index 9db30f4e89..d70c93f7c2 100644 --- a/src/app/components/team/TiplineInbox.js +++ b/src/app/components/team/TiplineInbox.js @@ -39,7 +39,12 @@ const TiplineInbox = ({ routeParams }) => ( return ( } listSubtitle={} mediaUrlPrefix={`/${routeParams.team}/media`} diff --git a/src/app/components/team/Trash.js b/src/app/components/team/Trash.js index 3208c03993..c08c2721a9 100644 --- a/src/app/components/team/Trash.js +++ b/src/app/components/team/Trash.js @@ -26,7 +26,14 @@ export default function Trash({ routeParams }) { } mediaUrlPrefix={`/${routeParams.team}/media`} page="trash" diff --git a/src/app/components/team/UnmatchedMedia.js b/src/app/components/team/UnmatchedMedia.js index 8c8be7121a..e4b77c1144 100644 --- a/src/app/components/team/UnmatchedMedia.js +++ b/src/app/components/team/UnmatchedMedia.js @@ -23,7 +23,12 @@ const UnmatchedMedia = ({ routeParams }) => { return ( } listSubtitle={} mediaUrlPrefix={`/${routeParams.team}/media`}