Merge pull request #133 from esteemapp/bugfix/side-other

Bugfix/side other
This commit is contained in:
Feruz M 2018-12-03 09:34:06 +02:00 committed by GitHub
commit 8f01c62a69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 125 additions and 130 deletions

View File

@ -772,6 +772,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
0C09B6DC21A3393A00536C9D /* libReactNativeConfig.a */, 0C09B6DC21A3393A00536C9D /* libReactNativeConfig.a */,
94D7D44E21B4402E00476275 /* libReactNativeConfig-tvOS.a */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";

View File

@ -183,7 +183,7 @@ class BasicHeaderView extends Component {
})} })}
/> />
) : ( ) : (
<ActivityIndicator style={styles.textButtonWrapper} /> <ActivityIndicator style={[styles.textButtonWrapper]} />
)} )}
</Fragment> </Fragment>
)} )}

View File

@ -56,7 +56,7 @@ class HeaderContainer extends Component {
} }
const mapStateToProps = state => ({ const mapStateToProps = state => ({
isLoggedIn: state.application.isLoggedIn || false, isLoggedIn: state.application.isLoggedIn,
currentUser: state.account.currentAccount, currentUser: state.account.currentAccount,
}); });

View File

@ -36,26 +36,6 @@ class HeaderView extends Component {
// Component Functions // Component Functions
_getNameOfUser = () => {
const { currentAccount } = this.props;
if (Object.keys(currentAccount).length === 0) return currentAccount.name;
if (Object.keys(currentAccount.about).length === 0) return currentAccount.name;
if (Object.keys(currentAccount.about.profile).length !== 0) {
return currentAccount.about.profile.name;
}
return currentAccount.name;
};
_getUserAvatar = () => {
const { currentAccount } = this.props;
if (Object.keys(currentAccount).length === 0) return DEFAULT_IMAGE;
if (Object.keys(currentAccount.about).length === 0) return DEFAULT_IMAGE;
if (Object.keys(currentAccount.about.profile).length !== 0) {
return { uri: currentAccount.about.profile.profile_image };
}
return DEFAULT_IMAGE;
};
_handleOnCloseSearch = () => { _handleOnCloseSearch = () => {
this.setState({ isSearchModalOpen: false }); this.setState({ isSearchModalOpen: false });
}; };
@ -70,8 +50,10 @@ class HeaderView extends Component {
intl, intl,
} = this.props; } = this.props;
const { isSearchModalOpen } = this.state; const { isSearchModalOpen } = this.state;
const _name = this._getNameOfUser();
const _reputation = getReputation(currentAccount.reputation); const _reputation = getReputation(currentAccount.reputation);
const _avatar = currentAccount.profile_image
? { uri: currentAccount.profile_image }
: DEFAULT_IMAGE;
return ( return (
<SafeAreaView style={[styles.container, isReverse && styles.containerReverse]}> <SafeAreaView style={[styles.container, isReverse && styles.containerReverse]}>
@ -97,17 +79,15 @@ class HeaderView extends Component {
]} ]}
> >
<View> <View>
<FastImage <FastImage style={styles.avatar} source={_avatar} defaultSource={DEFAULT_IMAGE} />
style={styles.avatar}
source={this._getUserAvatar()}
defaultSource={DEFAULT_IMAGE}
/>
</View> </View>
</LinearGradient> </LinearGradient>
</TouchableOpacity> </TouchableOpacity>
{currentAccount && currentAccount.name ? ( {currentAccount && currentAccount.name ? (
<View style={styles.titleWrapper}> <View style={styles.titleWrapper}>
{_name && <Text style={styles.title}>{_name}</Text>} {currentAccount.display_name && (
<Text style={styles.title}>{currentAccount.display_name}</Text>
)}
<Text style={styles.subTitle}> <Text style={styles.subTitle}>
@ @
{currentAccount.name} {currentAccount.name}

View File

@ -1,5 +1,6 @@
import React, { Component, Fragment } from 'react'; import React, { Component, Fragment } from 'react';
import { FlatList, View, ActivityIndicator } from 'react-native'; import { FlatList, View, ActivityIndicator } from 'react-native';
import { injectIntl } from 'react-intl';
// STEEM // STEEM
import { getPostsSummary } from '../../../providers/steem/dsteem'; import { getPostsSummary } from '../../../providers/steem/dsteem';
@ -7,7 +8,8 @@ import { getPostsSummary } from '../../../providers/steem/dsteem';
// COMPONENTS // COMPONENTS
import { PostCard } from '../../postCard'; import { PostCard } from '../../postCard';
import { FilterBar } from '../../filterBar'; import { FilterBar } from '../../filterBar';
import { PostCardPlaceHolder } from '../../basicUIElements'; import { PostCardPlaceHolder, NoPost } from '../../basicUIElements';
import filters from '../../../constants/options/filters.json'; import filters from '../../../constants/options/filters.json';
// Styles // Styles
import styles from './postsStyles'; import styles from './postsStyles';
@ -141,7 +143,9 @@ class PostsView extends Component {
const { const {
refreshing, posts, user, isPostsLoading, isHideImage, refreshing, posts, user, isPostsLoading, isHideImage,
} = this.state; } = this.state;
const { componentId, filterOptions, isLoggedIn } = this.props; const {
componentId, filterOptions, isLoggedIn, intl,
} = this.props;
return ( return (
<Fragment> <Fragment>
@ -180,6 +184,20 @@ class PostsView extends Component {
/> />
) : ( ) : (
<Fragment> <Fragment>
{/* TODO: fix here */}
{/* {
(posts.length <= 0 && (
<NoPost
name={user.name}
text={intl.formatMessage({
id: 'profile.havent_posted',
})}
defaultText={intl.formatMessage({
id: 'profile.login_to_see',
})}
/>
))
} */}
<PostCardPlaceHolder /> <PostCardPlaceHolder />
<PostCardPlaceHolder /> <PostCardPlaceHolder />
</Fragment> </Fragment>
@ -189,4 +207,4 @@ class PostsView extends Component {
} }
} }
export default PostsView; export default injectIntl(PostsView);

View File

@ -13,7 +13,7 @@ import { default as ROUTES } from '../../../constants/routeNames';
// Component // Component
import { SideMenuView } from '..'; import { SideMenuView } from '..';
const DEFAULT_IMAGE = require('../../../assets/esteem.png'); const DEFAULT_IMAGE = require('../../../assets/avatar_default.png');
/* /*
* Props Name Description * Props Name Description
@ -45,6 +45,7 @@ class SideMenuContainer extends Component {
name: 'Add Account', name: 'Add Account',
route: ROUTES.SCREENS.LOGIN, route: ROUTES.SCREENS.LOGIN,
icon: 'plus-square-o', icon: 'plus-square-o',
id: 'add_account',
}); });
this.setState({ accounts }); this.setState({ accounts });
}); });
@ -87,7 +88,7 @@ class SideMenuContainer extends Component {
} }
const mapStateToProps = state => ({ const mapStateToProps = state => ({
isLoggedIn: state.application.isLoggedIn || false, isLoggedIn: state.application.isLoggedIn,
currentAccount: state.account.currentAccount || {}, currentAccount: state.account.currentAccount || {},
}); });

View File

@ -5,6 +5,7 @@ import {
Thumbnail, List, ListItem, Container, Thumbnail, List, ListItem, Container,
} from 'native-base'; } from 'native-base';
import LinearGradient from 'react-native-linear-gradient'; import LinearGradient from 'react-native-linear-gradient';
import FastImage from 'react-native-fast-image';
// Components // Components
import { Icon, IconButton } from '../..'; import { Icon, IconButton } from '../..';
@ -16,7 +17,7 @@ import { default as MENU } from '../../../constants/sideMenuItems';
import styles from './sideMenuStyles'; import styles from './sideMenuStyles';
// Images // Images
const DEFAULT_IMAGE = require('../../../assets/esteem.png'); const DEFAULT_IMAGE = require('../../../assets/avatar_default.png');
const SIDE_MENU_BACKGROUND = require('../../../assets/side_menu_background.png'); const SIDE_MENU_BACKGROUND = require('../../../assets/side_menu_background.png');
class SideMenuView extends Component { class SideMenuView extends Component {
@ -28,54 +29,40 @@ class SideMenuView extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
menuItems: [], menuItems: props.isLoggedIn ? MENU.AUTH_MENU_ITEMS : MENU.NO_AUTH_MENU_ITEMS,
isAddAccountIconActive: false, isAddAccountIconActive: false,
}; };
} }
// Component Life Cycles // Component Life Cycles
componentWillMount() { componentWillReceiveProps(nextProps) {
const { isLoggedIn } = this.props; const { isLoggedIn } = this.props;
this.setState({ if (isLoggedIn !== nextProps.isLoggedIn) {
menuItems: isLoggedIn ? MENU.AUTH_MENU_ITEMS : MENU.NO_AUTH_MENU_ITEMS, this._setMenuItems(nextProps.isLoggedIn);
}); }
} }
// Component Functions // Component Functions
_handleOnPressAddAccountIcon = () => { _handleOnPressAddAccountIcon = () => {
const { isAddAccountIconActive } = this.state;
const { isLoggedIn, accounts } = this.props; const { isLoggedIn, accounts } = this.props;
const { isAddAccountIconActive } = this.state;
if (!isAddAccountIconActive) { if (!isAddAccountIconActive) {
this.setState({ menuItems: accounts, isAddAccountIconActive: !isAddAccountIconActive }); this.setState({ menuItems: accounts });
} else { } else {
this._setMenuItems(isLoggedIn);
}
this.setState({ isAddAccountIconActive: !isAddAccountIconActive });
};
_setMenuItems = (isLoggedIn) => {
this.setState({ this.setState({
menuItems: isLoggedIn ? MENU.AUTH_MENU_ITEMS : MENU.NO_AUTH_MENU_ITEMS, menuItems: isLoggedIn ? MENU.AUTH_MENU_ITEMS : MENU.NO_AUTH_MENU_ITEMS,
isAddAccountIconActive: !isAddAccountIconActive,
}); });
}
};
_getNameOfUser = () => {
const { currentAccount } = this.props;
if (Object.keys(currentAccount).length === 0) return currentAccount.name;
if (Object.keys(currentAccount.about).length === 0) return currentAccount.name;
if (Object.keys(currentAccount.about.profile).length !== 0) {
return currentAccount.about.profile.name;
}
return currentAccount.name;
};
_getUserAvatar = () => {
const { currentAccount } = this.props;
if (Object.keys(currentAccount).length === 0) return DEFAULT_IMAGE;
if (Object.keys(currentAccount.about).length === 0) return DEFAULT_IMAGE;
if (Object.keys(currentAccount.about.profile).length !== 0) {
return { uri: currentAccount.about.profile.profile_image };
}
return DEFAULT_IMAGE;
}; };
render() { render() {
@ -83,6 +70,9 @@ class SideMenuView extends Component {
navigateToRoute, currentAccount, isLoggedIn, switchAccount, intl, navigateToRoute, currentAccount, isLoggedIn, switchAccount, intl,
} = this.props; } = this.props;
const { menuItems, isAddAccountIconActive } = this.state; const { menuItems, isAddAccountIconActive } = this.state;
const _avatar = currentAccount.profile_image
? { uri: currentAccount.profile_image }
: DEFAULT_IMAGE;
return ( return (
<Container style={styles.container}> <Container style={styles.container}>
@ -98,9 +88,15 @@ class SideMenuView extends Component {
> >
{isLoggedIn && ( {isLoggedIn && (
<View style={styles.headerContentView}> <View style={styles.headerContentView}>
<Thumbnail style={styles.userAvatar} source={this._getUserAvatar()} /> <FastImage
style={styles.userAvatar}
source={_avatar}
defaultSource={DEFAULT_IMAGE}
/>
<View style={styles.userInfoView}> <View style={styles.userInfoView}>
<Text style={styles.username}>{this._getNameOfUser()}</Text> {currentAccount.display_name && (
<Text style={styles.username}>{currentAccount.display_name}</Text>
)}
<Text style={styles.usernick}>{`@${currentAccount.name}`}</Text> <Text style={styles.usernick}>{`@${currentAccount.name}`}</Text>
</View> </View>
<View style={styles.addAccountIconView}> <View style={styles.addAccountIconView}>
@ -124,7 +120,7 @@ class SideMenuView extends Component {
<List <List
itemDivider={false} itemDivider={false}
dataArray={menuItems} dataArray={menuItems}
renderRow={item => ( renderRow={(item, i) => (
<ListItem <ListItem
noBorder noBorder
style={styles.listItem} style={styles.listItem}
@ -143,7 +139,13 @@ class SideMenuView extends Component {
<Thumbnail small style={styles.otherUserAvatar} source={item.image} /> <Thumbnail small style={styles.otherUserAvatar} source={item.image} />
)} )}
<Text style={styles.listItemText}> <Text style={styles.listItemText}>
{intl.formatMessage({ id: `side_menu.${item.id}` })} {isAddAccountIconActive
? menuItems[menuItems.length - 1].id === item.id
? intl.formatMessage({ id: `side_menu.${item.id}` })
: item.name
:
intl.formatMessage({ id: `side_menu.${item.id}` })
}
</Text> </Text>
</ListItem> </ListItem>
)} )}

View File

@ -44,6 +44,7 @@
"voting_power": "Voting power", "voting_power": "Voting power",
"login_to_see": "Login to see!", "login_to_see": "Login to see!",
"havent_commented": "haven't commented anything yet", "havent_commented": "haven't commented anything yet",
"havent_posted": "haven't posted anything yet",
"steem_power": "Steem Power", "steem_power": "Steem Power",
"next_power_text": "Next power down is in", "next_power_text": "Next power down is in",
"days": "days", "days": "days",

View File

@ -41,6 +41,7 @@
"unclaimed_rewards": "Sahipsiz Ödül", "unclaimed_rewards": "Sahipsiz Ödül",
"login_to_see": "Giriş yap ve gör!", "login_to_see": "Giriş yap ve gör!",
"havent_commented": "henüz yorum yapmadı", "havent_commented": "henüz yorum yapmadı",
"havent_posted": "henüz post paylasmadi",
"full_in": "Full in", "full_in": "Full in",
"hours": "saat", "hours": "saat",
"voting_power": "Oylama güçü", "voting_power": "Oylama güçü",

View File

@ -43,6 +43,12 @@ const authMenuItems = [
icon: 'gear', icon: 'gear',
id: 'settings', id: 'settings',
}, },
{
name: 'Add Account',
route: ROUTES.SCREENS.LOGIN,
icon: 'plus-square-o',
id: 'add_account',
},
]; ];
const noAuthMenuItems = [ const noAuthMenuItems = [

View File

@ -1,8 +1,3 @@
/* eslint-disable no-console */
// TestNet
// const client = new Client("https://testnet.steem.vc", { chainId: "79276aea5d4877d9a25892eaa01b0adf019d3e5cb12a97478df3298ccdd01673", addressPrefix: "STX" });
import { Client, PrivateKey } from 'dsteem'; import { Client, PrivateKey } from 'dsteem';
import { AsyncStorage } from 'react-native'; import { AsyncStorage } from 'react-native';
@ -16,6 +11,8 @@ import {
parsePosts, parsePost, parseComments, parsePostsSummary, parsePosts, parsePost, parseComments, parsePostsSummary,
} from '../../utils/postParser'; } from '../../utils/postParser';
import { getName, getAvatar } from '../../utils/user';
let rewardFund = null; let rewardFund = null;
let medianPrice = null; let medianPrice = null;
let client = new Client('https://api.steemit.com'); let client = new Client('https://api.steemit.com');
@ -29,6 +26,7 @@ getClient = async () => {
client = new Client(`${server}`); client = new Client(`${server}`);
} }
}; };
getClient(); getClient();
/** /**
@ -88,6 +86,9 @@ export const getUser = async (user) => {
); );
account[0].about = account[0].json_metadata && JSON.parse(account[0].json_metadata); account[0].about = account[0].json_metadata && JSON.parse(account[0].json_metadata);
account[0].profile_image = getAvatar(account[0].about);
account[0].display_name = getName(account[0].about);
return account[0]; return account[0];
} catch (error) { } catch (error) {
return Promise.reject(error); return Promise.reject(error);
@ -191,9 +192,8 @@ export const ignoreUser = (data, postingKey) => {
let key; let key;
try { try {
key = PrivateKey.fromString(postingKey); key = PrivateKey.fromString(postingKey);
} catch (error) { } catch (error) {}
console.log(error);
}
const json = { const json = {
id: 'follow', id: 'follow',
json: JSON.stringify([ json: JSON.stringify([
@ -212,11 +212,9 @@ export const ignoreUser = (data, postingKey) => {
client.broadcast client.broadcast
.json(json, key) .json(json, key)
.then((result) => { .then((result) => {
console.log(result);
resolve(result); resolve(result);
}) })
.catch((err) => { .catch((err) => {
console.log(err);
reject(err); reject(err);
}); });
}); });
@ -350,7 +348,7 @@ export const upvoteAmount = async (input) => {
medianPrice = res; medianPrice = res;
}) })
.catch((err) => { .catch((err) => {
console.log(err); // reject(err);
}); });
} }
@ -366,11 +364,9 @@ export const transferToken = (data, activeKey) => {
client.broadcast client.broadcast
.transfer(data, key) .transfer(data, key)
.then((result) => { .then((result) => {
console.log(result);
resolve(result); resolve(result);
}) })
.catch((err) => { .catch((err) => {
console.log(err);
reject(err); reject(err);
}); });
}); });
@ -381,7 +377,6 @@ export const followUser = (data, postingKey) => {
try { try {
key = PrivateKey.fromString(postingKey); key = PrivateKey.fromString(postingKey);
} catch (error) { } catch (error) {
console.log(error);
} }
const json = { const json = {
id: 'follow', id: 'follow',
@ -401,11 +396,9 @@ export const followUser = (data, postingKey) => {
client.broadcast client.broadcast
.json(json, key) .json(json, key)
.then((result) => { .then((result) => {
console.log(result);
resolve(result); resolve(result);
}) })
.catch((err) => { .catch((err) => {
console.log(err);
reject(err); reject(err);
}); });
}); });
@ -416,7 +409,6 @@ export const unfollowUser = (data, postingKey) => {
try { try {
key = PrivateKey.fromString(postingKey); key = PrivateKey.fromString(postingKey);
} catch (error) { } catch (error) {
console.log(error);
} }
const json = { const json = {
id: 'follow', id: 'follow',
@ -436,11 +428,9 @@ export const unfollowUser = (data, postingKey) => {
client.broadcast client.broadcast
.json(json, key) .json(json, key)
.then((result) => { .then((result) => {
console.log(result);
resolve(result); resolve(result);
}) })
.catch((err) => { .catch((err) => {
console.log(err);
reject(err); reject(err);
}); });
}); });
@ -451,7 +441,6 @@ export const delegate = (data, activeKey) => {
try { try {
key = PrivateKey.fromString(activeKey); key = PrivateKey.fromString(activeKey);
} catch (error) { } catch (error) {
console.log(error);
} }
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -461,7 +450,6 @@ export const delegate = (data, activeKey) => {
resolve(result); resolve(result);
}) })
.catch((err) => { .catch((err) => {
console.log(err);
reject(err); reject(err);
}); });
}); });
@ -472,7 +460,6 @@ export const globalProps = async () => {
const globalProperties = await client.database.getDynamicGlobalProperties(); const globalProperties = await client.database.getDynamicGlobalProperties();
return globalProperties; return globalProperties;
} catch (error) { } catch (error) {
console.log(error);
return error; return error;
} }
}; };
@ -482,7 +469,6 @@ export const getFeedHistory = async () => {
const feedHistory = await client.database.call('get_feed_history'); const feedHistory = await client.database.call('get_feed_history');
return feedHistory; return feedHistory;
} catch (error) { } catch (error) {
console.log(error);
return error; return error;
} }
}; };
@ -491,9 +477,7 @@ export const transferToVesting = (data, activeKey) => {
let key; let key;
try { try {
key = PrivateKey.fromString(activeKey); key = PrivateKey.fromString(activeKey);
console.log(key);
} catch (error) { } catch (error) {
console.log(error);
} }
const op = [ const op = [
@ -512,7 +496,6 @@ export const transferToVesting = (data, activeKey) => {
resolve(result); resolve(result);
}) })
.catch((error) => { .catch((error) => {
console.log(error);
reject(error); reject(error);
}); });
}); });
@ -522,9 +505,7 @@ export const withdrawVesting = (data, activeKey) => {
let key; let key;
try { try {
key = PrivateKey.fromString(activeKey); key = PrivateKey.fromString(activeKey);
console.log(key);
} catch (error) { } catch (error) {
console.log(error);
} }
const op = [ const op = [
@ -542,7 +523,6 @@ export const withdrawVesting = (data, activeKey) => {
resolve(result); resolve(result);
}) })
.catch((error) => { .catch((error) => {
console.log(error);
reject(error); reject(error);
}); });
}); });
@ -554,7 +534,6 @@ export const postContent = (data, postingKey) => {
try { try {
key = PrivateKey.fromString(postingKey); key = PrivateKey.fromString(postingKey);
} catch (error) { } catch (error) {
console.log(error);
} }
const post = { const post = {
@ -595,7 +574,6 @@ export const postContent = (data, postingKey) => {
resolve(result); resolve(result);
}) })
.catch((error) => { .catch((error) => {
console.log(error);
reject(error); reject(error);
}); });
}); });

View File

@ -63,6 +63,7 @@ class ApplicationContainer extends Component {
_getUserData = () => { _getUserData = () => {
const { dispatch } = this.props; const { dispatch } = this.props;
getAuthStatus().then((res) => { getAuthStatus().then((res) => {
if (res.isLoggedIn) { if (res.isLoggedIn) {
getUserData().then((response) => { getUserData().then((response) => {
@ -77,9 +78,9 @@ class ApplicationContainer extends Component {
const realmObject = response[response.length - 1]; const realmObject = response[response.length - 1];
accountData.realm_object = realmObject; accountData.realm_object = realmObject;
dispatch(login());
dispatch(updateCurrentAccount(accountData)); dispatch(updateCurrentAccount(accountData));
dispatch(activeApplication()); dispatch(activeApplication());
dispatch(login());
if (__DEV__ === false) { if (__DEV__ === false) {
dispatch(openPinCodeModal()); dispatch(openPinCodeModal());
} }

View File

@ -1,5 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Alert } from 'react-native';
import ImagePicker from 'react-native-image-crop-picker'; import ImagePicker from 'react-native-image-crop-picker';
// Services and Actions // Services and Actions
@ -217,11 +218,12 @@ class EditorContainer extends Component {
postContent(post, postingKey) postContent(post, postingKey)
.then((result) => { .then((result) => {
alert('Your post succesfully shared'); Alert.alert('Success', 'Your reply has been submitted!');
navigation.navigate(ROUTES.SCREENS.HOME); navigation.navigate(ROUTES.SCREENS.HOME);
}) })
.catch((error) => { .catch((error) => {
alert(`Opps! there is a problem${error}`); Alert.alert('Failed!', 'Your reply failed to submit!');
this.setState({ isPostSending: false }); this.setState({ isPostSending: false });
}); });
} }

View File

@ -1,5 +1,5 @@
import React, { PureComponent, Fragment } from 'react'; import React, { PureComponent, Fragment } from 'react';
import { View } from 'react-native'; import { View, Alert } from 'react-native';
import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view'; import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';

View File

@ -128,16 +128,6 @@ class PinCodeContainer extends Component {
} }
}); });
_getUserAvatar = () => {
const { currentAccount } = this.props;
if (Object.keys(currentAccount).length === 0) return DEFAULT_IMAGE;
if (Object.keys(currentAccount.about).length === 0) return DEFAULT_IMAGE;
if (Object.keys(currentAccount.about.profile).length !== 0) {
return { uri: currentAccount.about.profile.profile_image };
}
return DEFAULT_IMAGE;
};
render() { render() {
const { currentAccount, intl } = this.props; const { currentAccount, intl } = this.props;
const { informationText, isExistUser } = this.state; const { informationText, isExistUser } = this.state;
@ -147,7 +137,7 @@ class PinCodeContainer extends Component {
setPinCode={this._setPinCode} setPinCode={this._setPinCode}
showForgotButton={isExistUser} showForgotButton={isExistUser}
username={currentAccount ? currentAccount.name : 'unknow'} username={currentAccount ? currentAccount.name : 'unknow'}
avatar={this._getUserAvatar()} avatar={currentAccount.profile_image}
intl={intl} intl={intl}
/> />
); );

View File

@ -22,3 +22,17 @@ export const getReputation = (input) => {
return Math.floor(reputationLevel); return Math.floor(reputationLevel);
}; };
/* eslint-disable */
export const getName = about => {
if (about['profile'] && about['profile']['name']) {
return about['profile']['name'];
}
return null;
};
export const getAvatar = about => {
if (about['profile'] && about['profile']['profile_image']) {
return about['profile']['profile_image'];
}
return null;
};