fix thumbnail/cover edits

This commit is contained in:
Sean Yesmunt 2020-07-02 13:39:29 -04:00
parent 9952359e28
commit f4310cd3aa
4 changed files with 23 additions and 21 deletions

View file

@ -21,8 +21,8 @@ import ChannelPage from './view';
const select = (state, props) => ({ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state), claim: makeSelectClaimForUri(props.uri)(state),
title: makeSelectTitleForUri(props.uri)(state), title: makeSelectTitleForUri(props.uri)(state),
thumbnail: makeSelectThumbnailForUri(props.uri)(state), thumbnailUrl: makeSelectThumbnailForUri(props.uri)(state),
cover: makeSelectCoverForUri(props.uri)(state), coverUrl: makeSelectCoverForUri(props.uri)(state),
description: makeSelectMetadataItemForUri(props.uri, 'description')(state), description: makeSelectMetadataItemForUri(props.uri, 'description')(state),
website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state), website: makeSelectMetadataItemForUri(props.uri, 'website_url')(state),
email: makeSelectMetadataItemForUri(props.uri, 'email')(state), email: makeSelectMetadataItemForUri(props.uri, 'email')(state),

View file

@ -21,8 +21,8 @@ type Props = {
claim: ChannelClaim, claim: ChannelClaim,
title: string, title: string,
amount: string, amount: string,
cover: string, coverUrl: string,
thumbnail: string, thumbnailUrl: string,
location: { search: string }, location: { search: string },
description: string, description: string,
website: string, website: string,
@ -53,8 +53,8 @@ function ChannelForm(props: Props) {
description, description,
website, website,
email, email,
thumbnail, thumbnailUrl,
cover, coverUrl,
tags, tags,
locations, locations,
languages, languages,
@ -81,8 +81,8 @@ function ChannelForm(props: Props) {
const channelParams: { const channelParams: {
website: string, website: string,
email: string, email: string,
cover: string, coverUrl: string,
thumbnail: string, thumbnailUrl: string,
description: string, description: string,
title: string, title: string,
amount: number, amount: number,
@ -93,8 +93,8 @@ function ChannelForm(props: Props) {
} = { } = {
website, website,
email, email,
cover, coverUrl,
thumbnail, thumbnailUrl,
description, description,
title, title,
amount: 0.001, amount: 0.001,
@ -133,11 +133,11 @@ function ChannelForm(props: Props) {
} }
function handleThumbnailChange(thumbnailUrl: string) { function handleThumbnailChange(thumbnailUrl: string) {
setParams({ ...params, thumbnail: thumbnailUrl }); setParams({ ...params, thumbnailUrl });
} }
function handleCoverChange(coverUrl: string) { function handleCoverChange(coverUrl: string) {
setParams({ ...params, cover: coverUrl }); setParams({ ...params, coverUrl });
} }
function handleSubmit() { function handleSubmit() {
@ -180,16 +180,16 @@ function ChannelForm(props: Props) {
openModal(MODALS.IMAGE_UPLOAD, { openModal(MODALS.IMAGE_UPLOAD, {
onUpdate: coverUrl => handleCoverChange(coverUrl), onUpdate: coverUrl => handleCoverChange(coverUrl),
title: __('Edit Cover Image'), title: __('Edit Cover Image'),
helpText: __('(Y x Z)'), helpText: __('(6.25:1)'),
assetName: __('Cover Image'), assetName: __('Cover Image'),
currentValue: params.cover, currentValue: params.coverUrl,
}) })
} }
icon={ICONS.CAMERA} icon={ICONS.CAMERA}
iconSize={18} iconSize={18}
/> />
</div> </div>
{params.cover && <img className="channel-cover__custom" src={params.cover} />} {params.coverUrl && <img className="channel-cover__custom" src={params.coverUrl} />}
<div className="channel__primary-info"> <div className="channel__primary-info">
<div className="channel__edit-thumb"> <div className="channel__edit-thumb">
<Button <Button
@ -199,9 +199,9 @@ function ChannelForm(props: Props) {
openModal(MODALS.IMAGE_UPLOAD, { openModal(MODALS.IMAGE_UPLOAD, {
onUpdate: v => handleThumbnailChange(v), onUpdate: v => handleThumbnailChange(v),
title: __('Edit Thumbnail Image'), title: __('Edit Thumbnail Image'),
helpText: __('(Y x Z)'), helpText: __('(1:1)'),
assetName: __('Thumbnail'), assetName: __('Thumbnail'),
currentValue: params.thumbnail, currentValue: params.thumbnailUrl,
}) })
} }
icon={ICONS.CAMERA} icon={ICONS.CAMERA}
@ -211,7 +211,7 @@ function ChannelForm(props: Props) {
<ChannelThumbnail <ChannelThumbnail
className="channel__thumbnail--channel-page" className="channel__thumbnail--channel-page"
uri={uri} uri={uri}
thumbnailPreview={params.thumbnail} thumbnailPreview={params.thumbnailUrl}
allowGifs allowGifs
/> />
<h1 className="channel__title"> <h1 className="channel__title">
@ -357,6 +357,7 @@ function ChannelForm(props: Props) {
<div className="section__actions"> <div className="section__actions">
<Button <Button
button="primary" button="primary"
disabled={creatingChannel || updatingChannel}
label={creatingChannel || updatingChannel ? __('Submitting') : __('Submit')} label={creatingChannel || updatingChannel ? __('Submitting') : __('Submit')}
onClick={handleSubmit} onClick={handleSubmit}
/> />

View file

@ -90,6 +90,7 @@ function SelectAsset(props: Props) {
/> />
) : ( ) : (
<FileSelector <FileSelector
autoFocus
disabled={uploadStatus === SPEECH_UPLOADING} disabled={uploadStatus === SPEECH_UPLOADING}
label={uploadStatus === SPEECH_UPLOADING ? __('Uploading...') : __('File to upload')} label={uploadStatus === SPEECH_UPLOADING ? __('Uploading...') : __('File to upload')}
name="assetSelector" name="assetSelector"
@ -112,7 +113,7 @@ function SelectAsset(props: Props) {
<FormField <FormField
name="toggle-upload" name="toggle-upload"
type="checkbox" type="checkbox"
label={__('Use a URL instead')} label={__('Use a URL')}
checked={useUrl} checked={useUrl}
onChange={() => setUseUrl(!useUrl)} onChange={() => setUseUrl(!useUrl)}
/> />

View file

@ -6347,9 +6347,9 @@ lazy-val@^1.0.4:
yargs "^13.2.2" yargs "^13.2.2"
zstd-codec "^0.1.1" zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#eb47b7e5b6cc24db93b2b66cf1153b02858caf58: lbry-redux@lbryio/lbry-redux#c0bfa4d32005266d41df18a19c93914c426a8067:
version "0.0.1" version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/eb47b7e5b6cc24db93b2b66cf1153b02858caf58" resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/c0bfa4d32005266d41df18a19c93914c426a8067"
dependencies: dependencies:
proxy-polyfill "0.1.6" proxy-polyfill "0.1.6"
reselect "^3.0.0" reselect "^3.0.0"