mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 03:11:38 +03:00
ran lint:fix
This commit is contained in:
parent
c05c5ebb2a
commit
f248f6add0
@ -46,7 +46,9 @@ class BasicHeaderView extends Component {
|
||||
|
||||
this.setState({ isInputVisible: !isInputVisible });
|
||||
|
||||
if (isInputVisible) this._handleOnSearch('');
|
||||
if (isInputVisible) {
|
||||
this._handleOnSearch('');
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnSearch = value => {
|
||||
|
@ -22,7 +22,7 @@ export default EStyleSheet.create({
|
||||
borderRadius: 50,
|
||||
},
|
||||
isFilter: {
|
||||
backgroundColor: 'transparent'
|
||||
backgroundColor: 'transparent',
|
||||
},
|
||||
isFilterTextUnPin: {
|
||||
color: '$primaryDarkGray',
|
||||
|
@ -5,9 +5,22 @@ import styles from './tagStyles';
|
||||
const Tag = ({ onPress, isPin, value, isPostCardTag, isFilter }) => (
|
||||
<TouchableOpacity onPress={() => onPress && onPress(value)}>
|
||||
<View
|
||||
style={[styles.textWrapper, isFilter && styles.isFilter, isPin && styles.isPin, isPostCardTag && styles.isPostCardTag]}
|
||||
style={[
|
||||
styles.textWrapper,
|
||||
isFilter && styles.isFilter,
|
||||
isPin && styles.isPin,
|
||||
isPostCardTag && styles.isPostCardTag,
|
||||
]}
|
||||
>
|
||||
<Text style={[styles.text, !isPin && isFilter && styles.isFilterTextUnPin, isPin && isFilter && styles.isFilterTextPin]}>{value}</Text>
|
||||
<Text
|
||||
style={[
|
||||
styles.text,
|
||||
!isPin && isFilter && styles.isFilterTextUnPin,
|
||||
isPin && isFilter && styles.isFilterTextPin,
|
||||
]}
|
||||
>
|
||||
{value}
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
|
@ -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() {
|
||||
|
@ -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(() => {});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -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}
|
||||
/>
|
||||
<View style={styles.commentWrapper}>
|
||||
|
@ -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',
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -28,30 +28,37 @@ const FilterBarView = ({
|
||||
rightIconType,
|
||||
selectedOptionIndex,
|
||||
}) => (
|
||||
<View style={styles.container}>
|
||||
{!isHide && (
|
||||
<LineBreak height={38}>
|
||||
<View style={styles.filterBarWrapper}>
|
||||
<View style={styles.dropdownWrapper}>
|
||||
{options.map((item, index) => <Tag value={item} isFilter isPin={index == selectedOptionIndex} onPress={() => onDropdownSelect(index)} />)}
|
||||
</View>
|
||||
{rightIconName && (
|
||||
<TouchableOpacity
|
||||
onPress={() => onRightIconPress && onRightIconPress()}
|
||||
style={styles.rightIconWrapper}
|
||||
>
|
||||
<Icon
|
||||
style={styles.rightIcon}
|
||||
size={iconSize || 28}
|
||||
iconType={rightIconType}
|
||||
name={rightIconName}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
<View style={styles.container}>
|
||||
{!isHide && (
|
||||
<LineBreak height={38}>
|
||||
<View style={styles.filterBarWrapper}>
|
||||
<View style={styles.dropdownWrapper}>
|
||||
{options.map((item, index) => (
|
||||
<Tag
|
||||
value={item}
|
||||
isFilter
|
||||
isPin={index == selectedOptionIndex}
|
||||
onPress={() => onDropdownSelect(index)}
|
||||
/>
|
||||
))}
|
||||
</View>
|
||||
</LineBreak>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
{rightIconName && (
|
||||
<TouchableOpacity
|
||||
onPress={() => onRightIconPress && onRightIconPress()}
|
||||
style={styles.rightIconWrapper}
|
||||
>
|
||||
<Icon
|
||||
style={styles.rightIcon}
|
||||
size={iconSize || 28}
|
||||
iconType={rightIconType}
|
||||
name={rightIconName}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
</LineBreak>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
|
||||
export default FilterBarView;
|
||||
|
@ -47,7 +47,9 @@ class FormInputView extends Component {
|
||||
const { onChange } = this.props;
|
||||
|
||||
this.setState({ value });
|
||||
if (onChange) onChange(value);
|
||||
if (onChange) {
|
||||
onChange(value);
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnFocus = () => {
|
||||
|
@ -82,7 +82,9 @@ class IconView extends PureComponent {
|
||||
_badgeCount = '99+';
|
||||
}
|
||||
|
||||
if (!badgeCount) return this._getIcon();
|
||||
if (!badgeCount) {
|
||||
return this._getIcon();
|
||||
}
|
||||
|
||||
return this._getIconWithBadge(_badgeCount);
|
||||
}
|
||||
|
@ -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 });
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
/>
|
||||
|
||||
<View style={styles.container}>
|
||||
|
@ -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 = () => (
|
||||
<ScrollView style={styles.previewContainer}>
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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 (
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
|
@ -67,7 +67,7 @@ const PostBody = ({
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (error) { }
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
const _handleTagPress = tag => {
|
||||
|
@ -91,7 +91,9 @@ class PostListItemView extends Component {
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
if (index === 0) handleOnRemoveItem(id);
|
||||
if (index === 0) {
|
||||
handleOnRemoveItem(id);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Fragment>
|
||||
|
@ -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() {
|
||||
|
@ -140,7 +140,7 @@ const PostsView = ({
|
||||
setPromotedPosts(_promotedPosts);
|
||||
}
|
||||
})
|
||||
.catch(() => { });
|
||||
.catch(() => {});
|
||||
}, [currentAccountUsername]);
|
||||
|
||||
const _loadPosts = useCallback(
|
||||
|
@ -46,7 +46,9 @@ class ProfileSummaryView extends PureComponent {
|
||||
|
||||
// Component Functions
|
||||
_handleOnPressLink = url => {
|
||||
if (url) Linking.openURL(url);
|
||||
if (url) {
|
||||
Linking.openURL(url);
|
||||
}
|
||||
};
|
||||
|
||||
_handleOnDropdownSelect = index => {
|
||||
|
@ -230,7 +230,9 @@ class PromoteView extends PureComponent {
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
if (index === 0) this._handleOnSubmit();
|
||||
if (index === 0) {
|
||||
this._handleOnSubmit();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Modal
|
||||
|
@ -25,7 +25,9 @@ export default class ScaleSliderView extends Component {
|
||||
activeIndex: index,
|
||||
});
|
||||
|
||||
if (handleOnValueChange) handleOnValueChange(values[index]);
|
||||
if (handleOnValueChange) {
|
||||
handleOnValueChange(values[index]);
|
||||
}
|
||||
};
|
||||
|
||||
_renderItem = (value, index, activeIndex) => {
|
||||
|
@ -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 => {
|
||||
|
@ -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) {
|
||||
|
@ -80,7 +80,9 @@ class ToggleSwitchView extends PureComponent {
|
||||
|
||||
// For debounce
|
||||
setTimeout(() => {
|
||||
if (onToggle) onToggle(!isOn);
|
||||
if (onToggle) {
|
||||
onToggle(!isOn);
|
||||
}
|
||||
}, 300);
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
export default ['trending', 'reputation', 'votes', 'age'];
|
||||
|
||||
export const VALUE = ['top', 'reputation', 'votes', 'time'];
|
||||
export const VALUE = ['top', 'reputation', 'votes', 'time'];
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -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] });
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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 });
|
||||
|
@ -7,54 +7,54 @@ import { SteemWalletContainer, AccountContainer } from '../../../containers';
|
||||
import globalStyles from '../../../globalStyles';
|
||||
|
||||
const SbdView = ({ handleOnSelected, index, currentIndex }) => (
|
||||
<View style={globalStyles.swipeItemWrapper}>
|
||||
<AccountContainer>
|
||||
{({ currentAccount }) => (
|
||||
<SteemWalletContainer selectedUser={currentAccount}>
|
||||
{({
|
||||
isClaiming,
|
||||
claimRewardBalance,
|
||||
handleOnWalletRefresh,
|
||||
refreshing,
|
||||
transferHistory,
|
||||
sbdBalance,
|
||||
isLoading,
|
||||
sbdSavingBalance,
|
||||
estimatedValue,
|
||||
sbdDropdown,
|
||||
savingSbdDropdown,
|
||||
navigate,
|
||||
}) => (
|
||||
<WalletHeader
|
||||
componentDidUpdate={() => 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: <FormatedCurrency isApproximate value={estimatedValue} />,
|
||||
subTextKey: 'estimated_value_desc',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
</SteemWalletContainer>
|
||||
)}
|
||||
</AccountContainer>
|
||||
</View>
|
||||
<View style={globalStyles.swipeItemWrapper}>
|
||||
<AccountContainer>
|
||||
{({ currentAccount }) => (
|
||||
<SteemWalletContainer selectedUser={currentAccount}>
|
||||
{({
|
||||
isClaiming,
|
||||
claimRewardBalance,
|
||||
handleOnWalletRefresh,
|
||||
refreshing,
|
||||
transferHistory,
|
||||
sbdBalance,
|
||||
isLoading,
|
||||
sbdSavingBalance,
|
||||
estimatedValue,
|
||||
sbdDropdown,
|
||||
savingSbdDropdown,
|
||||
navigate,
|
||||
}) => (
|
||||
<WalletHeader
|
||||
componentDidUpdate={() => 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: <FormatedCurrency isApproximate value={estimatedValue} />,
|
||||
subTextKey: 'estimated_value_desc',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
</SteemWalletContainer>
|
||||
)}
|
||||
</AccountContainer>
|
||||
</View>
|
||||
);
|
||||
|
||||
export default SbdView;
|
||||
|
@ -25,32 +25,36 @@ const SteemView = ({ handleOnSelected, index, currentIndex }) => (
|
||||
savingSteemDropdown,
|
||||
navigate,
|
||||
}) => (
|
||||
<WalletHeader
|
||||
componentDidUpdate={() => handleOnSelected(transferHistory, isLoading)}
|
||||
index={index}
|
||||
claim={claimRewardBalance}
|
||||
fetchUserActivity={handleOnWalletRefresh}
|
||||
isClaiming={isClaiming}
|
||||
isLoading={isLoading}
|
||||
refreshing={refreshing}
|
||||
unclaimedBalance={0}
|
||||
userBalance={[
|
||||
{ balance: steemBalance, nameKey: 'steem', options: steemDropdown },
|
||||
{ balance: steemSavingBalance, nameKey: 'savingsteem', options: savingSteemDropdown },
|
||||
]}
|
||||
handleOnDropdownSelected={option => navigate(option, 'STEEM')}
|
||||
type="steem"
|
||||
currentIndex={currentIndex}
|
||||
showIconList={false}
|
||||
valueDescriptions={[
|
||||
{
|
||||
textKey: 'estimated_value',
|
||||
value: <FormatedCurrency isApproximate value={estimatedValue} />,
|
||||
subTextKey: 'estimated_value_desc',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
<WalletHeader
|
||||
componentDidUpdate={() => handleOnSelected(transferHistory, isLoading)}
|
||||
index={index}
|
||||
claim={claimRewardBalance}
|
||||
fetchUserActivity={handleOnWalletRefresh}
|
||||
isClaiming={isClaiming}
|
||||
isLoading={isLoading}
|
||||
refreshing={refreshing}
|
||||
unclaimedBalance={0}
|
||||
userBalance={[
|
||||
{ balance: steemBalance, nameKey: 'steem', options: steemDropdown },
|
||||
{
|
||||
balance: steemSavingBalance,
|
||||
nameKey: 'savingsteem',
|
||||
options: savingSteemDropdown,
|
||||
},
|
||||
]}
|
||||
handleOnDropdownSelected={option => navigate(option, 'STEEM')}
|
||||
type="steem"
|
||||
currentIndex={currentIndex}
|
||||
showIconList={false}
|
||||
valueDescriptions={[
|
||||
{
|
||||
textKey: 'estimated_value',
|
||||
value: <FormatedCurrency isApproximate value={estimatedValue} />,
|
||||
subTextKey: 'estimated_value_desc',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
</SteemWalletContainer>
|
||||
)}
|
||||
</AccountContainer>
|
||||
|
@ -1,5 +1,7 @@
|
||||
export default input => {
|
||||
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;
|
||||
|
||||
|
@ -6,7 +6,9 @@ const readFromClipboard = async () => {
|
||||
};
|
||||
|
||||
const writeToClipboard = async text => {
|
||||
if (!text) return false;
|
||||
if (!text) {
|
||||
return false;
|
||||
}
|
||||
|
||||
await Clipboard.setString(text);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -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 = /<img.+src=(?:"|')(.+?)(?:"|')(.*)>/;
|
||||
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 <img> 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}`;
|
||||
};
|
||||
|
@ -1,5 +1,7 @@
|
||||
export const jsonStringify = jsonMetadata => {
|
||||
if (!jsonMetadata) return '';
|
||||
if (!jsonMetadata) {
|
||||
return '';
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.stringify(jsonMetadata);
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -1,5 +1,7 @@
|
||||
export default strVal => {
|
||||
if (!strVal) return 0;
|
||||
if (!strVal) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Number(parseFloat(strVal.split(' ')[0]));
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user