diff --git a/src/components/basicUIElements/view/textWithIcon/textWithIconView.js b/src/components/basicUIElements/view/textWithIcon/textWithIconView.js index 7d11a5112..5e7d4ccfd 100644 --- a/src/components/basicUIElements/view/textWithIcon/textWithIconView.js +++ b/src/components/basicUIElements/view/textWithIcon/textWithIconView.js @@ -4,19 +4,27 @@ import { Icon } from '../../../icon'; import styles from './textWithIconStyles'; const TextWithIcon = ({ - iconName, text, isClickable, onPress, iconStyle, iconType, + iconName, text, isClickable, onPress, iconStyle, iconType, iconSize, }) => ( {isClickable || onPress ? ( onPress && onPress()}> - + {text} ) : ( - + {text} )} diff --git a/src/components/basicUIElements/view/walletLineItem/walletLineItemView.js b/src/components/basicUIElements/view/walletLineItem/walletLineItemView.js index 289d273cd..ee6d41d76 100644 --- a/src/components/basicUIElements/view/walletLineItem/walletLineItemView.js +++ b/src/components/basicUIElements/view/walletLineItem/walletLineItemView.js @@ -54,7 +54,7 @@ const WalletLineItem = ({ )} - {description && ( + {!!description && ( {description} )} diff --git a/src/components/collapsibleCard/view/collapsibleCardView.js b/src/components/collapsibleCard/view/collapsibleCardView.js index 1149cdc88..d36ead464 100644 --- a/src/components/collapsibleCard/view/collapsibleCardView.js +++ b/src/components/collapsibleCard/view/collapsibleCardView.js @@ -57,9 +57,9 @@ class CollapsibleCardView extends PureComponent { _getMinValue = () => 0; _toggleOnPress = () => { - const { handleOnExpanded } = this.props; + const { handleOnExpanded, moreHeight } = this.props; Animated.timing(this.anime.height, { - toValue: this.anime.expanded ? this._getMinValue() : this._getMaxValue(), + toValue: this.anime.expanded ? this._getMinValue() : this._getMaxValue() + moreHeight, duration: 200, }).start(); this.anime.expanded = !this.anime.expanded; diff --git a/src/components/postCard/view/postCardView.js b/src/components/postCard/view/postCardView.js index 44f4cdae3..f0d51373e 100644 --- a/src/components/postCard/view/postCardView.js +++ b/src/components/postCard/view/postCardView.js @@ -5,6 +5,9 @@ import { PostHeaderDescription } from '../../postElements'; import { PostDropdown } from '../../postDropdown'; import { Icon } from '../../icon'; +// Utils +import { makeCountFriendly } from '../../../utils/formatter'; + // STEEM import { Upvote } from '../../upvote'; // Styles @@ -59,6 +62,9 @@ class PostCard extends Component { const _image = content && content.image ? { uri: content.image, priority: FastImage.priority.high } : DEFAULT_IMAGE; + const reblogedBy = content.reblogged_by && content.reblogged_by[0]; + // repeat icon + // text rebloged by ${reblogedBy} return ( @@ -72,6 +78,7 @@ class PostCard extends Component { reputation={content.author_reputation} size={32} tag={content.category} + reblogedBy={reblogedBy} /> @@ -103,12 +110,12 @@ class PostCard extends Component { iconType="MaterialIcons" name="people" /> - {content.vote_count} + {makeCountFriendly(content.vote_count)} - {content.children} + {makeCountFriendly(content.children)} diff --git a/src/components/postElements/headerDescription/view/postHeaderDescription.js b/src/components/postElements/headerDescription/view/postHeaderDescription.js index 82d827232..1ab80bcef 100644 --- a/src/components/postElements/headerDescription/view/postHeaderDescription.js +++ b/src/components/postElements/headerDescription/view/postHeaderDescription.js @@ -5,7 +5,7 @@ import { withNavigation } from 'react-navigation'; import FastImage from 'react-native-fast-image'; // Components -import { Tag } from '../../../basicUIElements'; +import { Tag, TextWithIcon } from '../../../basicUIElements'; // Styles import styles from './postHeaderDescriptionStyles'; @@ -43,7 +43,15 @@ class PostHeaderDescription extends PureComponent { render() { const { - date, avatar, name, reputation, size, tag, tagOnPress, isHideImage, + avatar, + date, + isHideImage, + name, + reblogedBy, + reputation, + size, + tag, + tagOnPress, } = this.props; const _reputationText = `(${reputation})`; @@ -77,6 +85,7 @@ class PostHeaderDescription extends PureComponent { )} {date} + {!!reblogedBy && } ); } diff --git a/src/components/profileSummary/view/profileSummaryStyles.js b/src/components/profileSummary/view/profileSummaryStyles.js index a495496f9..49db84c73 100644 --- a/src/components/profileSummary/view/profileSummaryStyles.js +++ b/src/components/profileSummary/view/profileSummaryStyles.js @@ -22,8 +22,8 @@ export default EStyleSheet.create({ width: '$deviceWidth - 24', flexDirection: 'row', justifyContent: 'space-between', - marginBottom: 17, - marginTop: 10, + marginVertical: 10, + height: 30, }, leftIcons: { flexDirection: 'row', @@ -35,10 +35,11 @@ export default EStyleSheet.create({ justifyContent: 'flex-end', }, insetIconStyle: { - marginRight: 12, + marginRight: 20, + color: '$primaryDarkText', }, activityIndicator: { - marginRight: 12, + marginRight: 20, width: 30, }, followCountWrapper: { @@ -58,6 +59,13 @@ export default EStyleSheet.create({ }, // TODO: look at here dropdownIconStyle: { - marginBottom: 7, + width: 25, + height: 25, + left: -5, + marginBottom: 3, + color: '#c1c5c7', + }, + dropdownStyle: { + maxWidth: 150, }, }); diff --git a/src/components/profileSummary/view/profileSummaryView.js b/src/components/profileSummary/view/profileSummaryView.js index 8787579c0..ba5923836 100644 --- a/src/components/profileSummary/view/profileSummaryView.js +++ b/src/components/profileSummary/view/profileSummaryView.js @@ -17,6 +17,10 @@ import DARK_COVER_IMAGE from '../../../assets/dark_cover_image.png'; import { TextWithIcon } from '../../basicUIElements'; import { PercentBar } from '../../percentBar'; import { IconButton } from '../../iconButton'; +import { DropdownButton } from '../../dropdownButton'; + +// Utils +import { makeCountFriendly } from '../../../utils/formatter'; // Styles import styles from './profileSummaryStyles'; @@ -43,6 +47,16 @@ class ProfileSummaryView extends PureComponent { Linking.openURL(url); }; + _handleOnDropdownSelect = (index) => { + const { isMuted, handleMuteUnmuteUser } = this.props; + + // This funciton should have switch case but now only has one option therefor + // temporarily I created with if statments + if (index === '0' && handleMuteUnmuteUser) { + handleMuteUnmuteUser(!isMuted); + } + }; + render() { const { isShowPercentText } = this.state; const { @@ -51,8 +65,8 @@ class ProfileSummaryView extends PureComponent { followerCount, followingCount, handleFollowUnfollowUser, - handleMuteUnmuteUser, handleOnFollowsPress, + handleUIChange, hoursRC, hoursVP, intl, @@ -66,40 +80,43 @@ class ProfileSummaryView extends PureComponent { location, percentRC, percentVP, - handleUIChange, } = this.props; + const dropdownOpions = []; const votingPowerHoursText = hoursVP && `• Full in ${hoursVP} hours`; const votingPowerText = `Voting power: ${percentVP}% ${votingPowerHoursText || ''}`; const rcPowerHoursText = hoursRC && `• Full in ${hoursRC} hours`; const rcPowerText = `RCs: ${percentRC}% ${rcPowerHoursText || ''}`; - /* eslint-disable */ - const rowLength = location - ? location.length - : null + link - ? link.length - : null + date - ? date.length - : null; + const rowLength = (location ? location.length : 0) + (link ? link.length : 0) + (date ? date.length : 0); + const isColumn = rowLength && DEVICE_WIDTH / rowLength <= 7.3; - const isColumn = rowLength && DEVICE_WIDTH / rowLength <= 15; - const followButtonIcon = !isFollowing ? 'user-follow' : 'user-unfollow'; - const ignoreButtonIcon = !isMuted ? 'ban' : 'minus'; + const followButtonIcon = !isFollowing ? 'account-plus' : 'account-minus'; const coverImageUrl = `http://img.esteem.app/400x0/${coverImage}`; + dropdownOpions.push(!isMuted ? 'MUTE' : 'UNMUTE'); + return ( - {!!location && } + {!!location && ( + + )} {!!link && ( this._handleOnPressLink(link)} text={link} - iconName="md-globe" + iconSize={14} + iconName="earth" + iconType="MaterialCommunityIcons" /> )} - {!!date && } + {!!date && } - this.setState({ isShowPercentText: !isShowPercentText }, () => { - handleUIChange(isShowPercentText ? 0 : 30); - }) + onPress={() => this.setState({ isShowPercentText: !isShowPercentText }, () => { + handleUIChange(!isShowPercentText ? 30 : 0); + }) } > handleOnFollowsPress(false)}> - {followerCount} + {makeCountFriendly(followerCount)} {' '} {intl.formatMessage({ @@ -147,7 +163,7 @@ class ProfileSummaryView extends PureComponent { handleOnFollowsPress(true)}> - {followingCount} + {makeCountFriendly(followingCount)} {intl.formatMessage({ id: 'profile.following', @@ -163,9 +179,9 @@ class ProfileSummaryView extends PureComponent { @@ -175,24 +191,23 @@ class ProfileSummaryView extends PureComponent { handleFollowUnfollowUser(isFollowing ? false : true)} - size={16} - style={styles.insetIconStyle} + iconType="MaterialCommunityIcons" + onPress={() => handleFollowUnfollowUser(!isFollowing)} + size={20} color="#c1c5c7" /> )} {isProfileLoading ? ( ) : ( - handleMuteUnmuteUser(isMuted ? false : true)} - size={16} - style={styles.insetIconStyle} - color="#c1c5c7" + )} diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 6cca1e315..41781c45e 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -6,6 +6,7 @@ "claim_reward_balance": "Claim Reward Balance", "transfer": "Transfer", "transfer_to_vesting": "Transfer To Vesting", + "transfer_from_savings": "Transfer From Savings", "withdraw_vesting": "Power Down", "fill_order": "Fill Order" }, diff --git a/src/config/locales/tr-TR.json b/src/config/locales/tr-TR.json index 8cb231374..4efc8d1b6 100644 --- a/src/config/locales/tr-TR.json +++ b/src/config/locales/tr-TR.json @@ -1,13 +1,16 @@ { "wallet": { - "curation_reward": "Curation Reward", "author_reward": "Author Reward", - "comment_benefactor_reward": "Comment Benefactor Reward", + "claim_reward_balance_ok": "Reward balance claimed", "claim_reward_balance": "Claim Reward Balance", - "transfer": "Transfer", + "comment_benefactor_reward": "Comment Benefactor Reward", + "curation_reward": "Curation Reward", + "fill_order": "Fill Order", + "transactions": "Transactions", + "transfer_from_savings": "Tasarruflardan Transfer", "transfer_to_vesting": "Transfer To Vesting", - "withdraw_vesting": "withdraw_vesting", - "fill_order": "Fill Order" + "transfer": "Transfer", + "withdraw_vesting": "Withdraw Vesting" }, "notification": { "vote": "beğendi", diff --git a/src/screens/profile/container/profileContainer.js b/src/screens/profile/container/profileContainer.js index 6ffbcefd4..a386c1568 100644 --- a/src/screens/profile/container/profileContainer.js +++ b/src/screens/profile/container/profileContainer.js @@ -89,9 +89,6 @@ class ProfileContainer extends Component { this._loadProfile(selectedUser && selectedUser.username); } - - - } _getReplies = async (user) => { diff --git a/src/utils/formatter.js b/src/utils/formatter.js index 4e5dd1685..3b1c01835 100644 --- a/src/utils/formatter.js +++ b/src/utils/formatter.js @@ -1,11 +1,3 @@ -// TODO: Move all formats functions here! - -// const imgRegex = /(https?:\/\/.*\.(?:tiff?|jpe?g|gif|png|svg|ico))/gim; -// const postRegex = /^https?:\/\/(.*)\/(.*)\/(@[\w\.\d-]+)\/(.*)/i; -// const youTubeRegex = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([^& \n<]+)(?:[^ \n<]+)?/g; -// const vimeoRegex = /(https?:\/\/)?(www\.)?(?:vimeo)\.com.*(?:videos|video|channels|)\/([\d]+)/i; -// const dTubeRegex = /(https?:\/\/d.tube.#!\/v\/)(\w+)\/(\w+)/g; - export const getPostSummary = (postBody, length, isQuote) => { if (!postBody) { return ''; @@ -24,3 +16,13 @@ export const getPostSummary = (postBody, length, isQuote) => { } return isQuote ? `"${postBody}..."` : `${postBody}...`; }; + +export const makeCountFriendly = (value) => { + if (!value) return value; + if (value >= 1000000) return `${intlFormat(value / 1000000)}M`; + if (value >= 1000) return `${intlFormat(value / 1000)}K`; + + return intlFormat(value); +}; + +const intlFormat = num => new Intl.NumberFormat().format(Math.round(num * 10) / 10); diff --git a/src/utils/postParser.js b/src/utils/postParser.js index 6c5e760dd..b84320456 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -14,7 +14,7 @@ export const parsePost = (post, currentUserName, isSummary = false) => { _post.json_metadata = JSON.parse(post.json_metadata); _post.image = postImage(post.json_metadata, post.body); - _post.pending_payout_value = parseFloat(post.pending_payout_value).toFixed(2); + _post.pending_payout_value = parseFloat(post.pending_payout_value).toFixed(3); _post.created = getTimeFromNow(post.created); _post.vote_count = post.active_votes.length; _post.author_reputation = getReputation(post.author_reputation); @@ -121,7 +121,7 @@ export const protocolUrl2Obj = (url) => { export const parseComments = (comments) => { comments.map((comment) => { - comment.pending_payout_value = parseFloat(comment.pending_payout_value).toFixed(2); + comment.pending_payout_value = parseFloat(comment.pending_payout_value).toFixed(3); comment.created = getTimeFromNow(comment.created); comment.vote_count = comment.active_votes.length; comment.author_reputation = getReputation(comment.author_reputation); diff --git a/src/utils/wallet.js b/src/utils/wallet.js index 950b80b23..0d9944825 100644 --- a/src/utils/wallet.js +++ b/src/utils/wallet.js @@ -1,5 +1,5 @@ +// import parseDate from './parseDate'; import parseToken from './parseToken'; -import parseDate from './parseDate'; import { vestsToSp } from './conversions'; export const getTransactionData = (transaction, walletData, formatNumber) => { @@ -14,7 +14,7 @@ export const getTransactionData = (transaction, walletData, formatNumber) => { const opData = transaction[1].op[1]; const { timestamp } = transaction[1]; - result.transDate = parseDate(timestamp); + result.transDate = timestamp; result.icon = 'local-activity'; switch (result.opName) { @@ -85,7 +85,7 @@ export const getTransactionData = (transaction, walletData, formatNumber) => { result.value = `${formatNumber(vestsToSp(opVestingShares, walletData.steemPerMVests), { minimumFractionDigits: 3, })} SP`; - result.icon = 'money'; + result.icon = 'attach-money'; result.details = `@${acc}`; break; case 'fill_order':