From 682443d9ae8258f7d85f8d8b444ed8d59713bd09 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 15 Oct 2019 11:36:01 +0100 Subject: [PATCH] improve ux for insufficient balance for channel creation and publish --- src/component/fileRewardsDriver/view.js | 2 +- src/page/channelCreator/view.js | 23 ++++++++++++++--------- src/page/publish/view.js | 17 ++++++++++++----- src/styles/colors.js | 1 + src/styles/filePage.js | 6 +++++- src/styles/publish.js | 2 +- src/styles/wallet.js | 2 +- 7 files changed, 35 insertions(+), 18 deletions(-) diff --git a/src/component/fileRewardsDriver/view.js b/src/component/fileRewardsDriver/view.js index 5e96a8a..e46a90f 100644 --- a/src/component/fileRewardsDriver/view.js +++ b/src/component/fileRewardsDriver/view.js @@ -9,7 +9,7 @@ class FileRewardsDriver extends React.PureComponent { return ( navigation.navigate('Rewards')}> - + Earn some credits to access this content. ); diff --git a/src/page/channelCreator/view.js b/src/page/channelCreator/view.js index 17a90d7..7cf4457 100644 --- a/src/page/channelCreator/view.js +++ b/src/page/channelCreator/view.js @@ -34,7 +34,7 @@ import seedrandom from 'seedrandom'; export default class ChannelCreator extends React.PureComponent { state = { autoStyle: null, - canSave: false, + canSave: true, claimId: null, currentSelectedValue: Constants.ITEM_ANONYMOUS, currentPhase: null, @@ -161,9 +161,6 @@ export default class ChannelCreator extends React.PureComponent { if (!fetchingChannels) { fetchChannelListMine(); } - if (balance >= 0.1) { - this.setState({ canSave: true }); - } DeviceEventEmitter.addListener('onDocumentPickerFilePicked', this.onFilePicked); DeviceEventEmitter.addListener('onDocumentPickerCanceled', this.onPickerCanceled); @@ -392,6 +389,14 @@ export default class ChannelCreator extends React.PureComponent { website, } = this.state; + if (balance < 0.1) { + notify({ + message: + "You don't have enough credits to create a channel. Press the blue bar to earn some credits from rewards!", + }); + return; + } + if (newChannelName.trim().length === 0 || !isNameValid(newChannelName.substr(1), false)) { notify({ message: 'Your channel name contains invalid characters.' }); return; @@ -528,9 +533,9 @@ export default class ChannelCreator extends React.PureComponent { }; handleNewChannelPress = () => { - const { balance, pushDrawerStack } = this.props; + const { pushDrawerStack } = this.props; pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM); - this.setState({ canSave: balance >= 0.1, currentPhase: Constants.PHASE_CREATE }); + this.setState({ currentPhase: Constants.PHASE_CREATE }); }; handleCreateCancel = () => { @@ -548,7 +553,7 @@ export default class ChannelCreator extends React.PureComponent { resetChannelCreator = () => { this.setState({ - canSave: false, + canSave: true, claimId: null, editMode: false, displayName: null, @@ -610,7 +615,7 @@ export default class ChannelCreator extends React.PureComponent { pushDrawerStack(Constants.DRAWER_ROUTE_CHANNEL_CREATOR_FORM); this.setState({ - canSave: balance >= 0.1, + canSave: true, claimId: channel.claim_id, currentPhase: Constants.PHASE_CREATE, displayName: value && value.title ? value.title : channel.name.substring(1), @@ -1046,7 +1051,7 @@ export default class ChannelCreator extends React.PureComponent {