diff --git a/.eslintrc.json b/.eslintrc.json index 6b7b524e9..2131d41af 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -13,20 +13,43 @@ "jest": true, "react-native/react-native": true }, - "plugins": ["react", "react-native", "jsx-a11y", "import", "prettier", "jest", "eslint-comments"], + "plugins": [ + "react", + "react-native", + "jsx-a11y", + "import", + "prettier", + "jest", + "eslint-comments" + ], "rules": { "react/jsx-filename-extension": [ 2, { - "extensions": [".js", ".jsx"] + "extensions": [ + ".js", + ".jsx" + ] } ], - "max-len": ["error", 100], - "react/forbid-prop-types": [0], + "max-len": [ + "error", + 100 + ], + "react/forbid-prop-types": [ + 0 + ], "no-underscore-dangle": 0, - "react/require-default-props": [0], - "global-require": [0], - "func-names": ["error", "as-needed"], + "react/require-default-props": [ + 0 + ], + "global-require": [ + 0 + ], + "func-names": [ + "error", + "as-needed" + ], "linebreak-style": 0, "no-use-before-define": "off", "import/prefer-default-export": "off", @@ -36,4 +59,4 @@ "no-case-declarations": "off", "no-cycle": "off" } -} +} \ No newline at end of file diff --git a/ios/eSteem.xcworkspace/xcuserdata/f.xcuserdatad/UserInterfaceState.xcuserstate b/ios/eSteem.xcworkspace/xcuserdata/f.xcuserdatad/UserInterfaceState.xcuserstate index eedbc84d3..42f422a04 100644 Binary files a/ios/eSteem.xcworkspace/xcuserdata/f.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/eSteem.xcworkspace/xcuserdata/f.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/src/components/basicHeader/view/basicHeaderView.js b/src/components/basicHeader/view/basicHeaderView.js index 0c19f39a7..c5c70751d 100644 --- a/src/components/basicHeader/view/basicHeaderView.js +++ b/src/components/basicHeader/view/basicHeaderView.js @@ -46,7 +46,9 @@ class BasicHeaderView extends Component { this.setState({ isInputVisible: !isInputVisible }); - if (isInputVisible) this._handleOnSearch(''); + if (isInputVisible) { + this._handleOnSearch(''); + } }; _handleOnSearch = value => { diff --git a/src/components/basicUIElements/view/tag/tagStyles.js b/src/components/basicUIElements/view/tag/tagStyles.js index 756e06879..46a2aee25 100644 --- a/src/components/basicUIElements/view/tag/tagStyles.js +++ b/src/components/basicUIElements/view/tag/tagStyles.js @@ -22,10 +22,10 @@ export default EStyleSheet.create({ borderRadius: 50, }, isFilter: { - backgroundColor: 'transparent' + backgroundColor: 'transparent', }, isFilterTextUnPin: { - color: '$primaryDarkBlue', + color: '$primaryDarkGray', fontSize: 14, }, isFilterTextPin: { diff --git a/src/components/basicUIElements/view/tag/tagView.js b/src/components/basicUIElements/view/tag/tagView.js index 98c9f79c6..afc766b27 100644 --- a/src/components/basicUIElements/view/tag/tagView.js +++ b/src/components/basicUIElements/view/tag/tagView.js @@ -5,9 +5,22 @@ import styles from './tagStyles'; const Tag = ({ onPress, isPin, value, isPostCardTag, isFilter }) => ( onPress && onPress(value)}> - {value} + + {value} + ); diff --git a/src/components/collapsibleCard/view/collapsibleCardView.js b/src/components/collapsibleCard/view/collapsibleCardView.js index c9240e75e..981a5e9d5 100644 --- a/src/components/collapsibleCard/view/collapsibleCardView.js +++ b/src/components/collapsibleCard/view/collapsibleCardView.js @@ -51,7 +51,9 @@ class CollapsibleCardView extends PureComponent { // Component Functions _initContentHeight = event => { - if (this.anime.contentHeight > 0) return; + if (this.anime.contentHeight > 0) { + return; + } this.anime.contentHeight = event.nativeEvent.layout.height; this.anime.height.setValue(this.anime.expanded ? this._getMaxValue() : this._getMinValue()); }; @@ -72,7 +74,9 @@ class CollapsibleCardView extends PureComponent { expanded: this.anime.expanded, }); - if (handleOnExpanded && this.anime.expanded) handleOnExpanded(); + if (handleOnExpanded && this.anime.expanded) { + handleOnExpanded(); + } }; render() { diff --git a/src/components/comments/container/commentsContainer.js b/src/components/comments/container/commentsContainer.js index a1836f003..17607b756 100644 --- a/src/components/comments/container/commentsContainer.js +++ b/src/components/comments/container/commentsContainer.js @@ -85,8 +85,12 @@ class CommentsContainer extends Component { const keyA = get(a, 'author_reputation'); const keyB = get(b, 'author_reputation'); - if (keyA > keyB) return -1; - if (keyA < keyB) return 1; + if (keyA > keyB) { + return -1; + } + if (keyA < keyB) { + return 1; + } return 0; }, @@ -94,8 +98,12 @@ class CommentsContainer extends Component { const keyA = a.net_votes; const keyB = b.net_votes; - if (keyA > keyB) return -1; - if (keyA < keyB) return 1; + if (keyA > keyB) { + return -1; + } + if (keyA < keyB) { + return 1; + } return 0; }, @@ -111,8 +119,12 @@ class CommentsContainer extends Component { const keyA = Date.parse(get(a, 'created')); const keyB = Date.parse(get(b, 'created')); - if (keyA > keyB) return -1; - if (keyA < keyB) return 1; + if (keyA > keyB) { + return -1; + } + if (keyA < keyB) { + return 1; + } return 0; }, @@ -149,7 +161,7 @@ class CommentsContainer extends Component { }); } }) - .catch(() => { }); + .catch(() => {}); } }; diff --git a/src/components/commentsDisplay/view/commentsDisplayView.js b/src/components/commentsDisplay/view/commentsDisplayView.js index 69a1a0358..9370cfb29 100644 --- a/src/components/commentsDisplay/view/commentsDisplayView.js +++ b/src/components/commentsDisplay/view/commentsDisplayView.js @@ -50,7 +50,9 @@ class CommentsDisplayView extends PureComponent { dropdownIconName="arrow-drop-down" options={VALUE.map(val => intl.formatMessage({ id: `comment_filter.${val}` }))} defaultText={intl.formatMessage({ id: `comment_filter.${VALUE[0]}` })} - onDropdownSelect={selectedIndex => this._handleOnDropdownSelect(COMMENT_FILTER[selectedIndex], selectedIndex)} + onDropdownSelect={selectedIndex => + this._handleOnDropdownSelect(COMMENT_FILTER[selectedIndex], selectedIndex) + } selectedOptionIndex={selectedOptionIndex} /> diff --git a/src/components/editorElements/tagArea/view/tagAreaView.js b/src/components/editorElements/tagArea/view/tagAreaView.js index 1aa126a9e..c483ab277 100644 --- a/src/components/editorElements/tagArea/view/tagAreaView.js +++ b/src/components/editorElements/tagArea/view/tagAreaView.js @@ -42,11 +42,14 @@ export default class TagAreaView extends Component { // Component Functions _handleOnChange = (text, i) => { - this.setState({ currentText: text.replace(/\s/g, '') }); + this.setState({ currentText: text.replace(/\s/g, '').replace(/,/g, '') }); if (text.indexOf(' ') > 0 && text) { this._handleTagAdded(); } + if (text.indexOf(',') > 0 && text) { + this._handleTagAdded(); + } if (!text) { this._handleTagRemove(i); diff --git a/src/components/filterBar/view/filterBarStyles.js b/src/components/filterBar/view/filterBarStyles.js index 4037ec3d7..04c3d10fc 100644 --- a/src/components/filterBar/view/filterBarStyles.js +++ b/src/components/filterBar/view/filterBarStyles.js @@ -16,7 +16,7 @@ export default EStyleSheet.create({ flexDirection: 'row', justifyContent: 'center', alignItems: 'center', - left: 15 + left: 15, }, filterBarWrapper: { flexDirection: 'row', @@ -30,5 +30,5 @@ export default EStyleSheet.create({ rightIcon: { color: '$darkIconColor', textAlign: 'center', - } + }, }); diff --git a/src/components/filterBar/view/filterBarView.js b/src/components/filterBar/view/filterBarView.js index b85ab5023..83196be4e 100644 --- a/src/components/filterBar/view/filterBarView.js +++ b/src/components/filterBar/view/filterBarView.js @@ -28,30 +28,37 @@ const FilterBarView = ({ rightIconType, selectedOptionIndex, }) => ( - - {!isHide && ( - - - - {options.map((item, index) => onDropdownSelect(index)} />)} - - {rightIconName && ( - onRightIconPress && onRightIconPress()} - style={styles.rightIconWrapper} - > - - - )} + + {!isHide && ( + + + + {options.map((item, index) => ( + onDropdownSelect(index)} + /> + ))} - - )} - - ); + {rightIconName && ( + onRightIconPress && onRightIconPress()} + style={styles.rightIconWrapper} + > + + + )} + + + )} + +); export default FilterBarView; diff --git a/src/components/formInput/view/formInputView.js b/src/components/formInput/view/formInputView.js index d2551da77..1925bf366 100644 --- a/src/components/formInput/view/formInputView.js +++ b/src/components/formInput/view/formInputView.js @@ -47,7 +47,9 @@ class FormInputView extends Component { const { onChange } = this.props; this.setState({ value }); - if (onChange) onChange(value); + if (onChange) { + onChange(value); + } }; _handleOnFocus = () => { diff --git a/src/components/icon/view/iconView.js b/src/components/icon/view/iconView.js index d1dfff954..8b2887fce 100644 --- a/src/components/icon/view/iconView.js +++ b/src/components/icon/view/iconView.js @@ -82,7 +82,9 @@ class IconView extends PureComponent { _badgeCount = '99+'; } - if (!badgeCount) return this._getIcon(); + if (!badgeCount) { + return this._getIcon(); + } return this._getIconWithBadge(_badgeCount); } diff --git a/src/components/leaderboard/container/leaderboardContainer.js b/src/components/leaderboard/container/leaderboardContainer.js index 8847df371..60d19587e 100644 --- a/src/components/leaderboard/container/leaderboardContainer.js +++ b/src/components/leaderboard/container/leaderboardContainer.js @@ -59,7 +59,9 @@ class LeaderboardContainer extends PureComponent { let users; console.log(index); - if (!isConnected) return; + if (!isConnected) { + return; + } this.setState({ refreshing: true, selectedIndex: index }); diff --git a/src/components/leaderboard/view/leaderboardView.js b/src/components/leaderboard/view/leaderboardView.js index a1e66d532..c2b9761ac 100644 --- a/src/components/leaderboard/view/leaderboardView.js +++ b/src/components/leaderboard/view/leaderboardView.js @@ -47,7 +47,9 @@ class LeaderboardView extends PureComponent { options={VALUE.map(val => intl.formatMessage({ id: `leaderboard.${val}` }))} selectedOptionIndex={selectedIndex} defaultText={intl.formatMessage({ id: `leaderboard.${VALUE[0]}` })} - onDropdownSelect={selectedIndex => fetchLeaderBoard(FILTER_OPTIONS[selectedIndex], selectedIndex)} + onDropdownSelect={selectedIndex => + fetchLeaderBoard(FILTER_OPTIONS[selectedIndex], selectedIndex) + } /> diff --git a/src/components/markdownEditor/view/markdownEditorView.js b/src/components/markdownEditor/view/markdownEditorView.js index 5bd4f5dcc..5dee2d56c 100644 --- a/src/components/markdownEditor/view/markdownEditorView.js +++ b/src/components/markdownEditor/view/markdownEditorView.js @@ -45,13 +45,13 @@ const MarkdownEditorView = ({ if (!isPreviewActive) { _setTextAndSelection({ selection: { start: 0, end: 0 }, text }); } - }, [isPreviewActive]); + }, [_setTextAndSelection, isPreviewActive, text]); useEffect(() => { if (text === '' && draftBody !== '') { _setTextAndSelection({ selection: { start: 0, end: 0 }, text: draftBody }); } - }, [draftBody]); + }, [_setTextAndSelection, draftBody, text]); useEffect(() => { if (editable === null) { @@ -63,7 +63,7 @@ const MarkdownEditorView = ({ } else { setEditable(!isLoading); } - }, [isLoading]); + }, [editable, isLoading]); useEffect(() => { if (uploadedImage && uploadedImage.url) { @@ -75,7 +75,7 @@ const MarkdownEditorView = ({ isImage: !!uploadedImage, }); } - }, [uploadedImage]); + }, [_setTextAndSelection, selection, text, uploadedImage]); useEffect(() => { setText(draftBody); @@ -91,9 +91,9 @@ const MarkdownEditorView = ({ handleIsFormValid(text); } } - }, [text]); + }, [_changeText, handleIsFormValid, text]); - const _changeText = input => { + const _changeText = useCallback(input => { setText(input); if (onChange) { @@ -107,13 +107,13 @@ const MarkdownEditorView = ({ if (handleOnTextChange) { handleOnTextChange(input); } - }; + }); const _handleOnSelectionChange = async event => { setSelection(event.nativeEvent.selection); }; - const _setTextAndSelection = ({ selection: _selection, text: _text }) => { + const _setTextAndSelection = useCallback(({ selection: _selection, text: _text }) => { inputRef.current.setNativeProps({ text: _text, }); @@ -125,7 +125,7 @@ const MarkdownEditorView = ({ setSelection(_selection); }, 200); _changeText(_text); - }; + }); const _renderPreview = () => ( diff --git a/src/components/notification/view/notificationView.js b/src/components/notification/view/notificationView.js index 3d75efcbc..2c142f968 100644 --- a/src/components/notification/view/notificationView.js +++ b/src/components/notification/view/notificationView.js @@ -85,7 +85,9 @@ class NotificationView extends PureComponent { _getNotificationsArrays = () => { const { notifications, intl } = this.props; - if (!notifications && notifications.length < 1) return null; + if (!notifications && notifications.length < 1) { + return null; + } const notificationArray = [ { @@ -130,13 +132,21 @@ class NotificationView extends PureComponent { }; _getTimeListIndex = timestamp => { - if (isToday(timestamp)) return 0; + if (isToday(timestamp)) { + return 0; + } - if (isYesterday(timestamp)) return 1; + if (isYesterday(timestamp)) { + return 1; + } - if (isThisWeek(timestamp)) return 2; + if (isThisWeek(timestamp)) { + return 2; + } - if (isThisMonth(timestamp)) return 3; + if (isThisMonth(timestamp)) { + return 3; + } return 4; }; diff --git a/src/components/percentBar/view/percentBarView.js b/src/components/percentBar/view/percentBarView.js index 8a9166238..c2ef4ec97 100644 --- a/src/components/percentBar/view/percentBarView.js +++ b/src/components/percentBar/view/percentBarView.js @@ -39,7 +39,9 @@ class PercentBarView extends PureComponent { _getText = (textColor, text, isTop, isRender) => { const { isShowText } = this.props; - if (!isShowText) return null; + if (!isShowText) { + return null; + } if (isTop === isRender && text) { return ( diff --git a/src/components/postBoost/postBoostView.js b/src/components/postBoost/postBoostView.js index 6c6abf4a8..e2b611075 100644 --- a/src/components/postBoost/postBoostView.js +++ b/src/components/postBoost/postBoostView.js @@ -252,7 +252,11 @@ class BoostPostScreen extends PureComponent { cancelButtonIndex={1} destructiveButtonIndex={0} onPress={index => { - if (index === 0) if (index === 0) this._handleOnSubmit(); + if (index === 0) { + if (index === 0) { + this._handleOnSubmit(); + } + } }} /> diff --git a/src/components/postElements/body/view/postBodyView.js b/src/components/postElements/body/view/postBodyView.js index b1f6826fd..5c36943c7 100644 --- a/src/components/postElements/body/view/postBodyView.js +++ b/src/components/postElements/body/view/postBodyView.js @@ -67,7 +67,7 @@ const PostBody = ({ default: break; } - } catch (error) { } + } catch (error) {} }; const _handleTagPress = tag => { diff --git a/src/components/postListItem/view/postListItemView.js b/src/components/postListItem/view/postListItemView.js index 9ccb19cab..c40c86c42 100644 --- a/src/components/postListItem/view/postListItemView.js +++ b/src/components/postListItem/view/postListItemView.js @@ -91,7 +91,9 @@ class PostListItemView extends Component { cancelButtonIndex={1} destructiveButtonIndex={0} onPress={index => { - if (index === 0) handleOnRemoveItem(id); + if (index === 0) { + handleOnRemoveItem(id); + } }} /> diff --git a/src/components/postView/container/postDisplayContainer.js b/src/components/postView/container/postDisplayContainer.js index fb579ad4a..128b7b14a 100644 --- a/src/components/postView/container/postDisplayContainer.js +++ b/src/components/postView/container/postDisplayContainer.js @@ -114,7 +114,9 @@ class PostDisplayContainer extends Component { _fetchPost = async () => { const { post, fetchPost } = this.props; - if (post) fetchPost(post.author, post.permlink); + if (post) { + fetchPost(post.author, post.permlink); + } }; render() { diff --git a/src/components/posts/view/postsView.js b/src/components/posts/view/postsView.js index 2c021f112..98146cc77 100644 --- a/src/components/posts/view/postsView.js +++ b/src/components/posts/view/postsView.js @@ -140,7 +140,7 @@ const PostsView = ({ setPromotedPosts(_promotedPosts); } }) - .catch(() => { }); + .catch(() => {}); }, [currentAccountUsername]); const _loadPosts = useCallback( diff --git a/src/components/profileSummary/view/profileSummaryView.js b/src/components/profileSummary/view/profileSummaryView.js index eee2092d6..41735e82e 100644 --- a/src/components/profileSummary/view/profileSummaryView.js +++ b/src/components/profileSummary/view/profileSummaryView.js @@ -46,7 +46,9 @@ class ProfileSummaryView extends PureComponent { // Component Functions _handleOnPressLink = url => { - if (url) Linking.openURL(url); + if (url) { + Linking.openURL(url); + } }; _handleOnDropdownSelect = index => { diff --git a/src/components/promote/promoteView.js b/src/components/promote/promoteView.js index 1bd3a6552..817ede2d8 100644 --- a/src/components/promote/promoteView.js +++ b/src/components/promote/promoteView.js @@ -230,7 +230,9 @@ class PromoteView extends PureComponent { cancelButtonIndex={1} destructiveButtonIndex={0} onPress={index => { - if (index === 0) this._handleOnSubmit(); + if (index === 0) { + this._handleOnSubmit(); + } }} /> { diff --git a/src/components/searchModal/container/searchModalContainer.js b/src/components/searchModal/container/searchModalContainer.js index 31975211f..34c64d0cb 100644 --- a/src/components/searchModal/container/searchModalContainer.js +++ b/src/components/searchModal/container/searchModalContainer.js @@ -43,11 +43,15 @@ class SearchModalContainer extends PureComponent { _handleOnChangeSearchInput = text => { const { isConnected } = this.props; - if (text && text.length < 2) return; + if (text && text.length < 2) { + return; + } if (this.timer) { clearTimeout(this.timer); } - if (!isConnected) return; + if (!isConnected) { + return; + } if (text && text !== '@' && text !== '#') { if (text[0] === '@') { lookupAccounts(text.substr(1)).then(res => { diff --git a/src/components/toastNotification/view/toastNotificaitonView.js b/src/components/toastNotification/view/toastNotificaitonView.js index 2ce672f39..d3df2531c 100644 --- a/src/components/toastNotification/view/toastNotificaitonView.js +++ b/src/components/toastNotification/view/toastNotificaitonView.js @@ -43,7 +43,9 @@ class ToastNotification extends Component { const { onHide } = this.props; Animated.timing(animatedValue, { toValue: 0.0, duration: 350 }).start(() => { - if (onHide) onHide(); + if (onHide) { + onHide(); + } }); if (this.closeTimer) { diff --git a/src/components/toggleSwitch/view/toggleSwitchView.js b/src/components/toggleSwitch/view/toggleSwitchView.js index cb2c8ccd9..76d1d761b 100644 --- a/src/components/toggleSwitch/view/toggleSwitchView.js +++ b/src/components/toggleSwitch/view/toggleSwitchView.js @@ -80,7 +80,9 @@ class ToggleSwitchView extends PureComponent { // For debounce setTimeout(() => { - if (onToggle) onToggle(!isOn); + if (onToggle) { + onToggle(!isOn); + } }, 300); }; diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 6f9942485..12c28a4cb 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -69,13 +69,20 @@ "title": "eSteem Points", "buy": "GET ESTM" }, - "saving": { + "savingsteem": { "title": "STEEM Savings" }, + "savingsbd": { + "title": "SBD Savings" + }, "steem": { "title": "STEEM", "buy": "GET STEEM" }, + "sbd": { + "title": "SBD", + "buy": "GET SBD" + }, "steem_power": { "title": "STEEM POWER" } diff --git a/src/constants/options/comment.js b/src/constants/options/comment.js index c20fec371..ca54b3340 100644 --- a/src/constants/options/comment.js +++ b/src/constants/options/comment.js @@ -1,3 +1,3 @@ export default ['trending', 'reputation', 'votes', 'age']; -export const VALUE = ['top', 'reputation', 'votes', 'time']; \ No newline at end of file +export const VALUE = ['top', 'reputation', 'votes', 'time']; diff --git a/src/containers/profileContainer.js b/src/containers/profileContainer.js index dd09a5fde..7e9b077c7 100644 --- a/src/containers/profileContainer.js +++ b/src/containers/profileContainer.js @@ -60,7 +60,9 @@ class ProfileContainer extends Component { const { isOwnProfile } = this.state; let targetUsername = currentAccountUsername; - if (!isConnected) return; + if (!isConnected) { + return; + } if (!isLoggedIn && !username) { navigation.navigate(ROUTES.SCREENS.LOGIN); @@ -75,7 +77,9 @@ class ProfileContainer extends Component { } UNSAFE_componentWillReceiveProps(nextProps) { - if (!nextProps.isConnected) return; + if (!nextProps.isConnected) { + return; + } const { isLoggedIn, navigation } = this.props; const { isOwnProfile } = this.state; diff --git a/src/containers/transferContainer.js b/src/containers/transferContainer.js index 149f3fc54..8a3823620 100644 --- a/src/containers/transferContainer.js +++ b/src/containers/transferContainer.js @@ -56,7 +56,9 @@ class TransferContainer extends Component { this.setState({ balance }); }) .catch(err => { - if (err) alert(get(err, 'message') || err.toString()); + if (err) { + alert(get(err, 'message') || err.toString()); + } }); }; diff --git a/src/navigation/baseNavigator.js b/src/navigation/baseNavigator.js index ccebc1a68..c3681c7f9 100644 --- a/src/navigation/baseNavigator.js +++ b/src/navigation/baseNavigator.js @@ -44,7 +44,7 @@ const BaseNavigator = createBottomTabNavigator( screen: Wallet, navigationOptions: () => ({ tabBarIcon: ({ tintColor }) => ( - + ), }), }, diff --git a/src/providers/steem/dsteem.js b/src/providers/steem/dsteem.js index 008613b09..1d2bfdaa8 100644 --- a/src/providers/steem/dsteem.js +++ b/src/providers/steem/dsteem.js @@ -122,7 +122,9 @@ export const getUser = async user => { const _account = { ...account[0] }; let unreadActivityCount; - if (account && account.length < 1) return null; + if (account && account.length < 1) { + return null; + } const globalProperties = await client.database.getDynamicGlobalProperties(); const rcPower = await client.call('rc_api', 'find_rc_accounts', { accounts: [user] }); diff --git a/src/screens/feed/screen/feedScreen.js b/src/screens/feed/screen/feedScreen.js index 73cad4528..e047a80df 100644 --- a/src/screens/feed/screen/feedScreen.js +++ b/src/screens/feed/screen/feedScreen.js @@ -29,7 +29,7 @@ const FeedScreen = () => { filterOptions={[...POPULAR_FILTERS]} filterOptionsValue={[...POPULAR_FILTERS_VALUE]} getFor={isLoggedIn ? 'feed' : 'trending'} - selectedOptionIndex={isLoggedIn ? 1 : 2} + selectedOptionIndex={isLoggedIn ? 0 : 2} tag={get(currentAccount, 'name')} /> diff --git a/src/screens/follows/container/followsContainer.js b/src/screens/follows/container/followsContainer.js index a2c46811f..64d3d34f3 100644 --- a/src/screens/follows/container/followsContainer.js +++ b/src/screens/follows/container/followsContainer.js @@ -52,7 +52,9 @@ class FollowsContainer extends Component { let _startWith; const { username, users, isFollowingPress, startWith, count } = this.state; - if ((users && count < 100) || (users && count === users.length + 1)) return; + if ((users && count < 100) || (users && count === users.length + 1)) { + return; + } const name = username || _username; const isFollowing = isFollowingPress || _isFollowingPress; @@ -71,7 +73,9 @@ class FollowsContainer extends Component { }); } - if (!_username) _users.shift(); + if (!_username) { + _users.shift(); + } this.setState({ users: !_username ? [...users, ..._users] : _users, diff --git a/src/screens/login/container/loginContainer.js b/src/screens/login/container/loginContainer.js index 4d97e2271..f37db8fb0 100644 --- a/src/screens/login/container/loginContainer.js +++ b/src/screens/login/container/loginContainer.js @@ -124,7 +124,9 @@ class LoginContainer extends PureComponent { _getAccountsWithUsername = async username => { const { intl, isConnected } = this.props; - if (!isConnected) return null; + if (!isConnected) { + return null; + } try { const validUsers = await lookupAccounts(username); diff --git a/src/screens/post/container/postContainer.js b/src/screens/post/container/postContainer.js index 739f73d08..64fbbb5ed 100644 --- a/src/screens/post/container/postContainer.js +++ b/src/screens/post/container/postContainer.js @@ -32,7 +32,9 @@ class PostContainer extends Component { const { navigation } = this.props; const { content, permlink, author, isNewPost } = get(navigation, 'state.params'); - if (isNewPost) this.setState({ isNewPost }); + if (isNewPost) { + this.setState({ isNewPost }); + } if (content) { this.setState({ post: content }); diff --git a/src/screens/wallet/screen/sbdView.js b/src/screens/wallet/screen/sbdView.js new file mode 100644 index 000000000..cae84854a --- /dev/null +++ b/src/screens/wallet/screen/sbdView.js @@ -0,0 +1,60 @@ +import React from 'react'; +import { View } from 'react-native'; + +import { WalletHeader, FormatedCurrency } from '../../../components'; +import { SteemWalletContainer, AccountContainer } from '../../../containers'; + +import globalStyles from '../../../globalStyles'; + +const SbdView = ({ handleOnSelected, index, currentIndex }) => ( + + + {({ currentAccount }) => ( + + {({ + isClaiming, + claimRewardBalance, + handleOnWalletRefresh, + refreshing, + transferHistory, + sbdBalance, + isLoading, + sbdSavingBalance, + estimatedValue, + sbdDropdown, + savingSbdDropdown, + navigate, + }) => ( + handleOnSelected(transferHistory, isLoading)} + index={index} + claim={claimRewardBalance} + fetchUserActivity={handleOnWalletRefresh} + isClaiming={isClaiming} + isLoading={isLoading} + refreshing={refreshing} + unclaimedBalance={0} + userBalance={[ + { balance: sbdBalance, nameKey: 'sbd', options: sbdDropdown }, + { balance: sbdSavingBalance, nameKey: 'savingsbd', options: savingSbdDropdown }, + ]} + handleOnDropdownSelected={option => navigate(option, 'SBD')} + type="sbd" + currentIndex={currentIndex} + showIconList={false} + valueDescriptions={[ + { + textKey: 'estimated_value', + value: , + subTextKey: 'estimated_value_desc', + }, + ]} + /> + )} + + )} + + +); + +export default SbdView; diff --git a/src/screens/wallet/screen/steemView.js b/src/screens/wallet/screen/steemView.js index 482e3cc79..28bbf1ec3 100644 --- a/src/screens/wallet/screen/steemView.js +++ b/src/screens/wallet/screen/steemView.js @@ -6,7 +6,7 @@ import { SteemWalletContainer, AccountContainer } from '../../../containers'; import globalStyles from '../../../globalStyles'; -const SteeemView = ({ handleOnSelected, index, currentIndex }) => ( +const SteemView = ({ handleOnSelected, index, currentIndex }) => ( {({ currentAccount }) => ( @@ -36,7 +36,11 @@ const SteeemView = ({ handleOnSelected, index, currentIndex }) => ( unclaimedBalance={0} userBalance={[ { balance: steemBalance, nameKey: 'steem', options: steemDropdown }, - { balance: steemSavingBalance, nameKey: 'saving', options: savingSteemDropdown }, + { + balance: steemSavingBalance, + nameKey: 'savingsteem', + options: savingSteemDropdown, + }, ]} handleOnDropdownSelected={option => navigate(option, 'STEEM')} type="steem" @@ -57,4 +61,4 @@ const SteeemView = ({ handleOnSelected, index, currentIndex }) => ( ); -export default SteeemView; +export default SteemView; diff --git a/src/screens/wallet/screen/walletScreen.js b/src/screens/wallet/screen/walletScreen.js index bb71a9f0d..0229d28c2 100644 --- a/src/screens/wallet/screen/walletScreen.js +++ b/src/screens/wallet/screen/walletScreen.js @@ -10,6 +10,7 @@ import { Header, Transaction } from '../../../components'; import EstmView from './estmView'; import SteemView from './steemView'; import SpView from './spView'; +import SbdView from './sbdView'; // Styles import globalStyles from '../../../globalStyles'; @@ -50,8 +51,14 @@ const WalletScreen = () => { refreshing={refreshing} currentIndex={currentIndex} /> - + { - if (!input) return 0; + if (!input) { + return 0; + } if (input === 0) { return 25; @@ -11,14 +13,20 @@ export default input => { let neg = false; - if (input < 0) neg = true; + if (input < 0) { + neg = true; + } let reputationLevel = Math.log10(Math.abs(input)); reputationLevel = Math.max(reputationLevel - 9, 0); - if (reputationLevel < 0) reputationLevel = 0; + if (reputationLevel < 0) { + reputationLevel = 0; + } - if (neg) reputationLevel *= -1; + if (neg) { + reputationLevel *= -1; + } reputationLevel = reputationLevel * 9 + 25; diff --git a/src/utils/clipboard.js b/src/utils/clipboard.js index 56d20adc1..8d75b4ad1 100644 --- a/src/utils/clipboard.js +++ b/src/utils/clipboard.js @@ -6,7 +6,9 @@ const readFromClipboard = async () => { }; const writeToClipboard = async text => { - if (!text) return false; + if (!text) { + return false; + } await Clipboard.setString(text); diff --git a/src/utils/conversions.js b/src/utils/conversions.js index 1f35759e9..7b781d39f 100644 --- a/src/utils/conversions.js +++ b/src/utils/conversions.js @@ -1,11 +1,15 @@ export const vestsToSp = (vests, steemPerMVests) => { - if (!vests || !steemPerMVests) return 0; + if (!vests || !steemPerMVests) { + return 0; + } return (vests / 1e6) * steemPerMVests; }; export const vestsToRshares = (vests, votingPower, votePerc) => { - if (!vests || !votingPower || !votePerc) return 0; + if (!vests || !votingPower || !votePerc) { + return 0; + } const vestingShares = parseInt(vests * 1e6, 10); const power = (votingPower * votePerc) / 1e4 / 50 + 1; diff --git a/src/utils/editor.js b/src/utils/editor.js index fbf358189..dffbc3686 100644 --- a/src/utils/editor.js +++ b/src/utils/editor.js @@ -8,7 +8,9 @@ export const getWordsCount = text => const permlinkRnd = () => (Math.random() + 1).toString(16).substring(2); export const generatePermlink = (title, random = false) => { - if (!title) return ''; + if (!title) { + return ''; + } const slug = getSlug(title); let perm = slug && slug.toString(); @@ -36,7 +38,9 @@ export const generatePermlink = (title, random = false) => { }; export const generateReplyPermlink = toAuthor => { - if (!toAuthor) return ''; + if (!toAuthor) { + return ''; + } const t = new Date(Date.now()); @@ -54,7 +58,9 @@ export const generateReplyPermlink = toAuthor => { }; export const makeOptions = (author, permlink, operationType) => { - if (!author || !permlink) return {}; + if (!author || !permlink) { + return {}; + } const a = { allow_curation_rewards: true, @@ -154,7 +160,9 @@ export const extractMetadata = body => { }; export const createPatch = (text1, text2) => { - if (!text1 && text1 === '') return undefined; + if (!text1 && text1 === '') { + return undefined; + } const dmp = new diffMatchPatch(); const patches = dmp.patch_make(text1, text2); diff --git a/src/utils/formatter.js b/src/utils/formatter.js index c8c84e989..8c1455a33 100644 --- a/src/utils/formatter.js +++ b/src/utils/formatter.js @@ -1,7 +1,13 @@ export const makeCountFriendly = value => { - if (!value) return value; - if (value >= 1000000) return `${intlFormat(value / 1000000)}M`; - if (value >= 1000) return `${intlFormat(value / 1000)}K`; + if (!value) { + return value; + } + if (value >= 1000000) { + return `${intlFormat(value / 1000000)}M`; + } + if (value >= 1000) { + return `${intlFormat(value / 1000)}K`; + } return intlFormat(value); }; diff --git a/src/utils/image.js b/src/utils/image.js index 4730f1b9b..ff7b8c63d 100644 --- a/src/utils/image.js +++ b/src/utils/image.js @@ -38,17 +38,23 @@ export const catchEntryImage = (entry, width = 0, height = 0) => { // try to extract images by regex const imgReg2 = /(http(s?):)([/|.|\w|\s|-])*\.(?:jpe?g|gif|png)/gim; const m = entry.body.match(imgReg2); - if (m) return proxifyImageSrc(m[0], width, height); + if (m) { + return proxifyImageSrc(m[0], width, height); + } // If no image specified in json metadata, try extract first image href from entry body let imgReg = //; let bodyMatch = entry.body.match(imgReg); - if (bodyMatch) return proxifyImageSrc(bodyMatch[1], width, height); + if (bodyMatch) { + return proxifyImageSrc(bodyMatch[1], width, height); + } // If there is no tag, check from markdown img tag ![](image.png) imgReg = /(?:!\[(.*?)\]\((.*?)\))/; bodyMatch = imgReg.exec(entry.body); - if (bodyMatch) return proxifyImageSrc(bodyMatch[2], width, height); + if (bodyMatch) { + return proxifyImageSrc(bodyMatch[2], width, height); + } return null; }; @@ -65,15 +71,21 @@ export const catchDraftImage = body => { }; export const getResizedImage = (url, size = 400) => { - if (!url) return ''; + if (!url) { + return ''; + } - if (url.includes('img.esteem')) return `https://img.esteem.ws/${size}x0/${url}`; + if (url.includes('img.esteem')) { + return `https://img.esteem.ws/${size}x0/${url}`; + } return `https://steemitimages.com/${size}x0/${url}`; }; export const getResizedAvatar = (author, sizeString = 'small') => { - if (!author) return ''; + if (!author) { + return ''; + } return `https://steemitimages.com/u/${author}/avatar/${sizeString}`; }; diff --git a/src/utils/jsonUtils.js b/src/utils/jsonUtils.js index 1d5a487ce..59bd82efb 100644 --- a/src/utils/jsonUtils.js +++ b/src/utils/jsonUtils.js @@ -1,5 +1,7 @@ export const jsonStringify = jsonMetadata => { - if (!jsonMetadata) return ''; + if (!jsonMetadata) { + return ''; + } try { return JSON.stringify(jsonMetadata); diff --git a/src/utils/manaBar.js b/src/utils/manaBar.js index d931280b7..e38478ef2 100644 --- a/src/utils/manaBar.js +++ b/src/utils/manaBar.js @@ -18,7 +18,9 @@ export const getVotingPower = account => { let currentMana = Number(manabar.current_mana) + (elapsed * maxMana) / PERIOD; - if (currentMana > maxMana) currentMana = maxMana; + if (currentMana > maxMana) { + currentMana = maxMana; + } return (currentMana * 100) / maxMana; }; @@ -38,7 +40,9 @@ export const getRcPower = account => { let currentMana = Number(manabar.current_mana) + (elapsed * maxMana) / PERIOD; - if (currentMana > maxMana) currentMana = maxMana; + if (currentMana > maxMana) { + currentMana = maxMana; + } return (currentMana * 100) / maxMana; }; diff --git a/src/utils/number.js b/src/utils/number.js index 3f7e44fc1..75ff9f66c 100644 --- a/src/utils/number.js +++ b/src/utils/number.js @@ -1,7 +1,11 @@ export const countDecimals = value => { - if (!value) return 0; + if (!value) { + return 0; + } - if (Math.floor(value) === value) return 0; + if (Math.floor(value) === value) { + return 0; + } return value.toString().split('.')[1].length || 0; }; diff --git a/src/utils/parseToken.js b/src/utils/parseToken.js index 21130edca..827d14b14 100644 --- a/src/utils/parseToken.js +++ b/src/utils/parseToken.js @@ -1,5 +1,7 @@ export default strVal => { - if (!strVal) return 0; + if (!strVal) { + return 0; + } return Number(parseFloat(strVal.split(' ')[0])); }; diff --git a/src/utils/reputation.js b/src/utils/reputation.js index c0a2c6d9a..4e1f1fb5d 100644 --- a/src/utils/reputation.js +++ b/src/utils/reputation.js @@ -1,5 +1,7 @@ export const getReputation = reputation => { - if (reputation === null) return reputation; + if (reputation === null) { + return reputation; + } let _reputation = String(parseInt(reputation, 10)); @@ -13,7 +15,9 @@ export const getReputation = reputation => { let out = n + (log - parseInt(log, 10)); // eslint-disable-next-line no-restricted-globals - if (isNaN(out)) out = 0; + if (isNaN(out)) { + out = 0; + } out = Math.max(out - 9, 0); out *= neg ? -1 : 1; diff --git a/src/utils/settings.js b/src/utils/settings.js index 8aedc9375..c1ba9edcd 100644 --- a/src/utils/settings.js +++ b/src/utils/settings.js @@ -2,7 +2,9 @@ export const groomingServerName = (serverName, prefix1) => { const PREFIX1 = prefix1 || 'https://'; const PREFIX2 = 'https://'; - if (!serverName) return null; + if (!serverName) { + return null; + } if (serverName.indexOf(PREFIX1) === 0) { return serverName.substr(PREFIX1.length); diff --git a/src/utils/user.js b/src/utils/user.js index d9059f7bd..c2330abed 100644 --- a/src/utils/user.js +++ b/src/utils/user.js @@ -9,14 +9,20 @@ export const getReputation = input => { let neg = false; - if (input < 0) neg = true; + if (input < 0) { + neg = true; + } let reputationLevel = Math.log10(Math.abs(input)); reputationLevel = Math.max(reputationLevel - 9, 0); - if (reputationLevel < 0) reputationLevel = 0; + if (reputationLevel < 0) { + reputationLevel = 0; + } - if (neg) reputationLevel *= -1; + if (neg) { + reputationLevel *= -1; + } reputationLevel = reputationLevel * 9 + 25;