Repost creation #133

Merged
akinwale merged 7 commits from repost-creation into master 2020-03-20 14:21:18 +01:00
2 changed files with 81 additions and 56 deletions
Showing only changes of commit 744680d78d - Show all commits

View file

@ -15,11 +15,12 @@ export default class ModalRepostView extends React.PureComponent {
depositAmountInput; depositAmountInput;
state = { state = {
repostName: null,
channelName: null, channelName: null,
creditsInputFocused: false, creditsInputFocused: false,
depositAmount: '0.1', depositAmount: '0.1',
repostName: null,
repostStarted: false, repostStarted: false,
showAdvanced: false,
}; };
componentDidMount() { componentDidMount() {
@ -92,6 +93,7 @@ export default class ModalRepostView extends React.PureComponent {
const { balance, channels, reposting, title, onCancelPress, onOverlayPress } = this.props; const { balance, channels, reposting, title, onCancelPress, onOverlayPress } = this.props;
const canRepost = !!this.state.channelName && !!this.state.repostName; const canRepost = !!this.state.channelName && !!this.state.repostName;
const channelsLoaded = channels && channels.length > 0; const channelsLoaded = channels && channels.length > 0;
const processing = this.state.repostStarted || reposting || !channelsLoaded;
return ( return (
<TouchableOpacity style={modalStyle.overlay} activeOpacity={1} onPress={onOverlayPress}> <TouchableOpacity style={modalStyle.overlay} activeOpacity={1} onPress={onOverlayPress}>
@ -118,6 +120,8 @@ export default class ModalRepostView extends React.PureComponent {
onChannelChange={this.handleChannelChange} onChannelChange={this.handleChannelChange}
/> />
{this.state.showAdvanced && (
<View>
<Text style={modalRepostStyle.label}>{__('Name')}</Text> <Text style={modalRepostStyle.label}>{__('Name')}</Text>
<View style={modalRepostStyle.nameRow}> <View style={modalRepostStyle.nameRow}>
<TextInput <TextInput
@ -159,12 +163,12 @@ export default class ModalRepostView extends React.PureComponent {
)} )}
</View> </View>
</View> </View>
{(this.state.repostStarted || reposting || !channelsLoaded) && (
<ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />
)}
</View> </View>
</View>
)}
<View style={modalRepostStyle.buttonRow}> <View style={modalRepostStyle.buttonRow}>
{!processing && (
<Link <Link
style={modalRepostStyle.cancelLink} style={modalRepostStyle.cancelLink}
text={__('Cancel')} text={__('Cancel')}
@ -172,6 +176,18 @@ export default class ModalRepostView extends React.PureComponent {
if (onCancelPress) onCancelPress(); if (onCancelPress) onCancelPress();
}} }}
/> />
)}
{processing && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
<View style={modalRepostStyle.rightButtonRow}>
<Link
style={modalRepostStyle.advancedLink}
text={this.state.showAdvanced ? __('Hide advanced') : __('Show advanced')}
onPress={() => {
this.setState({ showAdvanced: !this.state.showAdvanced });
}}
/>
<Button <Button
text={__('Repost')} text={__('Repost')}
style={modalRepostStyle.button} style={modalRepostStyle.button}
@ -180,6 +196,7 @@ export default class ModalRepostView extends React.PureComponent {
/> />
</View> </View>
</View> </View>
</View>
</TouchableOpacity> </TouchableOpacity>
</TouchableOpacity> </TouchableOpacity>
); );

View file

@ -44,6 +44,10 @@ const modalRepostStyle = StyleSheet.create({
cancelLink: { cancelLink: {
color: Colors.Grey, color: Colors.Grey,
}, },
advancedLink: {
color: Colors.Grey,
marginRight: 16,
},
balance: { balance: {
alignItems: 'center', alignItems: 'center',
flexDirection: 'row', flexDirection: 'row',
@ -76,6 +80,10 @@ const modalRepostStyle = StyleSheet.create({
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center', alignItems: 'center',
}, },
rightButtonRow: {
flexDirection: 'row',
alignItems: 'center',
},
input: { input: {
fontFamily: 'Inter-Regular', fontFamily: 'Inter-Regular',
fontSize: 14, fontSize: 14,