mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-02 11:15:35 +03:00
tiny UI refinements
This commit is contained in:
parent
620ea7df4d
commit
d744da0fec
@ -736,10 +736,11 @@
|
|||||||
"refer":{
|
"refer":{
|
||||||
"refer_earn": "Refer & Earn",
|
"refer_earn": "Refer & Earn",
|
||||||
"refer": "Refer",
|
"refer": "Refer",
|
||||||
"rewarded": "Rewarded",
|
"rewarded": "Referral points rewarded",
|
||||||
"not_rewarded": "Not Rewarded",
|
"not_rewarded": "Referral reward pending",
|
||||||
"delegate_hp": "Delegate HP",
|
"delegate_hp": "Delegate HP",
|
||||||
"earned": "Points Earned",
|
"earned": "Points Earned",
|
||||||
"pending": "Pending Points"
|
"pending": "Pending Points",
|
||||||
|
"empty_text": "Referrals let you earn upto 100 Ecency points per referral. Refer your loved ones today and earn free points",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import { FlatList, Share, Text, TouchableOpacity, View } from 'react-native';
|
import { ActivityIndicator, FlatList, Share, Text, TouchableOpacity, View } from 'react-native';
|
||||||
import { BasicHeader, Icon, MainButton, PopoverWrapper, UserListItem } from '../../components';
|
import { BasicHeader, Icon, ListPlaceHolder, MainButton, PopoverWrapper, UserListItem } from '../../components';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
// utils
|
// utils
|
||||||
import { getReferralsList } from '../../providers/ecency/ecency';
|
import { getReferralsList } from '../../providers/ecency/ecency';
|
||||||
@ -23,6 +23,8 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
const [referralsList, setReferralsList] = useState<Referral[]>([]);
|
const [referralsList, setReferralsList] = useState<Referral[]>([]);
|
||||||
const [earnedPoints, setEarnedPoint] = useState(0);
|
const [earnedPoints, setEarnedPoint] = useState(0);
|
||||||
const [pendingPoints, setPendingPoint] = useState(0);
|
const [pendingPoints, setPendingPoint] = useState(0);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
_getReferralsList();
|
_getReferralsList();
|
||||||
}, []);
|
}, []);
|
||||||
@ -30,8 +32,9 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
console.log('-----referralsList----- : ', referralsList);
|
console.log('-----referralsList----- : ', referralsList);
|
||||||
|
|
||||||
const _getReferralsList = async () => {
|
const _getReferralsList = async () => {
|
||||||
// const referralsListData = await getReferralsList('good-karma'); // using 'good-karma' name for testing, use original name here
|
setLoading(true);
|
||||||
const referralsListData = await getReferralsList(currentAccount.name);
|
const referralsListData = await getReferralsList('good-karma'); // using 'good-karma' name for testing, use original name here
|
||||||
|
// const referralsListData = await getReferralsList(currentAccount.name);
|
||||||
let rewardedPoints = 0;
|
let rewardedPoints = 0;
|
||||||
let unrewardedPoint = 0;
|
let unrewardedPoint = 0;
|
||||||
referralsListData.forEach((value) => {
|
referralsListData.forEach((value) => {
|
||||||
@ -41,6 +44,7 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
unrewardedPoint += 100;
|
unrewardedPoint += 100;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
setLoading(false);
|
||||||
setReferralsList(referralsListData as any);
|
setReferralsList(referralsListData as any);
|
||||||
setEarnedPoint(rewardedPoints);
|
setEarnedPoint(rewardedPoints);
|
||||||
setPendingPoint(unrewardedPoint);
|
setPendingPoint(unrewardedPoint);
|
||||||
@ -74,7 +78,7 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
</View>
|
</View>
|
||||||
<View style={styles.pendingWrapper}>
|
<View style={styles.pendingWrapper}>
|
||||||
<Text style={styles.points}>{pendingPoints}</Text>
|
<Text style={styles.points}>{pendingPoints}</Text>
|
||||||
<Text style={styles.pendingText}>
|
<Text style={styles.earendText}>
|
||||||
{intl.formatMessage({
|
{intl.formatMessage({
|
||||||
id: 'refer.pending',
|
id: 'refer.pending',
|
||||||
})}
|
})}
|
||||||
@ -95,7 +99,7 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
})}
|
})}
|
||||||
</Text>
|
</Text>
|
||||||
<View style={styles.mainIconWrapper}>
|
<View style={styles.mainIconWrapper}>
|
||||||
<Icon name="share-social-outline" iconType="Ionicons" color="#fff" size={28} />
|
<Icon name="share-social" iconType="Ionicons" color="#fff" size={28} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</MainButton>
|
</MainButton>
|
||||||
@ -133,6 +137,10 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const _renderEmptyView = (
|
||||||
|
loading ? (<ListPlaceHolder />)
|
||||||
|
:(<Text style={styles.emptyText}>{intl.formatMessage({id:'refer.empty_text'})}</Text>));
|
||||||
|
|
||||||
const _renderReferralListItem = ({ item, index }: { item: Referral; index: number }) => {
|
const _renderReferralListItem = ({ item, index }: { item: Referral; index: number }) => {
|
||||||
return (
|
return (
|
||||||
<UserListItem
|
<UserListItem
|
||||||
@ -156,7 +164,7 @@ const ReferScreen = ({ navigation }) => {
|
|||||||
// refreshing={refreshing}
|
// refreshing={refreshing}
|
||||||
keyExtractor={(item, index) => `item ${index}`}
|
keyExtractor={(item, index) => `item ${index}`}
|
||||||
removeClippedSubviews={false}
|
removeClippedSubviews={false}
|
||||||
// ListEmptyComponent={<ListPlaceHolder />}
|
ListEmptyComponent={_renderEmptyView}
|
||||||
// onRefresh={() => fetchLeaderBoard()}
|
// onRefresh={() => fetchLeaderBoard()}
|
||||||
renderItem={_renderReferralListItem}
|
renderItem={_renderReferralListItem}
|
||||||
contentContainerStyle={styles.listContentContainer}
|
contentContainerStyle={styles.listContentContainer}
|
||||||
|
@ -10,10 +10,10 @@ export default EStyleSheet.create({
|
|||||||
marginBottom: 16,
|
marginBottom: 16,
|
||||||
},
|
},
|
||||||
earnedWrapper: {
|
earnedWrapper: {
|
||||||
marginRight: 8,
|
marginRight: 32,
|
||||||
},
|
},
|
||||||
pendingWrapper: {
|
pendingWrapper: {
|
||||||
marginLeft: 8,
|
marginLeft: 32,
|
||||||
},
|
},
|
||||||
points: {
|
points: {
|
||||||
color: '$primaryBlue',
|
color: '$primaryBlue',
|
||||||
@ -29,11 +29,13 @@ export default EStyleSheet.create({
|
|||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
marginTop: 5,
|
marginTop: 5,
|
||||||
},
|
},
|
||||||
pendingText: {
|
emptyText:{
|
||||||
color: '$primaryDarkGray',
|
color: '$primaryDarkText',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
marginTop: 5,
|
marginTop: 5,
|
||||||
|
padding: 32,
|
||||||
|
textAlign:'center'
|
||||||
},
|
},
|
||||||
mainButton: {
|
mainButton: {
|
||||||
marginTop: 16,
|
marginTop: 16,
|
||||||
|
Loading…
Reference in New Issue
Block a user