- The fix is in! Linty fresh and pretty...
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Text, TextInput, View } from 'react-native';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button, Text, TextInput, View } from 'react-native';
|
||||
import { Avatar } from 'react-native-elements';
|
||||
|
||||
import { getEmailAvailability, getNomAvailability } from '../api/profile.js';
|
||||
import EditNomDeBid from './EditNomDeBid.container.js';
|
||||
|
||||
import styles from './Profile.styles.js';
|
||||
|
||||
const STRINGS = {
|
||||
EDIT: 'Edit profile',
|
||||
EDIT: 'Edit profile',
|
||||
};
|
||||
|
||||
export default function ViewProfile({
|
||||
@@ -16,16 +17,22 @@ export default function ViewProfile({
|
||||
editProfileAction,
|
||||
email,
|
||||
fullName,
|
||||
generatedNomDeBid,
|
||||
initials,
|
||||
isGeneratedNomDeBid,
|
||||
isRegisteredAccount,
|
||||
nomDeBid,
|
||||
phones,
|
||||
}) {
|
||||
const addressesCount = addresses.length;
|
||||
const phonesCount = phones.length;
|
||||
const _getSavedText = (count) => `${count} saved`;
|
||||
const addressesCountString = _getSavedText(addresses.length);
|
||||
const phonesCountString = _getSavedText(phones.length);
|
||||
|
||||
const [isEditingNom, setEditNom] = useState(false);
|
||||
|
||||
const addressesTitle = 'addresses';
|
||||
const emailTitle = 'email';
|
||||
const numbersTitle = 'numbers';
|
||||
|
||||
return (
|
||||
<View style={styles.profileFormWrap}>
|
||||
<View style={styles.avatarWrap}>
|
||||
@@ -39,33 +46,30 @@ export default function ViewProfile({
|
||||
<Text style={styles.fullName}>{fullName}</Text>
|
||||
<View style={styles.nomWrap}>
|
||||
{isEditingNom ? (
|
||||
<EditNomDeBid
|
||||
<EditNomDeBid isStandalone />
|
||||
) : (
|
||||
<Text style={styles.nom}>{nomDeBid}</Text>
|
||||
{generatedNomDeBid && (
|
||||
<Button
|
||||
title="Set bidding alias"
|
||||
onPress={() => setEditNom(true)}
|
||||
/>
|
||||
)}
|
||||
<Text style={styles.nom}>{nomDeBid}</Text>
|
||||
)}
|
||||
{!isEditingNom && isGeneratedNomDeBid && isRegisteredAccount && (
|
||||
<Button title="Set bidding alias" onPress={() => setEditNom(true)} />
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
<View style={styles.emailWrap}>
|
||||
<Text style={styles.label}>email</Text>
|
||||
<text style={styles.value}>{email}</Text>
|
||||
<Text style={styles.label}>{emailTitle}</Text>
|
||||
<Text style={styles.value}>{email}</Text>
|
||||
</View>
|
||||
<View style={styles.phonesWrap}>
|
||||
<Text style={styles.label}>numbers</Text>
|
||||
<Text style={styles.value}>{`${phonesCount} saved`}
|
||||
<Text style={styles.label}>{numbersTitle}</Text>
|
||||
<Text style={styles.value}>{phonesCountString}</Text>
|
||||
</View>
|
||||
<View style={styles.addressesWrap}>
|
||||
<Text style={styles.label}>addresses</Text>
|
||||
<Text style={styles.value}>{`${addressesCount} saved`}
|
||||
<Text style={styles.label}>{addressesTitle}</Text>
|
||||
<Text style={styles.value}>{addressesCountString}</Text>
|
||||
</View>
|
||||
{editProfileAction !== null && (
|
||||
<View style={styles.register}>
|
||||
<Button title={STRINGS.EDIT} onPress={editProfile} />
|
||||
<Button title={STRINGS.EDIT} onPress={editProfileAction} />
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
@@ -78,8 +82,9 @@ ViewProfile.propTypes = {
|
||||
editProfileAction: PropTypes.func,
|
||||
email: PropTypes.string,
|
||||
fullName: PropTypes.string,
|
||||
generatedNomDeBid: PropTypes.bool,
|
||||
initials: PropTypes.string,
|
||||
isGeneratedNomDeBid: PropTypes.bool,
|
||||
isRegisteredAccount: PropTypes.bool,
|
||||
nomDeBid: PropTypes.string,
|
||||
phones: PropTypes.array,
|
||||
};
|
||||
@@ -90,13 +95,9 @@ ViewProfile.defaultProps = {
|
||||
editProfileAction: null,
|
||||
email: null,
|
||||
fullName: null,
|
||||
generatedNomDeBid: false,
|
||||
initials: null,
|
||||
isGeneratedNomDeBid: false,
|
||||
isRegisteredAccount: false,
|
||||
nomDeBid: null,
|
||||
phones: [],
|
||||
};
|
||||
|
||||
return (
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user