From dc65f6140b3a50bbd64ccb92be6421f197327601 Mon Sep 17 00:00:00 2001 From: zeppi Date: Thu, 4 Feb 2021 15:32:38 -0500 Subject: [PATCH] cleanup --- ui/component/tagsSearch/view.jsx | 73 ++++++++++++++++---------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/ui/component/tagsSearch/view.jsx b/ui/component/tagsSearch/view.jsx index e155b43ec..c42ad99dd 100644 --- a/ui/component/tagsSearch/view.jsx +++ b/ui/component/tagsSearch/view.jsx @@ -69,12 +69,10 @@ export default function TagsSearch(props: Props) { const remainingUnfollowedTagsSet = setDifference(unfollowedTagsSet, selectedTagsSet); const suggestedTagsSet = setUnion(remainingFollowedTagsSet, remainingUnfollowedTagsSet); - let countWithoutSpecialTags = selectedTagsSet.has('mature') ? selectedTagsSet.size - 1 : selectedTagsSet.size; - if (selectedTagsSet.has('lbry-first')) { - countWithoutSpecialTags = countWithoutSpecialTags - 1; - } + const SPECIAL_TAGS = [...UTILITY_TAGS, 'lbry-first', 'mature']; + let countWithoutSpecialTags = selectedTagsSet.size; - UTILITY_TAGS.forEach(t => { + SPECIAL_TAGS.forEach(t => { if (selectedTagsSet.has(t)) { countWithoutSpecialTags--; } @@ -174,16 +172,18 @@ export default function TagsSearch(props: Props) { {!tagsPassedIn.length && } {Boolean(tagsPassedIn.length) && // .filter(t => !UTILITY_TAGS.includes(t.name)) - tagsPassedIn.map(tag => ( - { - onRemove(tag); - }} - /> - ))} + tagsPassedIn + .filter(t => !UTILITY_TAGS.includes(t.name)) + .map(tag => ( + { + onRemove(tag); + }} + /> + ))} - {experimentalFeature && onSelect && ( - - - {UTILITY_TAGS.map(t => ( - word.charAt(0).toUpperCase() + word.slice(1)) - .join(' ') - )} - checked={tagsPassedIn.some(te => te.name === t)} - onChange={() => handleUtilityTagCheckbox(t)} - /> - ))} - - )} + {experimentalFeature && + onSelect && ( // onSelect ensures this does not appear on TagFollow + + + {UTILITY_TAGS.map(t => ( + word.charAt(0).toUpperCase() + word.slice(1)) + .join(' ') + )} + checked={tagsPassedIn.some(te => te.name === t)} + onChange={() => handleUtilityTagCheckbox(t)} + /> + ))} + + )} );