diff --git a/static/app-strings.json b/static/app-strings.json index a300b2144..6b8a69173 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -1586,5 +1586,6 @@ "Creator tools": "Creator tools", "Interacting as %channelName%": "Interacting as %channelName%", "Page Not Found": "Page Not Found", + "Transaction limit reached. Try reducing the Description length.": "Transaction limit reached. Try reducing the Description length.", "--end--": "--end--" } diff --git a/ui/component/channelEdit/view.jsx b/ui/component/channelEdit/view.jsx index 8ab311f18..eacb04031 100644 --- a/ui/component/channelEdit/view.jsx +++ b/ui/component/channelEdit/view.jsx @@ -6,7 +6,7 @@ import classnames from 'classnames'; import { FormField } from 'component/common/form'; import Button from 'component/button'; import TagsSearch from 'component/tagsSearch'; -import { FF_MAX_CHARS_IN_DESCRIPTION_CHANNEL } from 'constants/form-field'; +import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field'; import ErrorText from 'component/common/error-text'; import ChannelThumbnail from 'component/channelThumbnail'; import { isNameValid, parseURI } from 'lbry-redux'; @@ -39,17 +39,17 @@ type Props = { tags: Array, locations: Array, languages: Array, - updateChannel: any => Promise, + updateChannel: (any) => Promise, updatingChannel: boolean, updateError: string, - createChannel: any => Promise, + createChannel: (any) => Promise, createError: string, creatingChannel: boolean, clearChannelErrors: () => void, onDone: () => void, openModal: ( id: string, - { onUpdate: string => void, assetName: string, helpText: string, currentValue: string, title: string } + { onUpdate: (string) => void, assetName: string, helpText: string, currentValue: string, title: string } ) => void, uri: string, disabled: boolean, @@ -118,7 +118,7 @@ function ChannelForm(props: Props) { languages: languages || [], locations: locations || [], tags: tags - ? tags.map(tag => { + ? tags.map((tag) => { return { name: tag }; }) : [], @@ -181,13 +181,13 @@ function ChannelForm(props: Props) { function handleSubmit() { if (uri) { - updateChannel(params).then(success => { + updateChannel(params).then((success) => { if (success) { onDone(); } }); } else { - createChannel(params).then(success => { + createChannel(params).then((success) => { if (success) { analytics.apiLogPublish(success); onDone(); @@ -196,6 +196,12 @@ function ChannelForm(props: Props) { } } + const LIMIT_ERR_PARTIAL_MSG = 'bad-txns-claimscriptsize-toolarge (code 16)'; + let errorMsg = updateError || createError; + if (errorMsg && errorMsg.includes(LIMIT_ERR_PARTIAL_MSG)) { + errorMsg = __('Transaction limit reached. Try reducing the Description length.'); + } + React.useEffect(() => { let nameError; if (!name && name !== undefined) { @@ -222,7 +228,7 @@ function ChannelForm(props: Props) { title={__('Cover')} onClick={() => openModal(MODALS.IMAGE_UPLOAD, { - onUpdate: coverUrl => handleCoverChange(coverUrl), + onUpdate: (coverUrl) => handleCoverChange(coverUrl), title: __('Edit Cover Image'), helpText: __('(6.25:1)'), assetName: __('Cover Image'), @@ -246,7 +252,7 @@ function ChannelForm(props: Props) { title={__('Edit')} onClick={() => openModal(MODALS.IMAGE_UPLOAD, { - onUpdate: v => handleThumbnailChange(v), + onUpdate: (v) => handleThumbnailChange(v), title: __('Edit Thumbnail Image'), helpText: __('(1:1)'), assetName: __('Thumbnail'), @@ -297,7 +303,7 @@ function ChannelForm(props: Props) { value={params.name || channelName} error={nameError} disabled={!isNewChannel} - onChange={e => setParams({ ...params, name: e.target.value })} + onChange={(e) => setParams({ ...params, name: e.target.value })} /> {!isNewChannel && {__('This field cannot be changed.')}} @@ -308,7 +314,7 @@ function ChannelForm(props: Props) { label={__('Title')} placeholder={__('My Awesome Channel')} value={params.title} - onChange={e => setParams({ ...params, title: e.target.value })} + onChange={(e) => setParams({ ...params, title: e.target.value })} /> setParams({ ...params, description: text })} - textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION_CHANNEL} + onChange={(text) => setParams({ ...params, description: text })} + textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION} /> } @@ -336,7 +342,7 @@ function ChannelForm(props: Props) { error={bidError} min="0.0" disabled={false} - onChange={event => handleBidChange(parseFloat(event.target.value))} + onChange={(event) => handleBidChange(parseFloat(event.target.value))} placeholder={0.1} helper={ <> @@ -357,17 +363,17 @@ function ChannelForm(props: Props) { limitSelect={MAX_TAG_SELECT} tagsPassedIn={params.tags || []} label={__('Selected Tags')} - onRemove={clickedTag => { - const newTags = params.tags.slice().filter(tag => tag.name !== clickedTag.name); + onRemove={(clickedTag) => { + const newTags = params.tags.slice().filter((tag) => tag.name !== clickedTag.name); setParams({ ...params, tags: newTags }); }} - onSelect={newTags => { - newTags.forEach(newTag => { - if (!params.tags.map(savedTag => savedTag.name).includes(newTag.name)) { + onSelect={(newTags) => { + newTags.forEach((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) }); + setParams({ ...params, tags: params.tags.filter((tag) => tag.name !== newTag.name) }); } }); }} @@ -386,7 +392,7 @@ function ChannelForm(props: Props) { placeholder={__('aprettygoodsite.com')} disabled={false} value={params.website} - onChange={e => setParams({ ...params, website: e.target.value })} + onChange={(e) => setParams({ ...params, website: e.target.value })} /> setParams({ ...params, email: e.target.value })} + onChange={(e) => setParams({ ...params, email: e.target.value })} /> handleLanguageChange(0, event.target.value)} + onChange={(event) => handleLanguageChange(0, event.target.value)} value={primaryLanguage} helper={__('Your main content language')} > - {Object.keys(SUPPORTED_LANGUAGES).map(language => ( + {Object.keys(SUPPORTED_LANGUAGES).map((language) => ( @@ -418,7 +424,7 @@ function ChannelForm(props: Props) { name="language_select2" type="select" label={__('Secondary Language')} - onChange={event => handleLanguageChange(1, event.target.value)} + onChange={(event) => handleLanguageChange(1, event.target.value)} value={secondaryLanguage} disabled={!languageParam[0]} helper={__('Your other content language')} @@ -427,8 +433,8 @@ function ChannelForm(props: Props) { {__('None selected')} {Object.keys(SUPPORTED_LANGUAGES) - .filter(lang => lang !== languageParam[0]) - .map(language => ( + .filter((lang) => lang !== languageParam[0]) + .map((language) => ( @@ -456,8 +462,8 @@ function ChannelForm(props: Props) { />