Merge pull request #2641 from lbryio/channelTags
adds tags to channelUpdate
This commit is contained in:
commit
3b01f66e80
4 changed files with 34 additions and 11 deletions
|
@ -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",
|
||||||
|
|
|
@ -4,11 +4,11 @@ import { parseURI } from 'lbry-redux';
|
||||||
import { Form, FormField } from 'component/common/form';
|
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 'component/selectAsset';
|
||||||
|
import TagSelect from 'component/tagsSelect';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
uri: string,
|
uri: string,
|
||||||
|
|
||||||
title: ?string,
|
title: ?string,
|
||||||
amount: string,
|
amount: string,
|
||||||
cover: ?string,
|
cover: ?string,
|
||||||
|
@ -59,7 +59,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 +181,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 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'}>
|
<div className={'card__actions'}>
|
||||||
<Button
|
<Button
|
||||||
button="primary"
|
button="primary"
|
||||||
|
|
|
@ -9,14 +9,13 @@ import { useTransition, animated } from 'react-spring';
|
||||||
import analytics from 'analytics';
|
import analytics from 'analytics';
|
||||||
|
|
||||||
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>,
|
||||||
|
@ -34,7 +33,7 @@ export default function TagSelect(props: Props) {
|
||||||
const {
|
const {
|
||||||
showClose,
|
showClose,
|
||||||
followedTags,
|
followedTags,
|
||||||
doToggleTagFollow,
|
doToggleTagFollow = null,
|
||||||
title,
|
title,
|
||||||
help,
|
help,
|
||||||
empty,
|
empty,
|
||||||
|
@ -55,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);
|
||||||
|
|
||||||
const wasFollowing = followedTags.map(tag => tag.name).includes(tag.name);
|
const wasFollowing = followedTags.map(tag => tag.name).includes(tag.name);
|
||||||
|
|
|
@ -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.",
|
"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",
|
"Confirm Claim Revoke": "Confirm Claim Revoke",
|
||||||
"Are you sure you want to remove this support?": "Are you sure you want to remove this support?",
|
"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."
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue