display connected email on About page #327

Merged
akinwale merged 2 commits from about-page-email into master 2018-10-07 16:55:01 +02:00
3 changed files with 39 additions and 6 deletions
Showing only changes of commit fb9c00b80d - Show all commits
app/src
page/about
styles

View file

@ -1,9 +1,14 @@
import { connect } from 'react-redux';
import { selectUserEmail } from 'lbryinc';
import { doFetchAccessToken, selectAccessToken, selectUserEmail } from 'lbryinc';
import AboutPage from './view';
const select = state => ({
accessToken: selectAccessToken(state),
userEmail: selectUserEmail(state),
});
export default connect(select, null)(AboutPage);
const perform = dispatch => ({
fetchAccessToken: () => dispatch(doFetchAccessToken()),
});
export default connect(select, perform)(AboutPage);

View file

@ -28,10 +28,12 @@ class AboutPage extends React.PureComponent {
lbryId: info.installation_id,
});
});
if (!this.props.accessToken) this.props.fetchAccessToken();
}
render() {
const { navigation, userEmail } = this.props;
const { accessToken, navigation, userEmail } = this.props;
const loading = 'Loading...';
const ver = this.state.versionInfo ? this.state.versionInfo : null;
@ -65,9 +67,17 @@ class AboutPage extends React.PureComponent {
</View>
<Text style={aboutStyle.releaseInfoTitle}>App info</Text>
{userEmail && userEmail.trim().length > 0 &&
<View style={aboutStyle.row}>
<View style={aboutStyle.col}><Text style={aboutStyle.text}>Connected Email</Text></View>
<View style={aboutStyle.col}><Text selectable={true} style={aboutStyle.valueText}>{userEmail}</Text></View>
<View style={aboutStyle.verticalRow}>
<View style={aboutStyle.innerRow}>
<View style={aboutStyle.col}><Text style={aboutStyle.text}>Connected Email</Text></View>
<View style={aboutStyle.col}><Text selectable={true} style={aboutStyle.valueText}>{userEmail}</Text></View>
</View>
<View>
<Link
style={aboutStyle.emailPreferencesLink}
href={`http://lbry.io/list/edit/${accessToken}`}
text="Update mailing preferences" />
</View>
</View>}
<View style={aboutStyle.row}>

View file

@ -16,6 +16,18 @@ const aboutStyle = StyleSheet.create({
flexDirection: 'row',
justifyContent: 'space-between'
},
innerRow: {
marginBottom: 4,
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between'
},
verticalRow: {
marginBottom: 1,
backgroundColor: '#f9f9f9',
padding: 16,
flex: 1
},
title: {
color: Colors.LbryGreen,
fontSize: 24,
@ -44,6 +56,12 @@ const aboutStyle = StyleSheet.create({
fontSize: 16,
marginBottom: 24
},
emailPreferencesLink: {
color: Colors.LbryGreen,
fontFamily: 'Metropolis-Regular',
fontSize: 15,
alignSelf: 'flex-end'
},
col: {
alignSelf: 'stretch'
},