This commit is contained in:
zeppi 2021-02-04 15:32:38 -05:00 committed by jessopb
parent a85c9a1f48
commit dc65f6140b

View file

@ -69,12 +69,10 @@ export default function TagsSearch(props: Props) {
const remainingUnfollowedTagsSet = setDifference(unfollowedTagsSet, selectedTagsSet); const remainingUnfollowedTagsSet = setDifference(unfollowedTagsSet, selectedTagsSet);
const suggestedTagsSet = setUnion(remainingFollowedTagsSet, remainingUnfollowedTagsSet); const suggestedTagsSet = setUnion(remainingFollowedTagsSet, remainingUnfollowedTagsSet);
let countWithoutSpecialTags = selectedTagsSet.has('mature') ? selectedTagsSet.size - 1 : selectedTagsSet.size; const SPECIAL_TAGS = [...UTILITY_TAGS, 'lbry-first', 'mature'];
if (selectedTagsSet.has('lbry-first')) { let countWithoutSpecialTags = selectedTagsSet.size;
countWithoutSpecialTags = countWithoutSpecialTags - 1;
}
UTILITY_TAGS.forEach(t => { SPECIAL_TAGS.forEach(t => {
if (selectedTagsSet.has(t)) { if (selectedTagsSet.has(t)) {
countWithoutSpecialTags--; countWithoutSpecialTags--;
} }
@ -174,16 +172,18 @@ export default function TagsSearch(props: Props) {
{!tagsPassedIn.length && <Tag key={`placeholder-tag`} name={'example'} disabled type={'remove'} />} {!tagsPassedIn.length && <Tag key={`placeholder-tag`} name={'example'} disabled type={'remove'} />}
{Boolean(tagsPassedIn.length) && {Boolean(tagsPassedIn.length) &&
// .filter(t => !UTILITY_TAGS.includes(t.name)) // .filter(t => !UTILITY_TAGS.includes(t.name))
tagsPassedIn.map(tag => ( tagsPassedIn
<Tag .filter(t => !UTILITY_TAGS.includes(t.name))
key={`passed${tag.name}`} .map(tag => (
name={tag.name} <Tag
type="remove" key={`passed${tag.name}`}
onClick={() => { name={tag.name}
onRemove(tag); type="remove"
}} onClick={() => {
/> onRemove(tag);
))} }}
/>
))}
</ul> </ul>
<FormField <FormField
autoFocus={!disableAutoFocus} autoFocus={!disableAutoFocus}
@ -219,27 +219,28 @@ export default function TagsSearch(props: Props) {
</ul> </ul>
</section> </section>
</fieldset-section> </fieldset-section>
{experimentalFeature && onSelect && ( {experimentalFeature &&
<fieldset-section> onSelect && ( // onSelect ensures this does not appear on TagFollow
<label>{__('Control Tags')}</label> <fieldset-section>
{UTILITY_TAGS.map(t => ( <label>{__('Control Tags')}</label>
<FormField {UTILITY_TAGS.map(t => (
key={t} <FormField
name={t} key={t}
type="checkbox" name={t}
blockWrap={false} type="checkbox"
label={__( blockWrap={false}
t label={__(
.split('_') t
.map(word => word.charAt(0).toUpperCase() + word.slice(1)) .split('_')
.join(' ') .map(word => word.charAt(0).toUpperCase() + word.slice(1))
)} .join(' ')
checked={tagsPassedIn.some(te => te.name === t)} )}
onChange={() => handleUtilityTagCheckbox(t)} checked={tagsPassedIn.some(te => te.name === t)}
/> onChange={() => handleUtilityTagCheckbox(t)}
))} />
</fieldset-section> ))}
)} </fieldset-section>
)}
</Form> </Form>
</React.Fragment> </React.Fragment>
); );