swapped voting power for resource credits

This commit is contained in:
Nouman Tahir 2021-09-16 12:10:40 +05:00
parent 3f08d3dc66
commit 8bb0e156dd
2 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@ interface Props {
export const ProfileStats = ({data, horizontalMargin}: Props) => { export const ProfileStats = ({data, horizontalMargin}: Props) => {
return ( return (
<View style={{flexDirection:'row', justifyContent:'space-around', marginTop:40, marginHorizontal:horizontalMargin }}> <View style={{flexDirection:'row', justifyContent:'space-around', marginTop:40, marginHorizontal:horizontalMargin }}>
{data.map((item)=><StatItem label={item.label} value={item.value}/>)} {data.map((item)=><StatItem label={item.label} value={item.value && (item.value + (item.suffix || ''))}/>)}
</View> </View>
) )
} }

View File

@ -12,7 +12,7 @@ import { parseReputation } from '../../../../utils/user'
import { default as ROUTES } from '../../../../constants/routeNames'; import { default as ROUTES } from '../../../../constants/routeNames';
import { ActionPanel } from './actionPanel' import { ActionPanel } from './actionPanel'
import moment from 'moment' import moment from 'moment'
import { getTimeFromNow } from '../../../../utils/time' import { getTimeFromNow, getTimeFromNowNative } from '../../../../utils/time'
interface QuickProfileContentProps { interface QuickProfileContentProps {
username:string, username:string,
@ -131,17 +131,17 @@ export const QuickProfileContent = ({
let _avatarUrl = ''; let _avatarUrl = '';
let _about = ''; let _about = '';
let _reputation = 0; let _reputation = 0;
let _created = ''; let _createdData = null;
if (user && !isLoading) { if (user && !isLoading) {
_votingPower = getVotingPower(user).toFixed(1); _votingPower = getVotingPower(user).toFixed(1);
_resourceCredits = getRcPower(user).toFixed(1); _resourceCredits = getRcPower(user).toFixed(0);
_postCount = user.post_count || 0; _postCount = user.post_count || 0;
_avatarUrl = user.avatar || ''; _avatarUrl = user.avatar || '';
_about = user.about?.profile?.about || ''; _about = user.about?.profile?.about || '';
_reputation = parseReputation(user.reputation); _reputation = parseReputation(user.reputation);
_created = getTimeFromNow(user.created) _createdData = getTimeFromNowNative(user.created)
if(follows){ if(follows){
_followerCount = follows.follower_count || 0; _followerCount = follows.follower_count || 0;
_followingCount = follows.following_count || 0 _followingCount = follows.following_count || 0
@ -157,7 +157,7 @@ export const QuickProfileContent = ({
] as StatsData[] ] as StatsData[]
const statsData2 = [ const statsData2 = [
{label:'Voting Power', value:_votingPower, suffix:'%'}, {label:'Resource Credits', value:_resourceCredits, suffix:'%'},
{label:'Reputation', value:_reputation}, {label:'Reputation', value:_reputation},
] as StatsData[] ] as StatsData[]
@ -167,8 +167,8 @@ export const QuickProfileContent = ({
username={username} username={username}
about={_about} about={_about}
avatarUrl={_avatarUrl} avatarUrl={_avatarUrl}
created={_created} created={_createdData}
resourceCredits={_resourceCredits} votingPower={_votingPower}
isLoading={isLoading} isLoading={isLoading}
onPress={_openFullProfile} onPress={_openFullProfile}
/> />