From 6e4765a743136c46471f5f923aaa863d0901ebf0 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sun, 25 Aug 2019 17:07:50 +0100 Subject: [PATCH] fixes from ui/ux review --- src/component/channelSelector/view.js | 3 +- src/page/publish/view.js | 71 +++++++++++++++++++-------- src/page/publishes/view.js | 8 +-- 3 files changed, 56 insertions(+), 26 deletions(-) diff --git a/src/component/channelSelector/view.js b/src/component/channelSelector/view.js index 96b02a5..4584ce9 100644 --- a/src/component/channelSelector/view.js +++ b/src/component/channelSelector/view.js @@ -178,7 +178,7 @@ export default class ChannelSelector extends React.PureComponent { render() { const channel = this.state.addingChannel ? 'new' : this.props.channel; - const { fetchingChannels, channels = [] } = this.props; + const { enabled, fetchingChannels, channels = [] } = this.props; const pickerItems = [Constants.ITEM_ANONYMOUS, Constants.ITEM_CREATE_A_CHANNEL].concat(channels.map(ch => ch.name)); const { @@ -195,6 +195,7 @@ export default class ChannelSelector extends React.PureComponent { return ( { - const { pushDrawerStack, setPlayerVisible, navigation } = this.props; + const { balance, pushDrawerStack, setPlayerVisible, navigation } = this.props; pushDrawerStack(); setPlayerVisible(); @@ -168,6 +170,7 @@ class PublishPage extends React.PureComponent { NativeModules.Gallery.getThumbnailPath().then(thumbnailPath => this.setState({ thumbnailPath })); this.setState( { + canPublish: balance >= 0.1, loadingVideos: true, }, () => { @@ -216,6 +219,7 @@ class PublishPage extends React.PureComponent { editMode: true, currentPhase: Constants.PHASE_DETAILS, + hasEditedContentAddress: true, bid: amount, channelName, description, @@ -335,7 +339,11 @@ class PublishPage extends React.PureComponent { }; handlePublishSuccess = data => { - this.setState({ publishStarted: false, currentPhase: Constants.PHASE_PUBLISH }); + const { navigation, notify } = this.props; + notify({ + message: `Your content was successfully published to ${this.state.uri}. It will be available in a few mintues.`, + }); + navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES, params: { publishSuccess: true } }); }; handlePublishFailure = error => { @@ -371,7 +379,7 @@ class PublishPage extends React.PureComponent { this.setState( { currentMedia: media, - title: name, + title: null, // no title autogeneration (user will fill this in) name: this.formatNameForTitle(name), currentPhase: Constants.PHASE_DETAILS, }, @@ -404,6 +412,7 @@ class PublishPage extends React.PureComponent { priceSet: false, // input data + hasEditedContentAddress: false, bid: 0.1, description: null, title: null, @@ -534,9 +543,13 @@ class PublishPage extends React.PureComponent { this.setState({ price }); }; - handleNameChange = name => { + handleNameChange = (name, userInput) => { const { notify } = this.props; this.setState({ name }); + if (userInput) { + this.setState({ hasEditedContentAddress: true }); + } + if (!isNameValid(name, false)) { notify({ message: 'Your content address contains invalid characters' }); return; @@ -553,7 +566,7 @@ class PublishPage extends React.PureComponent { }; handleAddTag = tag => { - if (!tag) { + if (!tag || !this.state.canPublish || this.state.publishStarted) { return; } @@ -570,7 +583,7 @@ class PublishPage extends React.PureComponent { }; handleRemoveTag = tag => { - if (!tag) { + if (!tag || !this.state.canPublish || this.state.publishStarted) { return; } @@ -626,15 +639,20 @@ class PublishPage extends React.PureComponent { }; handleTitleChange = title => { - this.setState( - { - title, - name: this.formatNameForTitle(title), - }, - () => { - this.handleNameChange(this.state.name); - } - ); + this.setState({ title }); + + if (!this.state.editMode && !this.state.hasEditedContentAddress) { + // only autogenerate url if the user has not yet edited the field + // also shouldn't change url in edit mode + this.setState( + { + name: this.formatNameForTitle(title), + }, + () => { + this.handleNameChange(this.state.name); + } + ); + } }; handleDescriptionChange = description => { @@ -774,7 +792,7 @@ class PublishPage extends React.PureComponent { /> )} - {balance < 0.1 && } + {!this.state.canPublish && } {this.state.uploadThumbnailStarted && !this.state.uploadedThumbnailUri && ( @@ -789,6 +807,7 @@ class PublishPage extends React.PureComponent { Title )} Description )} Channel - + @@ -855,6 +879,7 @@ class PublishPage extends React.PureComponent { {this.state.priceSet && ( - Content Address + Content address The address where people can find your content (ex. lbry://myvideo). {this.state.editMode && @@ -877,16 +902,17 @@ class PublishPage extends React.PureComponent { this.handleNameChange(value, true)} /> Language License {[LICENSES.COPYRIGHT, LICENSES.OTHER].includes(this.state.license) && (