Merge pull request #2641 from lbryio/channelTags

adds tags to channelUpdate
This commit is contained in:
Sean Yesmunt 2019-07-22 19:25:41 -04:00 committed by GitHub
commit 3b01f66e80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 11 deletions

View file

@ -124,7 +124,7 @@
"jsmediatags": "^3.8.1",
"json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#bb82aed61a5569e565daa784eb25fc1d639c0c22",
"lbry-redux": "lbryio/lbry-redux#b07dfa172a526aa5e09af57bb6cf33790c8d0c91",
"lbryinc": "lbryio/lbryinc#a93596c51c8fb0a226cb84df04c26a6bb60a45fb",
"lint-staged": "^7.0.2",
"localforage": "^1.7.1",

View file

@ -4,11 +4,11 @@ import { parseURI } from 'lbry-redux';
import { Form, FormField } from 'component/common/form';
import Button from 'component/button';
import SelectAsset from '../selectAsset/view';
import SelectAsset from 'component/selectAsset';
import TagSelect from 'component/tagsSelect';
type Props = {
uri: string,
title: ?string,
amount: string,
cover: ?string,
@ -59,7 +59,11 @@ function ChannelForm(props: Props) {
locations: locations || [],
title: title,
thumbnail: thumbnail,
tags: tags || [],
tags: tags
? tags.map(tag => {
return { name: tag };
})
: [],
claim_id: claimId,
amount: amount,
};
@ -177,6 +181,25 @@ function ChannelForm(props: Props) {
disabled={false}
onChange={text => setParams({ ...params, description: text })}
/>
<TagSelect
title={false}
suggestMature
help={__('The better your tags are, the easier it will be for people to discover your channel.')}
empty={__('No tags added')}
onSelect={newTag => {
if (!params.tags.map(savedTag => savedTag.name).includes(newTag.name)) {
setParams({ ...params, tags: [...params.tags, newTag] });
} else {
// If it already exists and the user types it in, remove it
setParams({ ...params, tags: params.tags.filter(tag => tag.name !== newTag.name) });
}
}}
onRemove={clickedTag => {
const newTags = params.tags.slice().filter(tag => tag.name !== clickedTag.name);
setParams({ ...params, tags: newTags });
}}
tagsChosen={params.tags || []}
/>
<div className={'card__actions'}>
<Button
button="primary"

View file

@ -9,14 +9,13 @@ import { useTransition, animated } from 'react-spring';
import analytics from 'analytics';
type Props = {
showClose: boolean,
showClose?: boolean,
followedTags: Array<Tag>,
doToggleTagFollow: string => void,
doToggleTagFollow?: string => void,
suggestMature: boolean,
// Ovverides
// The default component is for following tags
title?: string,
title?: string | boolean,
help?: string,
empty?: string,
tagsChosen?: Array<Tag>,
@ -34,7 +33,7 @@ export default function TagSelect(props: Props) {
const {
showClose,
followedTags,
doToggleTagFollow,
doToggleTagFollow = null,
title,
help,
empty,
@ -55,7 +54,7 @@ export default function TagSelect(props: Props) {
function handleTagClick(tag) {
if (onRemove) {
onRemove(tag);
} else {
} else if (doToggleTagFollow) {
doToggleTagFollow(tag.name);
const wasFollowing = followedTags.map(tag => tag.name).includes(tag.name);

View file

@ -574,5 +574,6 @@
"You can generate a new address at any time, and any previous addresses will continue to work.": "You can generate a new address at any time, and any previous addresses will continue to work.",
"Confirm Claim Revoke": "Confirm Claim Revoke",
"Are you sure you want to remove this support?": "Are you sure you want to remove this support?",
"These credits are permanently yours and can be removed at any time. Removing this support will reduce the claim's discoverability and return the LBC to your spendable balance.": "These credits are permanently yours and can be removed at any time. Removing this support will reduce the claim's discoverability and return the LBC to your spendable balance."
"These credits are permanently yours and can be removed at any time. Removing this support will reduce the claim's discoverability and return the LBC to your spendable balance.": "These credits are permanently yours and can be removed at any time. Removing this support will reduce the claim's discoverability and return the LBC to your spendable balance.",
"The better your tags are, the easier it will be for people to discover your channel.": "The better your tags are, the easier it will be for people to discover your channel."
}