fixes per review

This commit is contained in:
Akinwale Ariwodola 2019-10-15 17:55:49 +01:00
parent 682443d9ae
commit a4fad20ff1
3 changed files with 20 additions and 10 deletions

View file

@ -138,6 +138,8 @@ const Constants = {
MORE_PLACEHOLDER: '_more', MORE_PLACEHOLDER: '_more',
TRUE_STRING: 'true', TRUE_STRING: 'true',
MINIMUM_TRANSACTION_BALANCE: 0.1,
}; };
export default Constants; export default Constants;

View file

@ -32,6 +32,8 @@ import channelIconStyle from 'styles/channelIcon';
import seedrandom from 'seedrandom'; import seedrandom from 'seedrandom';
export default class ChannelCreator extends React.PureComponent { export default class ChannelCreator extends React.PureComponent {
scrollView = null;
state = { state = {
autoStyle: null, autoStyle: null,
canSave: true, canSave: true,
@ -389,11 +391,13 @@ export default class ChannelCreator extends React.PureComponent {
website, website,
} = this.state; } = this.state;
if (balance < 0.1) { if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
notify({ notify({
message: message: 'Creating a channel requires credits. Press the blue bar to get some for free.',
"You don't have enough credits to create a channel. Press the blue bar to earn some credits from rewards!",
}); });
if (this.scrollView) {
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
}
return; return;
} }
@ -846,7 +850,7 @@ export default class ChannelCreator extends React.PureComponent {
)} )}
{currentPhase === Constants.PHASE_CREATE && ( {currentPhase === Constants.PHASE_CREATE && (
<ScrollView style={channelCreatorStyle.createChannelContainer}> <ScrollView ref={ref => (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}>
<View style={channelCreatorStyle.imageSelectors}> <View style={channelCreatorStyle.imageSelectors}>
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}> <TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
<Image <Image
@ -891,7 +895,7 @@ export default class ChannelCreator extends React.PureComponent {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
</View> </View>
{balance < 0.1 && <ChannelRewardsDriver navigation={navigation} />} {balance < Constants.MINIMUM_TRANSACTION_BALANCE && <ChannelRewardsDriver navigation={navigation} />}
<View style={channelCreatorStyle.card}> <View style={channelCreatorStyle.card}>
<View style={channelCreatorStyle.textInputLayout}> <View style={channelCreatorStyle.textInputLayout}>

View file

@ -76,6 +76,8 @@ const languages = {
class PublishPage extends React.PureComponent { class PublishPage extends React.PureComponent {
camera = null; camera = null;
scrollView = null;
state = { state = {
canPublish: true, canPublish: true,
canUseCamera: false, canUseCamera: false,
@ -339,11 +341,13 @@ class PublishPage extends React.PureComponent {
uri, uri,
} = this.state; } = this.state;
if (balance < 0.1) { if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
notify({ notify({
message: message: 'Publishing content requires credits. Press the blue bar to get some for free.',
"You don't have enough credits to publish this content. Press the blue bar at the top to earn some credits from rewards!",
}); });
if (this.scrollView) {
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
}
return; return;
} }
@ -968,7 +972,7 @@ class PublishPage extends React.PureComponent {
this.updateThumbnailUriForMedia(currentMedia); this.updateThumbnailUriForMedia(currentMedia);
} }
content = ( content = (
<ScrollView style={publishStyle.publishDetails}> <ScrollView ref={ref => (this.scrollView = ref)} style={publishStyle.publishDetails}>
<TouchableOpacity style={publishStyle.mainThumbnailContainer} onPress={this.handleThumbnailPressed}> <TouchableOpacity style={publishStyle.mainThumbnailContainer} onPress={this.handleThumbnailPressed}>
<FastImage <FastImage
style={publishStyle.mainThumbnail} style={publishStyle.mainThumbnail}
@ -987,7 +991,7 @@ class PublishPage extends React.PureComponent {
</View> </View>
)} )}
</TouchableOpacity> </TouchableOpacity>
{balance < 0.1 && <PublishRewardsDriver navigation={navigation} />} {balance < Constants.MINIMUM_TRANSACTION_BALANCE && <PublishRewardsDriver navigation={navigation} />}
<View style={publishStyle.card}> <View style={publishStyle.card}>
<View style={publishStyle.textInputLayout}> <View style={publishStyle.textInputLayout}>