From e8704b1c9267b285520608bd428e73e0d41abffe Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Sat, 10 Aug 2019 10:10:59 +0100 Subject: [PATCH] display remaining discover tags and fix publish cancel bug --- src/page/discover/view.js | 25 ++++++++++++++- src/page/publish/index.js | 4 ++- src/page/publish/view.js | 66 ++++++++++++++++++++++----------------- src/styles/discover.js | 19 +++++++++++ 4 files changed, 84 insertions(+), 30 deletions(-) diff --git a/src/page/discover/view.js b/src/page/discover/view.js index 4cfff44..8d3c3fa 100644 --- a/src/page/discover/view.js +++ b/src/page/discover/view.js @@ -30,6 +30,7 @@ import _ from 'lodash'; class DiscoverPage extends React.PureComponent { state = { tagCollection: [], + remainingTags: [], showModalTagSelector: false, showSortPicker: false, orderBy: Constants.DEFAULT_ORDER_BY, @@ -207,10 +208,14 @@ class DiscoverPage extends React.PureComponent { const tagCollection = _.shuffle(tags) .slice(0, 5) .map(tag => [tag]); + + const usedTags = tagCollection.map(tagList => tagList[0]); + const remainingTags = tags.filter(tag => !usedTags.includes(tag)); + // everything tagCollection.unshift(tags); - this.setState({ tagCollection }); + this.setState({ remainingTags, tagCollection }); }; handleTagPress = name => { @@ -246,6 +251,23 @@ class DiscoverPage extends React.PureComponent { ); + sectionListFooter = () => ( + + More tags you follow + + {this.state.remainingTags.map(tag => ( + this.handleTagPress(tag)} + > + {formatTagTitle(tag)} + + ))} + + + ); + renderSectionListItem = ({ item, index, section }) => ( ({ @@ -18,6 +19,7 @@ const select = state => ({ const perform = dispatch => ({ notify: data => dispatch(doToast(data)), + updatePublishForm: value => dispatch(doUpdatePublishForm(value)), uploadThumbnail: (filePath, fsAdapter) => dispatch(doUploadThumbnail(filePath, null, fsAdapter)), publish: params => dispatch(doPublish(params)), resolveUri: uri => dispatch(doResolveUri(uri)), diff --git a/src/page/publish/view.js b/src/page/publish/view.js index ae96d06..fc19451 100644 --- a/src/page/publish/view.js +++ b/src/page/publish/view.js @@ -283,31 +283,41 @@ class PublishPage extends React.PureComponent { }; showSelector() { - this.setState({ - publishStarted: false, + const { updatePublishForm } = this.props; - currentMedia: null, - currentThumbnailUri: null, - currentPhase: Constants.PHASE_SELECTOR, + this.setState( + { + publishStarted: false, - // publish - advancedMode: false, - anonymous: true, - channelName: CLAIM_VALUES.CHANNEL_ANONYMOUS, - priceSet: false, + currentMedia: null, + currentThumbnailUri: null, + currentPhase: Constants.PHASE_SELECTOR, + updatingThumbnailUri: false, + uploadThumbnailStarted: false, - // input data - bid: 0.1, - description: null, - title: null, - language: 'en', - license: LICENSES.NONE, - name: null, - price: 0, - uri: null, - tags: [], - uploadedThumbnailUri: null, - }); + // publish + advancedMode: false, + anonymous: true, + channelName: CLAIM_VALUES.CHANNEL_ANONYMOUS, + priceSet: false, + + // input data + bid: 0.1, + description: null, + title: null, + language: 'en', + license: LICENSES.NONE, + name: null, + price: 0, + uri: null, + tags: [], + uploadedThumbnailUri: null, + }, + () => { + // reset thumbnail + updatePublishForm({ thumbnail: null }); + } + ); } handleRecordVideoPressed = () => { @@ -523,6 +533,10 @@ class PublishPage extends React.PureComponent { ); }; + handleDescriptionChange = description => { + this.setState({ description }); + }; + render() { const { balance, navigation, notify, publishFormValues } = this.props; const { canUseCamera, currentPhase, galleryThumbnailsChecked, thumbnailPath, videos } = this.state; @@ -605,7 +619,7 @@ class PublishPage extends React.PureComponent { {this.state.uploadThumbnailStarted && !this.state.uploadedThumbnailUri && ( - + Uploading thumbnail... )} @@ -781,11 +795,7 @@ class PublishPage extends React.PureComponent { )} {!publishFormValues.publishing && !this.state.publishStarted && ( - this.setState({ currentPhase: Constants.PHASE_SELECTOR })} - /> + this.showSelector()} /> )} {!publishFormValues.publishing && !this.state.publishStarted && ( diff --git a/src/styles/discover.js b/src/styles/discover.js index f2afa03..5064aef 100644 --- a/src/styles/discover.js +++ b/src/styles/discover.js @@ -76,6 +76,25 @@ const discoverStyle = StyleSheet.create({ marginTop: 6, marginBottom: 6, }, + footer: { + marginTop: 12, + marginLeft: 16, + marginRight: 16, + marginBottom: 64, + }, + footerTitle: { + fontFamily: 'Inter-UI-Regular', + fontSize: 20, + marginBottom: 10, + }, + footerTags: { + flexDirection: 'row', + flexWrap: 'wrap', + }, + footerTag: { + marginRight: 24, + marginBottom: 12, + }, categoryName: { fontFamily: 'Inter-UI-SemiBold', fontSize: 18,