From a4fad20ff1988291f7e5c84944ba83d136d33cef Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 15 Oct 2019 17:55:49 +0100 Subject: [PATCH] fixes per review --- src/constants.js | 2 ++ src/page/channelCreator/view.js | 14 +++++++++----- src/page/publish/view.js | 14 +++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/constants.js b/src/constants.js index be0d4f5..d1e2eba 100644 --- a/src/constants.js +++ b/src/constants.js @@ -138,6 +138,8 @@ const Constants = { MORE_PLACEHOLDER: '_more', TRUE_STRING: 'true', + + MINIMUM_TRANSACTION_BALANCE: 0.1, }; export default Constants; diff --git a/src/page/channelCreator/view.js b/src/page/channelCreator/view.js index 7cf4457..6a7c399 100644 --- a/src/page/channelCreator/view.js +++ b/src/page/channelCreator/view.js @@ -32,6 +32,8 @@ import channelIconStyle from 'styles/channelIcon'; import seedrandom from 'seedrandom'; export default class ChannelCreator extends React.PureComponent { + scrollView = null; + state = { autoStyle: null, canSave: true, @@ -389,11 +391,13 @@ export default class ChannelCreator extends React.PureComponent { website, } = this.state; - if (balance < 0.1) { + if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) { notify({ - message: - "You don't have enough credits to create a channel. Press the blue bar to earn some credits from rewards!", + message: 'Creating a channel requires credits. Press the blue bar to get some for free.', }); + if (this.scrollView) { + this.scrollView.scrollTo({ x: 0, y: 0, animated: true }); + } return; } @@ -846,7 +850,7 @@ export default class ChannelCreator extends React.PureComponent { )} {currentPhase === Constants.PHASE_CREATE && ( - + (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}> - {balance < 0.1 && } + {balance < Constants.MINIMUM_TRANSACTION_BALANCE && } diff --git a/src/page/publish/view.js b/src/page/publish/view.js index ffb4bee..8ecf9d1 100644 --- a/src/page/publish/view.js +++ b/src/page/publish/view.js @@ -76,6 +76,8 @@ const languages = { class PublishPage extends React.PureComponent { camera = null; + scrollView = null; + state = { canPublish: true, canUseCamera: false, @@ -339,11 +341,13 @@ class PublishPage extends React.PureComponent { uri, } = this.state; - if (balance < 0.1) { + if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) { notify({ - message: - "You don't have enough credits to publish this content. Press the blue bar at the top to earn some credits from rewards!", + message: 'Publishing content requires credits. Press the blue bar to get some for free.', }); + if (this.scrollView) { + this.scrollView.scrollTo({ x: 0, y: 0, animated: true }); + } return; } @@ -968,7 +972,7 @@ class PublishPage extends React.PureComponent { this.updateThumbnailUriForMedia(currentMedia); } content = ( - + (this.scrollView = ref)} style={publishStyle.publishDetails}> )} - {balance < 0.1 && } + {balance < Constants.MINIMUM_TRANSACTION_BALANCE && }