adds tags to channelUpdate

This commit is contained in:
jessop 2019-07-18 13:04:30 -04:00
parent 7a687cac39
commit 081e23d7fd
3 changed files with 31 additions and 7 deletions

View file

@ -124,7 +124,7 @@
"jsmediatags": "^3.8.1", "jsmediatags": "^3.8.1",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"lbry-format": "https://github.com/lbryio/lbry-format.git", "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", "lbryinc": "lbryio/lbryinc#a93596c51c8fb0a226cb84df04c26a6bb60a45fb",
"lint-staged": "^7.0.2", "lint-staged": "^7.0.2",
"localforage": "^1.7.1", "localforage": "^1.7.1",

View file

@ -5,6 +5,7 @@ import { Form, FormField } from 'component/common/form';
import Button from 'component/button'; import Button from 'component/button';
import SelectAsset from '../selectAsset/view'; import SelectAsset from '../selectAsset/view';
import TagSelect from '../tagsSelect/view';
type Props = { type Props = {
uri: string, uri: string,
@ -59,7 +60,11 @@ function ChannelForm(props: Props) {
locations: locations || [], locations: locations || [],
title: title, title: title,
thumbnail: thumbnail, thumbnail: thumbnail,
tags: tags || [], tags: tags
? tags.map(tag => {
return { name: tag };
})
: [],
claim_id: claimId, claim_id: claimId,
amount: amount, amount: amount,
}; };
@ -177,6 +182,25 @@ function ChannelForm(props: Props) {
disabled={false} disabled={false}
onChange={text => setParams({ ...params, description: text })} 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 content.')}
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'}> <div className={'card__actions'}>
<Button <Button
button="primary" button="primary"

View file

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