Comment changes

This commit is contained in:
Mustafa Buyukcelebi 2019-08-23 11:01:15 +03:00
parent 12de7fb619
commit 9578dfa4fd
3 changed files with 12 additions and 20 deletions

View File

@ -53,12 +53,12 @@ class UpvoteContainer extends PureComponent {
} = this.props; } = this.props;
const author = get(content, 'author'); const author = get(content, 'author');
const isVoted = get(content, 'is_voted') const isVoted =
? parseInt(get(content, 'is_voted'), 10) / 10000 get(content, 'is_voted', false) && parseInt(get(content, 'is_voted'), 10) / 10000;
: false; const isDownVoted =
const isDownVoted = get(content, 'is_down_voted') get(content, 'is_down_voted', false) &&
? (parseInt(get(content, 'is_down_voted', false), 10) / 10000) * -1 (parseInt(get(content, 'is_down_voted'), 10) / 10000) * -1;
: false;
const totalPayout = get(content, 'total_payout'); const totalPayout = get(content, 'total_payout');
const isDecinedPayout = get(content, 'is_declined_payout'); const isDecinedPayout = get(content, 'is_declined_payout');
const permlink = get(content, 'permlink'); const permlink = get(content, 'permlink');

View File

@ -224,7 +224,7 @@ class UpvoteView extends Component {
const _percent = `${downvote ? '-' : ''}${(sliderValue * 100).toFixed(0)}%`; const _percent = `${downvote ? '-' : ''}${(sliderValue * 100).toFixed(0)}%`;
const _amount = `$${amount}`; const _amount = `$${amount}`;
const _totalPayout = totalPayout || '0.000'; const _totalPayout = totalPayout || '0.000';
const _sliderColor = downvote ? '#ec8b88' : '#357ce6'; const sliderColor = downvote ? '#ec8b88' : '#357ce6';
return ( return (
<PopoverController> <PopoverController>
@ -249,20 +249,12 @@ class UpvoteView extends Component {
isShow={!isVoting} isShow={!isVoting}
/> />
</View> </View>
) : isDownVoted ? (
<Icon
size={20}
style={[styles.upvoteIcon, { color: '#ec8b88' }]}
active={!isLoggedIn}
iconType="AntDesign"
name="downcircle"
/>
) : ( ) : (
<Icon <Icon
style={[styles.upvoteIcon]} style={[styles.upvoteIcon, isDownVoted && { color: '#ec8b88' }]}
active={!isLoggedIn} active={!isLoggedIn}
iconType={iconType} iconType={isDownVoted ? 'AntDesign' : iconType}
name={iconName} name={isDownVoted ? 'downcircle' : iconName}
/> />
)} )}
</Fragment> </Fragment>
@ -342,7 +334,7 @@ class UpvoteView extends Component {
<Text style={styles.amount}>{_amount}</Text> <Text style={styles.amount}>{_amount}</Text>
<Slider <Slider
style={styles.slider} style={styles.slider}
minimumTrackTintColor={_sliderColor} minimumTrackTintColor={sliderColor}
trackStyle={styles.track} trackStyle={styles.track}
thumbStyle={styles.thumb} thumbStyle={styles.thumb}
thumbTintColor="#007ee5" thumbTintColor="#007ee5"

View File

@ -160,7 +160,7 @@ const isVoted = (activeVotes, currentUserName) => {
const isDownVoted = (activeVotes, currentUserName) => { const isDownVoted = (activeVotes, currentUserName) => {
const result = activeVotes.find( const result = activeVotes.find(
element => element.voter === currentUserName && element.percent < 0, element => get(element, 'voter') === currentUserName && get(element, 'percent') < 0,
); );
if (result) { if (result) {
return result.percent; return result.percent;