mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 13:22:02 +03:00
changed global variable with & dropdown redesign done
This commit is contained in:
commit
c82250b6e8
8
package-lock.json
generated
8
package-lock.json
generated
@ -8973,14 +8973,6 @@
|
|||||||
"prop-types": "^15.5.10"
|
"prop-types": "^15.5.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-native-theming": {
|
|
||||||
"version": "1.0.16",
|
|
||||||
"resolved": "https://registry.npmjs.org/react-native-theming/-/react-native-theming-1.0.16.tgz",
|
|
||||||
"integrity": "sha512-f8P7F3yKW9i+PmsmZo98V933Ggsu6YpsBw8pvNEAOENnNqbFmeDL6K+89F0WmkpF6bSs/qqSbyGUWKvCgNhBkw==",
|
|
||||||
"requires": {
|
|
||||||
"prop-types": "^15.6.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"react-native-vector-icons": {
|
"react-native-vector-icons": {
|
||||||
"version": "4.6.0",
|
"version": "4.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-vector-icons/-/react-native-vector-icons-4.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-vector-icons/-/react-native-vector-icons-4.6.0.tgz",
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
"react-native-navigation": "^2.0.2519",
|
"react-native-navigation": "^2.0.2519",
|
||||||
"react-native-restart": "0.0.6",
|
"react-native-restart": "0.0.6",
|
||||||
"react-native-slider": "^0.11.0",
|
"react-native-slider": "^0.11.0",
|
||||||
"react-native-theming": "^1.0.16",
|
|
||||||
"react-native-vector-icons": "^4.6.0",
|
"react-native-vector-icons": "^4.6.0",
|
||||||
"react-redux": "^5.0.7",
|
"react-redux": "^5.0.7",
|
||||||
"realm": "^2.15.3",
|
"realm": "^2.15.3",
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import GreetingHeaderButton from "./views/greetingHeaderButtonView";
|
import TextButton from "./views/textButtonView";
|
||||||
|
|
||||||
export { GreetingHeaderButton };
|
export { TextButton };
|
||||||
|
@ -2,6 +2,8 @@ import EStyleSheet from "react-native-extended-stylesheet";
|
|||||||
|
|
||||||
export default EStyleSheet.create({
|
export default EStyleSheet.create({
|
||||||
button: {
|
button: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
width: 54,
|
width: 54,
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
height: 19,
|
height: 19,
|
@ -1,9 +1,9 @@
|
|||||||
import React, { Fragment } from "react";
|
import React, { Fragment } from "react";
|
||||||
import { TouchableWithoutFeedback, Text, View } from "react-native";
|
import { TouchableWithoutFeedback, Text, View } from "react-native";
|
||||||
|
|
||||||
import styles from "./greetingHeaderButtonStyles";
|
import styles from "./textButtonStyles";
|
||||||
|
|
||||||
const GreetingHeaderButtonView = ({ text, onPress, style }) => (
|
const TextButtonView = ({ text, onPress, style }) => (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<TouchableWithoutFeedback
|
<TouchableWithoutFeedback
|
||||||
style={[styles.button, style]}
|
style={[styles.button, style]}
|
||||||
@ -16,4 +16,4 @@ const GreetingHeaderButtonView = ({ text, onPress, style }) => (
|
|||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default GreetingHeaderButtonView;
|
export default TextButtonView;
|
@ -13,7 +13,7 @@ export default EStyleSheet.create({
|
|||||||
title: {
|
title: {
|
||||||
alignSelf: "flex-start",
|
alignSelf: "flex-start",
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
marginLeft: 26,
|
marginLeft: 26,
|
||||||
},
|
},
|
||||||
|
@ -8,10 +8,9 @@ export default EStyleSheet.create({
|
|||||||
alignSelf: "flex-start",
|
alignSelf: "flex-start",
|
||||||
height: 35,
|
height: 35,
|
||||||
},
|
},
|
||||||
dropdownWrapper: {},
|
|
||||||
dropdownText: {
|
dropdownText: {
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
marginLeft: 25,
|
marginLeft: 25,
|
||||||
},
|
},
|
||||||
dropdownIcon: {
|
dropdownIcon: {
|
||||||
@ -37,7 +36,7 @@ export default EStyleSheet.create({
|
|||||||
},
|
},
|
||||||
dropdownText: {
|
dropdownText: {
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
padding: 5,
|
padding: 5,
|
||||||
borderColor: "#e7e7e7",
|
borderColor: "#e7e7e7",
|
||||||
},
|
},
|
||||||
@ -51,7 +50,7 @@ export default EStyleSheet.create({
|
|||||||
buttonText: {
|
buttonText: {
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
fontWeight: "normal",
|
fontWeight: "normal",
|
||||||
},
|
},
|
||||||
rowWrapper: {
|
rowWrapper: {
|
||||||
@ -70,16 +69,17 @@ export default EStyleSheet.create({
|
|||||||
borderRadius: 20,
|
borderRadius: 20,
|
||||||
height: 35,
|
height: 35,
|
||||||
backgroundColor: "$primaryBlue",
|
backgroundColor: "$primaryBlue",
|
||||||
marginLeft: 5,
|
alignSelf: "flex-start",
|
||||||
width: "$deviceWidth / 3.2",
|
paddingLeft: 11,
|
||||||
|
paddingRight: 11,
|
||||||
|
marginLeft: 20,
|
||||||
},
|
},
|
||||||
highlightedRowText: {
|
highlightedRowText: {
|
||||||
textAlign: "center",
|
color: "$white",
|
||||||
color: "#fff",
|
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
},
|
},
|
||||||
rowText: {
|
rowText: {
|
||||||
fontSize: 10,
|
fontSize: 9,
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -12,7 +12,7 @@ import Ionicons from "react-native-vector-icons/Ionicons";
|
|||||||
// Styles
|
// Styles
|
||||||
import styles from "./dropdownButtonStyles";
|
import styles from "./dropdownButtonStyles";
|
||||||
|
|
||||||
/* Props
|
/* Props TODO: Fill all description
|
||||||
* ------------------------------------------------
|
* ------------------------------------------------
|
||||||
* @prop { string } defaultText - Description....
|
* @prop { string } defaultText - Description....
|
||||||
* @prop { string } iconName - Description....
|
* @prop { string } iconName - Description....
|
||||||
@ -35,13 +35,6 @@ const renderDropdownRow = (rowData, rowID, highlighted) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// const _dropdown_2_renderButtonText = rowData => {
|
|
||||||
// const { name, age } = rowData;
|
|
||||||
// return `${name} - ${age}`;
|
|
||||||
// };
|
|
||||||
|
|
||||||
const renderDropdownSeperator = () => null;
|
|
||||||
|
|
||||||
const DropdownButtonView = ({
|
const DropdownButtonView = ({
|
||||||
defaultText,
|
defaultText,
|
||||||
iconName,
|
iconName,
|
||||||
@ -50,7 +43,6 @@ const DropdownButtonView = ({
|
|||||||
defaultIndex,
|
defaultIndex,
|
||||||
}) => (
|
}) => (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<View style={styles.dropdownWrapper}>
|
|
||||||
<ModalDropdown
|
<ModalDropdown
|
||||||
style={styles.button}
|
style={styles.button}
|
||||||
textStyle={styles.buttonText}
|
textStyle={styles.buttonText}
|
||||||
@ -61,13 +53,11 @@ const DropdownButtonView = ({
|
|||||||
onSelect={e => onSelect && onSelect(e)}
|
onSelect={e => onSelect && onSelect(e)}
|
||||||
defaultIndex={defaultIndex}
|
defaultIndex={defaultIndex}
|
||||||
defaultValue={defaultText}
|
defaultValue={defaultText}
|
||||||
// renderButtonText={rowData => _dropdown_2_renderButtonText(rowData)}
|
renderSeparator={() => null}
|
||||||
renderSeparator={() => renderDropdownSeperator()}
|
|
||||||
renderRow={(rowData, rowID, highlighted) =>
|
renderRow={(rowData, rowID, highlighted) =>
|
||||||
renderDropdownRow(rowData, rowID, highlighted)
|
renderDropdownRow(rowData, rowID, highlighted)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</View>
|
|
||||||
<View style={styles.iconWrapper}>
|
<View style={styles.iconWrapper}>
|
||||||
<Ionicons
|
<Ionicons
|
||||||
style={styles.dropdownIcon}
|
style={styles.dropdownIcon}
|
||||||
|
@ -29,27 +29,34 @@ class FormInputView extends Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
value: "",
|
value: "",
|
||||||
inputBorderColor: "#c1c5c7",
|
inputBorderColor: "#c1c5c7",
|
||||||
|
isValid: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Component Life Cycles
|
// Component Life Cycles
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const { isValid } = this.props;
|
||||||
|
|
||||||
|
if (nextProps.isValid !== isValid) {
|
||||||
|
this.setState({ isValid: nextProps.isValid });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Component Functions
|
// Component Functions
|
||||||
_handleOnChange = value => {
|
_handleOnChange = value => {
|
||||||
const { onChange } = this.props;
|
const { onChange } = this.props;
|
||||||
|
|
||||||
value && this.setState({ value });
|
this.setState({ value });
|
||||||
onChange && value && onChange(value);
|
onChange && onChange(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { inputBorderColor, value } = this.state;
|
const { inputBorderColor, isValid, value } = this.state;
|
||||||
const {
|
const {
|
||||||
placeholder,
|
placeholder,
|
||||||
type,
|
type,
|
||||||
isFirstImage,
|
isFirstImage,
|
||||||
isEditable,
|
isEditable,
|
||||||
isValid,
|
|
||||||
leftIconName,
|
leftIconName,
|
||||||
rightIconName,
|
rightIconName,
|
||||||
secureTextEntry,
|
secureTextEntry,
|
||||||
|
@ -15,6 +15,6 @@ export default EStyleSheet.create({
|
|||||||
infoText: {
|
infoText: {
|
||||||
flex: 0.875,
|
flex: 0.875,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@ export default EStyleSheet.create({
|
|||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: "400",
|
fontWeight: "400",
|
||||||
},
|
},
|
||||||
@ -22,7 +22,7 @@ export default EStyleSheet.create({
|
|||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
marginBottom: 16,
|
marginBottom: 16,
|
||||||
},
|
},
|
||||||
mascot: {
|
mascot: {
|
||||||
|
@ -3,7 +3,7 @@ import { View, Text, Image } from "react-native";
|
|||||||
// Constants
|
// Constants
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import { GreetingHeaderButton } from "../../buttons";
|
import { TextButton } from "../../buttons";
|
||||||
import { LineBreak } from "../../basicUIElements";
|
import { LineBreak } from "../../basicUIElements";
|
||||||
// Styles
|
// Styles
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
@ -36,7 +36,7 @@ class LoginHeaderView extends Component {
|
|||||||
source={require("../../../assets/esteem.png")}
|
source={require("../../../assets/esteem.png")}
|
||||||
/>
|
/>
|
||||||
<View style={styles.headerButton}>
|
<View style={styles.headerButton}>
|
||||||
<GreetingHeaderButton onPress={onPress} text="Sign up" />
|
<TextButton onPress={onPress} text="Sign up" />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{!isKeyboardOpen && (
|
{!isKeyboardOpen && (
|
||||||
|
@ -45,4 +45,7 @@ export default EStyleSheet.create({
|
|||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
},
|
},
|
||||||
|
disableTouchable: {
|
||||||
|
backgroundColor: "#c1c5c7",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
@ -30,16 +30,29 @@ class MainButton extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {};
|
this.state = {
|
||||||
|
isDisable: !props.isLoading && props.isDisable,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Component Life Cycles
|
// Component Life Cycles
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
const { isLoading, isDisable } = this.props;
|
||||||
|
if (
|
||||||
|
nextProps.isLoading !== isLoading ||
|
||||||
|
nextProps.isDisable !== isDisable
|
||||||
|
) {
|
||||||
|
this.setState({
|
||||||
|
isDisable: !nextProps.isLoading && nextProps.isDisable,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Component Functions
|
// Component Functions
|
||||||
_handleOnPress = () => {
|
_handleOnPress = () => {
|
||||||
const { onPress, isDisable, source } = this.props;
|
const { onPress } = this.props;
|
||||||
|
|
||||||
onPress && !isDisable && onPress();
|
onPress && onPress();
|
||||||
};
|
};
|
||||||
|
|
||||||
_getBody = () => {
|
_getBody = () => {
|
||||||
@ -75,13 +88,15 @@ class MainButton extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { wrapperStyle, isDisable } = this.props;
|
const { wrapperStyle } = this.props;
|
||||||
|
const { isDisable } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={wrapperStyle}>
|
<View style={wrapperStyle}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
disabled={isDisable}
|
||||||
onPress={() => this._handleOnPress()}
|
onPress={() => this._handleOnPress()}
|
||||||
style={styles.touchable}
|
style={[styles.touchable, isDisable && styles.disableTouchable]}
|
||||||
>
|
>
|
||||||
<View style={styles.body}>{this._getBody()}</View>
|
<View style={styles.body}>{this._getBody()}</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
@ -40,7 +40,7 @@ export default EStyleSheet.create({
|
|||||||
fontWeight: "bold",
|
fontWeight: "bold",
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
},
|
},
|
||||||
description: {
|
description: {
|
||||||
color: "#3c4449",
|
color: "#3c4449",
|
||||||
@ -48,7 +48,7 @@ export default EStyleSheet.create({
|
|||||||
fontWeight: "500",
|
fontWeight: "500",
|
||||||
},
|
},
|
||||||
scrollView: {
|
scrollView: {
|
||||||
height: "$deviceHeight / 1.25",
|
height: "$deviceHeight / 1.35",
|
||||||
},
|
},
|
||||||
isNewNotification: {
|
isNewNotification: {
|
||||||
backgroundColor: "#eaf2fc",
|
backgroundColor: "#eaf2fc",
|
||||||
|
@ -98,7 +98,7 @@ export default class Search extends Component {
|
|||||||
flex: 0.1,
|
flex: 0.1,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
top: 10,
|
top: 10,
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@ -133,9 +133,7 @@ export default class Search extends Component {
|
|||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
horizontal={true}
|
horizontal={true}
|
||||||
renderItem={({ item }) => (
|
renderItem={({ item }) => (
|
||||||
<View
|
<View style={{ margin: 10, flexDirection: "column" }}>
|
||||||
style={{ margin: 10, flexDirection: "column" }}
|
|
||||||
>
|
|
||||||
<Image
|
<Image
|
||||||
style={{
|
style={{
|
||||||
width: 50,
|
width: 50,
|
||||||
|
@ -261,7 +261,7 @@ export const upvote = (vote, postingKey) => {
|
|||||||
* @method upvoteAmount estimate upvote amount
|
* @method upvoteAmount estimate upvote amount
|
||||||
*/
|
*/
|
||||||
export const upvoteAmount = async input => {
|
export const upvoteAmount = async input => {
|
||||||
if (rewardFund == null || medianPrice == null) {
|
if (!rewardFund || !medianPrice) {
|
||||||
rewardFund = await client.database.call("get_reward_fund", ["post"]);
|
rewardFund = await client.database.call("get_reward_fund", ["post"]);
|
||||||
|
|
||||||
await client.database
|
await client.database
|
||||||
@ -533,10 +533,7 @@ export const postContent = (data, postingKey) => {
|
|||||||
|
|
||||||
export const lookupAccounts = async username => {
|
export const lookupAccounts = async username => {
|
||||||
try {
|
try {
|
||||||
let users = await client.database.call("lookup_accounts", [
|
let users = await client.database.call("lookup_accounts", [username, 20]);
|
||||||
username,
|
|
||||||
20,
|
|
||||||
]);
|
|
||||||
return users;
|
return users;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw error;
|
throw error;
|
||||||
|
@ -22,15 +22,11 @@ import { PostCard } from "../../../components/postCard";
|
|||||||
|
|
||||||
import Comment from "../../../components/comment/comment";
|
import Comment from "../../../components/comment/comment";
|
||||||
|
|
||||||
// TODO: Make utils for all using moment.
|
import { getTimeFromNow } from "../../../utils/time";
|
||||||
import moment from "moment";
|
|
||||||
|
|
||||||
//import Icon from "react-native-vector-icons/FontAwesome";
|
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
import styles from "./authorStyles";
|
import styles from "./authorStyles";
|
||||||
|
|
||||||
//import themes from "../../styles/themes";
|
|
||||||
import {
|
import {
|
||||||
followUser,
|
followUser,
|
||||||
unfollowUser,
|
unfollowUser,
|
||||||
@ -114,7 +110,7 @@ class AuthorScreen extends Component {
|
|||||||
isLoggedIn = res;
|
isLoggedIn = res;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoggedIn == true) {
|
if (isLoggedIn) {
|
||||||
getUserData()
|
getUserData()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
user = Array.from(res);
|
user = Array.from(res);
|
||||||
@ -184,7 +180,7 @@ class AuthorScreen extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getMore = () => {
|
getMore = () => {
|
||||||
if (this.state.loading == true) {
|
if (this.state.loading) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
getPosts(
|
getPosts(
|
||||||
@ -299,7 +295,7 @@ class AuthorScreen extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
renderFooter = () => {
|
renderFooter = () => {
|
||||||
if (!this.state.loading == false) return null;
|
if (this.state.loading) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ marginVertical: 20 }}>
|
<View style={{ marginVertical: 20 }}>
|
||||||
@ -343,7 +339,7 @@ class AuthorScreen extends Component {
|
|||||||
{this.state.author.name}
|
{this.state.author.name}
|
||||||
</Text>
|
</Text>
|
||||||
<Text>{this.state.about.about}</Text>
|
<Text>{this.state.about.about}</Text>
|
||||||
{this.state.isFolllowing == true ? (
|
{this.state.isFolllowing ? (
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
this.unfollow();
|
this.unfollow();
|
||||||
@ -421,10 +417,7 @@ class AuthorScreen extends Component {
|
|||||||
}}
|
}}
|
||||||
name="md-calendar"
|
name="md-calendar"
|
||||||
/>
|
/>
|
||||||
{moment
|
{getTimeFromNow(this.state.author.created)}
|
||||||
.utc(this.state.author.created)
|
|
||||||
.local()
|
|
||||||
.fromNow()}
|
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</CardItem>
|
</CardItem>
|
||||||
@ -458,7 +451,7 @@ class AuthorScreen extends Component {
|
|||||||
)}
|
)}
|
||||||
keyExtractor={(post, index) => index.toString()}
|
keyExtractor={(post, index) => index.toString()}
|
||||||
onEndReached={info => {
|
onEndReached={info => {
|
||||||
if (this.state.loading == false) {
|
if (!this.state.loading) {
|
||||||
console.log(info);
|
console.log(info);
|
||||||
this.getMore();
|
this.getMore();
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ export default class Home extends React.PureComponent {
|
|||||||
isLoggedIn = res;
|
isLoggedIn = res;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoggedIn == true) {
|
if (isLoggedIn) {
|
||||||
await getUserData().then(res => {
|
await getUserData().then(res => {
|
||||||
user = Array.from(res);
|
user = Array.from(res);
|
||||||
});
|
});
|
||||||
@ -118,7 +118,7 @@ export default class Home extends React.PureComponent {
|
|||||||
style={styles.tabbar}
|
style={styles.tabbar}
|
||||||
tabUnderlineDefaultWidth={80} // default containerWidth / (numberOfTabs * 4)
|
tabUnderlineDefaultWidth={80} // default containerWidth / (numberOfTabs * 4)
|
||||||
tabUnderlineScaleX={2} // default 3
|
tabUnderlineScaleX={2} // default 3
|
||||||
activeColor={"$primaryBlue"}
|
activeColor={"#357ce6"}
|
||||||
inactiveColor={"#222"}
|
inactiveColor={"#222"}
|
||||||
tabBarPosition="overlayTop"
|
tabBarPosition="overlayTop"
|
||||||
/>
|
/>
|
||||||
|
@ -5,7 +5,7 @@ import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
|||||||
|
|
||||||
// Internal Components
|
// Internal Components
|
||||||
import { FormInput } from "../../../components/formInput";
|
import { FormInput } from "../../../components/formInput";
|
||||||
import { GreetingHeaderButton } from "../../../components/buttons";
|
import { TextButton } from "../../../components/buttons";
|
||||||
import { InformationArea } from "../../../components/informationArea";
|
import { InformationArea } from "../../../components/informationArea";
|
||||||
import { Login } from "../../../providers/steem/auth";
|
import { Login } from "../../../providers/steem/auth";
|
||||||
import { LoginHeader } from "../../../components/loginHeader";
|
import { LoginHeader } from "../../../components/loginHeader";
|
||||||
@ -29,7 +29,7 @@ class LoginScreen extends Component {
|
|||||||
username: "",
|
username: "",
|
||||||
password: "",
|
password: "",
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isUsernameValid: true,
|
isUsernameValid: false,
|
||||||
keyboardIsOpen: false,
|
keyboardIsOpen: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -109,7 +109,14 @@ class LoginScreen extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { isLoading, username, isUsernameValid, keyboardIsOpen } = this.state;
|
const {
|
||||||
|
isLoading,
|
||||||
|
username,
|
||||||
|
isUsernameValid,
|
||||||
|
keyboardIsOpen,
|
||||||
|
password,
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<StatusBar hidden translucent />
|
<StatusBar hidden translucent />
|
||||||
@ -131,7 +138,7 @@ class LoginScreen extends Component {
|
|||||||
style={styles.tabbar}
|
style={styles.tabbar}
|
||||||
tabUnderlineDefaultWidth={100} // default containerWidth / (numberOfTabs * 4)
|
tabUnderlineDefaultWidth={100} // default containerWidth / (numberOfTabs * 4)
|
||||||
tabUnderlineScaleX={2} // default 3
|
tabUnderlineScaleX={2} // default 3
|
||||||
activeColor={"$primaryBlue"}
|
activeColor={"#357ce6"}
|
||||||
inactiveColor={"#222"}
|
inactiveColor={"#222"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -163,14 +170,18 @@ class LoginScreen extends Component {
|
|||||||
removed upon logout!"
|
removed upon logout!"
|
||||||
iconName="ios-information-circle-outline"
|
iconName="ios-information-circle-outline"
|
||||||
/>
|
/>
|
||||||
{/* It will remove */}
|
<View style={styles.footerButtons}>
|
||||||
<GreetingHeaderButton onPress={goToAuthScreens} text="cancel" />
|
<TextButton onPress={goToAuthScreens} text="cancel" />
|
||||||
|
</View>
|
||||||
<MainButton
|
<MainButton
|
||||||
wrapperStyle={styles.mainButtonWrapper}
|
wrapperStyle={styles.mainButtonWrapper}
|
||||||
onPress={this._handleOnPressLogin}
|
onPress={this._handleOnPressLogin}
|
||||||
iconName="md-person"
|
iconName="md-person"
|
||||||
iconColor="white"
|
iconColor="white"
|
||||||
text="LOGIN"
|
text="LOGIN"
|
||||||
|
isDisable={
|
||||||
|
!isUsernameValid || password.length < 2 || username.length < 2
|
||||||
|
}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
@ -179,7 +190,6 @@ class LoginScreen extends Component {
|
|||||||
description="If you don't want to keep your password encrypted and saved on your device, you can use Steemconnect."
|
description="If you don't want to keep your password encrypted and saved on your device, you can use Steemconnect."
|
||||||
iconName="ios-information-circle-outline"
|
iconName="ios-information-circle-outline"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<MainButton
|
<MainButton
|
||||||
wrapperStyle={styles.mainButtonWrapper}
|
wrapperStyle={styles.mainButtonWrapper}
|
||||||
onPress={this._loginwithSc2}
|
onPress={this._loginwithSc2}
|
||||||
|
@ -50,4 +50,14 @@ export default EStyleSheet.create({
|
|||||||
bottom: 24,
|
bottom: 24,
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
},
|
},
|
||||||
|
footerButtons: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
alignSelf: "flex-end",
|
||||||
|
position: "absolute",
|
||||||
|
bottom: 45,
|
||||||
|
left: "$deviceWidth / 2.3",
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { Fragment } from "react";
|
import React, { Fragment } from "react";
|
||||||
import { Text, View } from "react-native";
|
import { Text, View, SafeAreaView } from "react-native";
|
||||||
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
||||||
import { TabBar } from "../../../components/tabBar";
|
import { TabBar } from "../../../components/tabBar";
|
||||||
import { Notification } from "../../../components/notification";
|
import { Notification } from "../../../components/notification";
|
||||||
@ -9,7 +9,7 @@ import styles from "./notificationStyles";
|
|||||||
class NotificationScreen extends React.Component {
|
class NotificationScreen extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<SafeAreaView style={{ flex: 1, backgroundColor: "#fff" }}>
|
||||||
<ScrollableTabView
|
<ScrollableTabView
|
||||||
style={styles.tabView}
|
style={styles.tabView}
|
||||||
renderTabBar={() => (
|
renderTabBar={() => (
|
||||||
@ -17,7 +17,7 @@ class NotificationScreen extends React.Component {
|
|||||||
style={styles.tabbar}
|
style={styles.tabbar}
|
||||||
tabUnderlineDefaultWidth={100}
|
tabUnderlineDefaultWidth={100}
|
||||||
tabUnderlineScaleX={2}
|
tabUnderlineScaleX={2}
|
||||||
activeColor={"$primaryBlue"}
|
activeColor={"#357ce6"}
|
||||||
inactiveColor={"#222"}
|
inactiveColor={"#222"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
@ -29,7 +29,7 @@ class NotificationScreen extends React.Component {
|
|||||||
<Text>Leaderboard</Text>
|
<Text>Leaderboard</Text>
|
||||||
</View>
|
</View>
|
||||||
</ScrollableTabView>
|
</ScrollableTabView>
|
||||||
</Fragment>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { FlatList, ActivityIndicator } from "react-native";
|
import { FlatList, ActivityIndicator } from "react-native";
|
||||||
|
|
||||||
import moment from "moment";
|
import { getTimeFromNow } from "../../utils/time";
|
||||||
import FastImage from "react-native-fast-image";
|
import FastImage from "react-native-fast-image";
|
||||||
|
|
||||||
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
||||||
@ -11,7 +11,7 @@ import DiscoverPage from "../discover/discover";
|
|||||||
import { PostCard } from "../../components/postCard";
|
import { PostCard } from "../../components/postCard";
|
||||||
import Comment from "../../components/comment/comment";
|
import Comment from "../../components/comment/comment";
|
||||||
|
|
||||||
import { Card, CardItem, View, Body, Title, Container } from "native-base";
|
import { Card, CardItem, View, Body } from "native-base";
|
||||||
|
|
||||||
import { getUserData, getAuthStatus } from "../../realm/realm";
|
import { getUserData, getAuthStatus } from "../../realm/realm";
|
||||||
import {
|
import {
|
||||||
@ -19,7 +19,6 @@ import {
|
|||||||
getFollows,
|
getFollows,
|
||||||
getPosts,
|
getPosts,
|
||||||
getUserComments,
|
getUserComments,
|
||||||
getUserReplies,
|
|
||||||
} from "../../providers/steem/dsteem";
|
} from "../../providers/steem/dsteem";
|
||||||
import styles from "../../styles/profile.styles";
|
import styles from "../../styles/profile.styles";
|
||||||
/* eslint-enable no-unused-vars */
|
/* eslint-enable no-unused-vars */
|
||||||
@ -76,7 +75,7 @@ class ProfilePage extends React.Component {
|
|||||||
isLoggedIn = res;
|
isLoggedIn = res;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoggedIn == true) {
|
if (isLoggedIn) {
|
||||||
await getUserData().then(res => {
|
await getUserData().then(res => {
|
||||||
userData = Array.from(res);
|
userData = Array.from(res);
|
||||||
});
|
});
|
||||||
@ -103,7 +102,7 @@ class ProfilePage extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderFooter = () => {
|
renderFooter = () => {
|
||||||
if (!this.state.loading == false) return null;
|
if (this.state.loading) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ marginVertical: 20 }}>
|
<View style={{ marginVertical: 20 }}>
|
||||||
@ -235,10 +234,7 @@ class ProfilePage extends React.Component {
|
|||||||
}}
|
}}
|
||||||
name="md-calendar"
|
name="md-calendar"
|
||||||
/>
|
/>
|
||||||
{moment
|
{getTimeFromNow(this.state.user.created)}
|
||||||
.utc(this.state.user.created)
|
|
||||||
.local()
|
|
||||||
.fromNow()}
|
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</CardItem>
|
</CardItem>
|
||||||
@ -271,7 +267,7 @@ class ProfilePage extends React.Component {
|
|||||||
)}
|
)}
|
||||||
keyExtractor={(post, index) => index.toString()}
|
keyExtractor={(post, index) => index.toString()}
|
||||||
onEndReached={info => {
|
onEndReached={info => {
|
||||||
if (this.state.loading == false) {
|
if (!this.state.loading) {
|
||||||
console.log(info);
|
console.log(info);
|
||||||
this.getMore();
|
this.getMore();
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { FlatList, ActivityIndicator } from "react-native";
|
import { FlatList, ActivityIndicator } from "react-native";
|
||||||
|
|
||||||
import moment from "moment";
|
import { getTimeFromNow } from "../../../utils/time";
|
||||||
import FastImage from "react-native-fast-image";
|
import FastImage from "react-native-fast-image";
|
||||||
|
|
||||||
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
import ScrollableTabView from "@esteemapp/react-native-scrollable-tab-view";
|
||||||
@ -72,7 +72,7 @@ class ProfileScreen extends React.Component {
|
|||||||
const isLoggedIn = res;
|
const isLoggedIn = res;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoggedIn === true) {
|
if (isLoggedIn) {
|
||||||
let user;
|
let user;
|
||||||
let userData;
|
let userData;
|
||||||
let follows;
|
let follows;
|
||||||
@ -105,7 +105,7 @@ class ProfileScreen extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderFooter = () => {
|
renderFooter = () => {
|
||||||
if (!this.state.loading == false) return null;
|
if (this.state.loading) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{ marginVertical: 20 }}>
|
<View style={{ marginVertical: 20 }}>
|
||||||
@ -238,10 +238,7 @@ class ProfileScreen extends React.Component {
|
|||||||
}}
|
}}
|
||||||
name="md-calendar"
|
name="md-calendar"
|
||||||
/>
|
/>
|
||||||
{moment
|
{getTimeFromNow(this.state.user.created)}
|
||||||
.utc(this.state.user.created)
|
|
||||||
.local()
|
|
||||||
.fromNow()}
|
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
</CardItem>
|
</CardItem>
|
||||||
@ -274,7 +271,7 @@ class ProfileScreen extends React.Component {
|
|||||||
)}
|
)}
|
||||||
keyExtractor={(post, index) => index.toString()}
|
keyExtractor={(post, index) => index.toString()}
|
||||||
onEndReached={info => {
|
onEndReached={info => {
|
||||||
if (this.state.loading == false) {
|
if (!this.state.loading) {
|
||||||
console.log(info);
|
console.log(info);
|
||||||
this.getMore();
|
this.getMore();
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ export class AuthLoadingScreen extends React.Component {
|
|||||||
checkAuth = async () => {
|
checkAuth = async () => {
|
||||||
await getAuthStatus()
|
await getAuthStatus()
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result === true) {
|
if (result) {
|
||||||
getUserData()
|
getUserData()
|
||||||
.then(userData => {
|
.then(userData => {
|
||||||
// This will switch to the App screen or Auth screen and this loading
|
// This will switch to the App screen or Auth screen and this loading
|
||||||
|
@ -24,7 +24,7 @@ class SideMenuScreen extends Component {
|
|||||||
isLoggedIn = res;
|
isLoggedIn = res;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoggedIn == true) {
|
if (isLoggedIn) {
|
||||||
await getUserData().then(res => {
|
await getUserData().then(res => {
|
||||||
user = Array.from(res);
|
user = Array.from(res);
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@ class SplashContainer extends React.Component {
|
|||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
await getAuthStatus()
|
await getAuthStatus()
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result === true) {
|
if (result) {
|
||||||
goToAuthScreens();
|
goToAuthScreens();
|
||||||
} else {
|
} else {
|
||||||
goToNoAuthScreens();
|
goToNoAuthScreens();
|
||||||
|
@ -17,16 +17,14 @@ export default class SteemConnect extends Component {
|
|||||||
if (event.url.indexOf("?access_token=") > -1) {
|
if (event.url.indexOf("?access_token=") > -1) {
|
||||||
this.webview.stopLoading();
|
this.webview.stopLoading();
|
||||||
try {
|
try {
|
||||||
access_token = event.url.match(
|
access_token = event.url.match(/\?(?:access_token)\=([\S\s]*?)\&/)[1];
|
||||||
/\?(?:access_token)\=([\S\s]*?)\&/
|
|
||||||
)[1];
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
loginWithSC2(access_token, "pinCode")
|
loginWithSC2(access_token, "pinCode")
|
||||||
.then(result => {
|
.then(result => {
|
||||||
if (result === true) {
|
if (result) {
|
||||||
// TODO: Handle pinCode and navigate to home page
|
// TODO: Handle pinCode and navigate to home page
|
||||||
goToAuthScreens();
|
goToAuthScreens();
|
||||||
} else {
|
} else {
|
||||||
@ -51,9 +49,7 @@ export default class SteemConnect extends Component {
|
|||||||
steemConnectOptions.redirect_uri
|
steemConnectOptions.redirect_uri
|
||||||
)}&${encodeURIComponent(steemConnectOptions.scope)}`,
|
)}&${encodeURIComponent(steemConnectOptions.scope)}`,
|
||||||
}}
|
}}
|
||||||
onNavigationStateChange={this.onNavigationStateChange.bind(
|
onNavigationStateChange={this.onNavigationStateChange.bind(this)}
|
||||||
this
|
|
||||||
)}
|
|
||||||
ref={ref => {
|
ref={ref => {
|
||||||
this.webview = ref;
|
this.webview = ref;
|
||||||
}}
|
}}
|
||||||
|
@ -42,7 +42,7 @@ class WalletPage extends Component {
|
|||||||
isLoggedIn = res;
|
isLoggedIn = res;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isLoggedIn == true) {
|
if (isLoggedIn) {
|
||||||
await getUserData().then(res => {
|
await getUserData().then(res => {
|
||||||
userData = Array.from(res);
|
userData = Array.from(res);
|
||||||
});
|
});
|
||||||
@ -124,8 +124,7 @@ class WalletPage extends Component {
|
|||||||
let toWithdraw =
|
let toWithdraw =
|
||||||
(vestSteem * 1e6) /
|
(vestSteem * 1e6) /
|
||||||
(parseFloat(this.state.globalProps.total_vesting_fund_steem) /
|
(parseFloat(this.state.globalProps.total_vesting_fund_steem) /
|
||||||
(parseFloat(this.state.globalProps.total_vesting_shares) /
|
(parseFloat(this.state.globalProps.total_vesting_shares) / 1e6));
|
||||||
1e6));
|
|
||||||
console.log(toWithdraw);
|
console.log(toWithdraw);
|
||||||
data = {
|
data = {
|
||||||
delegator: this.state.user.name,
|
delegator: this.state.user.name,
|
||||||
@ -198,8 +197,7 @@ class WalletPage extends Component {
|
|||||||
let toWithdraw =
|
let toWithdraw =
|
||||||
(vestSteem * 1e6) /
|
(vestSteem * 1e6) /
|
||||||
(parseFloat(this.state.globalProps.total_vesting_fund_steem) /
|
(parseFloat(this.state.globalProps.total_vesting_fund_steem) /
|
||||||
(parseFloat(this.state.globalProps.total_vesting_shares) /
|
(parseFloat(this.state.globalProps.total_vesting_shares) / 1e6));
|
||||||
1e6));
|
|
||||||
|
|
||||||
let data = {
|
let data = {
|
||||||
account: this.state.user.name,
|
account: this.state.user.name,
|
||||||
@ -226,26 +224,18 @@ class WalletPage extends Component {
|
|||||||
<Text>SBD Balance: {this.state.user.sbd_balance}</Text>
|
<Text>SBD Balance: {this.state.user.sbd_balance}</Text>
|
||||||
</Card>
|
</Card>
|
||||||
<Card>
|
<Card>
|
||||||
|
<Text>STEEM Power: {this.state.user.steem_power} SP</Text>
|
||||||
<Text>
|
<Text>
|
||||||
STEEM Power: {this.state.user.steem_power} SP
|
Received STEEM Power: {this.state.user.received_steem_power} SP
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
Received STEEM Power:{" "}
|
Delegated Power Power: {this.state.user.delegated_steem_power} SP
|
||||||
{this.state.user.received_steem_power} SP
|
|
||||||
</Text>
|
|
||||||
<Text>
|
|
||||||
Delegated Power Power:{" "}
|
|
||||||
{this.state.user.delegated_steem_power} SP
|
|
||||||
</Text>
|
</Text>
|
||||||
</Card>
|
</Card>
|
||||||
<Card>
|
<Card>
|
||||||
|
<Text>Saving STEEM Balance: {this.state.user.savings_balance}</Text>
|
||||||
<Text>
|
<Text>
|
||||||
Saving STEEM Balance:{" "}
|
Saving STEEM Balance: {this.state.user.savings_sbd_balance}
|
||||||
{this.state.user.savings_balance}
|
|
||||||
</Text>
|
|
||||||
<Text>
|
|
||||||
Saving STEEM Balance:{" "}
|
|
||||||
{this.state.user.savings_sbd_balance}
|
|
||||||
</Text>
|
</Text>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
@ -259,9 +249,7 @@ class WalletPage extends Component {
|
|||||||
}}
|
}}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
placeholder="Recipient"
|
placeholder="Recipient"
|
||||||
onChangeText={user =>
|
onChangeText={user => this.setState({ receiver: user })}
|
||||||
this.setState({ receiver: user })
|
|
||||||
}
|
|
||||||
value={this.state.receiver}
|
value={this.state.receiver}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
@ -272,9 +260,7 @@ class WalletPage extends Component {
|
|||||||
margin: 10,
|
margin: 10,
|
||||||
}}
|
}}
|
||||||
placeholder="amount"
|
placeholder="amount"
|
||||||
onChangeText={amount =>
|
onChangeText={amount => this.setState({ amount: amount })}
|
||||||
this.setState({ amount: amount })
|
|
||||||
}
|
|
||||||
value={this.state.amount}
|
value={this.state.amount}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
@ -301,10 +287,7 @@ class WalletPage extends Component {
|
|||||||
<Picker.Item label="STEEM" value="STEEM" />
|
<Picker.Item label="STEEM" value="STEEM" />
|
||||||
<Picker.Item label="SBD" value="SBD" />
|
<Picker.Item label="SBD" value="SBD" />
|
||||||
</Picker>
|
</Picker>
|
||||||
<Button
|
<Button onPress={this.sendSteem} style={{ margin: 10 }}>
|
||||||
onPress={this.sendSteem}
|
|
||||||
style={{ margin: 10 }}
|
|
||||||
>
|
|
||||||
<Text style={{ color: "white" }}>Send</Text>
|
<Text style={{ color: "white" }}>Send</Text>
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
@ -337,18 +320,13 @@ class WalletPage extends Component {
|
|||||||
onValueChange={value => {
|
onValueChange={value => {
|
||||||
this.setState({
|
this.setState({
|
||||||
value: value,
|
value: value,
|
||||||
percent: Math.floor(
|
percent: Math.floor(value.toFixed(2) * 100),
|
||||||
value.toFixed(2) * 100
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Text>
|
<Text>
|
||||||
Total:{" "}
|
Total:{" "}
|
||||||
{(parseInt(this.state.vestSteem) *
|
{(parseInt(this.state.vestSteem) * this.state.percent) / 100} SP
|
||||||
this.state.percent) /
|
|
||||||
100}{" "}
|
|
||||||
SP
|
|
||||||
</Text>
|
</Text>
|
||||||
<Text>{Math.floor(this.state.value * 100)}%</Text>
|
<Text>{Math.floor(this.state.value * 100)}%</Text>
|
||||||
<Button
|
<Button
|
||||||
@ -405,40 +383,22 @@ class WalletPage extends Component {
|
|||||||
this.setState(
|
this.setState(
|
||||||
{
|
{
|
||||||
value: value,
|
value: value,
|
||||||
percent: Math.floor(
|
percent: Math.floor(value.toFixed(2) * 100),
|
||||||
value.toFixed(2) * 100
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
let avail =
|
let avail =
|
||||||
parseFloat(
|
parseFloat(this.state.user.vesting_shares) -
|
||||||
this.state.user
|
(parseFloat(this.state.user.to_withdraw) -
|
||||||
.vesting_shares
|
parseFloat(this.state.user.withdrawn)) /
|
||||||
) -
|
|
||||||
(parseFloat(
|
|
||||||
this.state.user.to_withdraw
|
|
||||||
) -
|
|
||||||
parseFloat(
|
|
||||||
this.state.user
|
|
||||||
.withdrawn
|
|
||||||
)) /
|
|
||||||
1e6 -
|
1e6 -
|
||||||
parseFloat(
|
parseFloat(this.state.user.delegated_vesting_shares);
|
||||||
this.state.user
|
|
||||||
.delegated_vesting_shares
|
|
||||||
);
|
|
||||||
let vestSteem = parseFloat(
|
let vestSteem = parseFloat(
|
||||||
parseFloat(
|
parseFloat(
|
||||||
this.state.globalProps
|
this.state.globalProps.total_vesting_fund_steem
|
||||||
.total_vesting_fund_steem
|
|
||||||
) *
|
) *
|
||||||
(parseFloat(
|
(parseFloat(avail * this.state.value) /
|
||||||
avail * this.state.value
|
|
||||||
) /
|
|
||||||
parseFloat(
|
parseFloat(
|
||||||
this.state
|
this.state.globalProps.total_vesting_shares
|
||||||
.globalProps
|
|
||||||
.total_vesting_shares
|
|
||||||
)),
|
)),
|
||||||
6
|
6
|
||||||
);
|
);
|
||||||
@ -446,13 +406,10 @@ class WalletPage extends Component {
|
|||||||
console.log(
|
console.log(
|
||||||
(vestSteem * 1e6) /
|
(vestSteem * 1e6) /
|
||||||
(parseFloat(
|
(parseFloat(
|
||||||
this.state.globalProps
|
this.state.globalProps.total_vesting_fund_steem
|
||||||
.total_vesting_fund_steem
|
|
||||||
) /
|
) /
|
||||||
(parseFloat(
|
(parseFloat(
|
||||||
this.state
|
this.state.globalProps.total_vesting_shares
|
||||||
.globalProps
|
|
||||||
.total_vesting_shares
|
|
||||||
) /
|
) /
|
||||||
1e6))
|
1e6))
|
||||||
);
|
);
|
||||||
@ -462,17 +419,13 @@ class WalletPage extends Component {
|
|||||||
/>
|
/>
|
||||||
<Text>
|
<Text>
|
||||||
Total Steem Power:{" "}
|
Total Steem Power:{" "}
|
||||||
{(parseInt(this.state.vestSteem) *
|
{(parseInt(this.state.vestSteem) * this.state.percent) / 100} SP
|
||||||
this.state.percent) /
|
|
||||||
100}{" "}
|
|
||||||
SP
|
|
||||||
</Text>
|
</Text>
|
||||||
<Text>
|
<Text>
|
||||||
Estimated Weekly:{" "}
|
Estimated Weekly:{" "}
|
||||||
{Math.floor(
|
{Math.floor(
|
||||||
((
|
((
|
||||||
(parseInt(this.state.vestSteem) *
|
(parseInt(this.state.vestSteem) * this.state.percent) /
|
||||||
this.state.percent) /
|
|
||||||
100
|
100
|
||||||
).toFixed(0) /
|
).toFixed(0) /
|
||||||
13) *
|
13) *
|
||||||
@ -485,9 +438,7 @@ class WalletPage extends Component {
|
|||||||
onPress={this.powerDownSteem}
|
onPress={this.powerDownSteem}
|
||||||
style={{ margin: 10, alignSelf: "flex-end" }}
|
style={{ margin: 10, alignSelf: "flex-end" }}
|
||||||
>
|
>
|
||||||
<Text style={{ color: "white" }}>
|
<Text style={{ color: "white" }}>Power Down</Text>
|
||||||
Power Down
|
|
||||||
</Text>
|
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
</Card>
|
</Card>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { createStyle } from "react-native-theming";
|
import EStyleSheet from "react-native-extended-stylesheet";
|
||||||
import { StatusBar, Dimensions } from "react-native";
|
import { StatusBar } from "react-native";
|
||||||
|
|
||||||
const styles = createStyle({
|
export default EStyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
backgroundColor: "#F9F9F9",
|
backgroundColor: "#F9F9F9",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@ -21,7 +21,7 @@ const styles = createStyle({
|
|||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: Dimensions.get("window").width / 30,
|
top: "$deviceWidth / 30",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
},
|
},
|
||||||
flatlistFooter: {
|
flatlistFooter: {
|
||||||
@ -32,5 +32,3 @@ const styles = createStyle({
|
|||||||
borderColor: "#CED0CE",
|
borderColor: "#CED0CE",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default styles;
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import { createStyle } from "react-native-theming";
|
import EStyleSheet from "react-native-extended-stylesheet";
|
||||||
import { Dimensions } from "react-native";
|
|
||||||
|
|
||||||
const deviceWidth = Dimensions.get("window").width;
|
export default EStyleSheet.create({
|
||||||
|
|
||||||
export default createStyle({
|
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
@ -13,6 +10,6 @@ export default createStyle({
|
|||||||
backgroundColor: "#f5f5f5",
|
backgroundColor: "#f5f5f5",
|
||||||
borderRadius: 5,
|
borderRadius: 5,
|
||||||
padding: 15,
|
padding: 15,
|
||||||
minWidth: deviceWidth / 2,
|
minWidth: "$deviceWidth / 2",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { createStyle } from "react-native-theming";
|
import EStyleSheet from "react-native-extended-stylesheet";
|
||||||
import { StatusBar, Dimensions } from "react-native";
|
|
||||||
|
|
||||||
const styles = createStyle({
|
export default EStyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
backgroundColor: "#F9F9F9",
|
backgroundColor: "#F9F9F9",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@ -50,12 +49,10 @@ const styles = createStyle({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
paddingHorizontal: 7,
|
paddingHorizontal: 7,
|
||||||
backgroundColor: "#f9f9f9",
|
backgroundColor: "#f9f9f9",
|
||||||
minWidth: Dimensions.get("window").width,
|
minWidth: "$deviceWidth",
|
||||||
},
|
},
|
||||||
loginButton: {
|
loginButton: {
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
marginTop: 100,
|
marginTop: 100,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default styles;
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { createStyle } from "react-native-theming";
|
import EStyleSheet from "react-native-extended-stylesheet";
|
||||||
import { StatusBar, Dimensions } from "react-native";
|
import { StatusBar } from "react-native";
|
||||||
|
export default EStyleSheet.create({
|
||||||
const styles = createStyle({
|
|
||||||
container: {
|
container: {
|
||||||
backgroundColor: "#F9F9F9",
|
backgroundColor: "#F9F9F9",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@ -21,7 +20,7 @@ const styles = createStyle({
|
|||||||
},
|
},
|
||||||
tabs: {
|
tabs: {
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: Dimensions.get("window").width / 30,
|
top: "$deviceWidth / 30",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
},
|
},
|
||||||
flatlistFooter: {
|
flatlistFooter: {
|
||||||
@ -32,5 +31,3 @@ const styles = createStyle({
|
|||||||
borderColor: "#CED0CE",
|
borderColor: "#CED0CE",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default styles;
|
|
||||||
|
@ -13,7 +13,7 @@ export default EStyleSheet.create({
|
|||||||
marginTop: "$deviceHeight / 8",
|
marginTop: "$deviceHeight / 8",
|
||||||
},
|
},
|
||||||
forgotButtonText: {
|
forgotButtonText: {
|
||||||
color: "#788187",
|
color: "$primaryGray",
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
marginTop: 25,
|
marginTop: 25,
|
||||||
alignSelf: "center",
|
alignSelf: "center",
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
import { createTheme } from 'react-native-theming';
|
|
||||||
|
|
||||||
const fonts = {
|
|
||||||
FONT_SIZE_SMALL: '12',
|
|
||||||
FONT_SIZE_MEDIUM: '14',
|
|
||||||
FONT_SIZE_LARGE: '16',
|
|
||||||
FONT_WEIGHT_LIGHT: '200',
|
|
||||||
FONT_WEIGHT_MEDIUM: '600',
|
|
||||||
FONT_WEIGHT_HEAVY: '800',
|
|
||||||
};
|
|
||||||
|
|
||||||
const themes = [
|
|
||||||
createTheme(
|
|
||||||
{
|
|
||||||
backgroundColor: 'white',
|
|
||||||
textColor: 'black',
|
|
||||||
buttonColor: 'blue',
|
|
||||||
buttonText: 'white',
|
|
||||||
statusBar: 'dark-content',
|
|
||||||
fontSize: fonts.FONT_SIZE_MEDIUM,
|
|
||||||
fontWeight: fonts.FONT_WEIGHT_MEDIUM,
|
|
||||||
},
|
|
||||||
'Light'
|
|
||||||
),
|
|
||||||
createTheme(
|
|
||||||
{
|
|
||||||
backgroundColor: 'black',
|
|
||||||
textColor: 'white',
|
|
||||||
buttonColor: 'yellow',
|
|
||||||
buttonText: 'black',
|
|
||||||
statusBar: 'light-content',
|
|
||||||
fontSize: fonts.FONT_SIZE_MEDIUM,
|
|
||||||
fontWeight: fonts.FONT_WEIGHT_MEDIUM,
|
|
||||||
},
|
|
||||||
'Dark'
|
|
||||||
),
|
|
||||||
];
|
|
27
src/utils/formatter.js
Normal file
27
src/utils/formatter.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// 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) => {
|
||||||
|
if (!postBody) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
postBody = postBody
|
||||||
|
.replace(/(<([^>]+)>)/gi, "") // Remove html tags
|
||||||
|
.replace(/\r?\n|\r/g, " ") // Remove new lines
|
||||||
|
.replace(/(?:https?|ftp):\/\/[\n\S]+/g, "") // Remove urls
|
||||||
|
.trim()
|
||||||
|
.replace(/ +(?= )/g, ""); // Remove all multiple spaces
|
||||||
|
|
||||||
|
if (length) {
|
||||||
|
// Truncate
|
||||||
|
postBody = postBody.substring(0, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
return postBody;
|
||||||
|
};
|
@ -1,7 +1,7 @@
|
|||||||
import Remarkable from "remarkable";
|
import Remarkable from "remarkable";
|
||||||
import { postSummary } from "./postSummary";
|
import { getPostSummary } from "../utils/formatter";
|
||||||
import { reputation } from "./reputation";
|
import { getReputation } from "./reputation";
|
||||||
import moment from "moment";
|
import { getTimeFromNow } from "../utils/time";
|
||||||
|
|
||||||
const md = new Remarkable({ html: true, breaks: true, linkify: true });
|
const md = new Remarkable({ html: true, breaks: true, linkify: true });
|
||||||
|
|
||||||
@ -45,15 +45,7 @@ export const markDown2Html = input => {
|
|||||||
|
|
||||||
output = md.render(output);
|
output = md.render(output);
|
||||||
|
|
||||||
/* eslint-disable */
|
// TODO: Implement Regex --> Look at utls/formatter.js
|
||||||
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;
|
|
||||||
/* eslint-enable */
|
|
||||||
|
|
||||||
// TODO: Implement Regex
|
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
};
|
};
|
||||||
@ -61,21 +53,16 @@ export const markDown2Html = input => {
|
|||||||
export const parsePosts = (posts, user) => {
|
export const parsePosts = (posts, user) => {
|
||||||
posts.map(post => {
|
posts.map(post => {
|
||||||
post.json_metadata = JSON.parse(post.json_metadata);
|
post.json_metadata = JSON.parse(post.json_metadata);
|
||||||
post.json_metadata.image
|
post.json_metadata.image ? (post.image = post.json_metadata.image[0]) : "";
|
||||||
? (post.image = post.json_metadata.image[0])
|
post.pending_payout_value = parseFloat(post.pending_payout_value).toFixed(
|
||||||
: "";
|
2
|
||||||
post.pending_payout_value = parseFloat(
|
);
|
||||||
post.pending_payout_value
|
post.created = getTimeFromNow(post.created);
|
||||||
).toFixed(2);
|
|
||||||
post.created = moment
|
|
||||||
.utc(post.created)
|
|
||||||
.local()
|
|
||||||
.fromNow();
|
|
||||||
post.vote_count = post.active_votes.length;
|
post.vote_count = post.active_votes.length;
|
||||||
post.author_reputation = reputation(post.author_reputation);
|
post.author_reputation = getReputation(post.author_reputation);
|
||||||
post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`;
|
post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`;
|
||||||
post.body = markDown2Html(post.body);
|
post.body = markDown2Html(post.body);
|
||||||
post.summary = postSummary(post.body, 100);
|
post.summary = getPostSummary(post.body, 100);
|
||||||
post.raw_body = post.body;
|
post.raw_body = post.body;
|
||||||
post.active_votes.sort((a, b) => {
|
post.active_votes.sort((a, b) => {
|
||||||
return b.rshares - a.rshares;
|
return b.rshares - a.rshares;
|
||||||
@ -100,7 +87,7 @@ export const parsePosts = (posts, user) => {
|
|||||||
post.active_votes[i].value = (
|
post.active_votes[i].value = (
|
||||||
post.active_votes[i].rshares * ratio
|
post.active_votes[i].rshares * ratio
|
||||||
).toFixed(2);
|
).toFixed(2);
|
||||||
post.active_votes[i].reputation = reputation(
|
post.active_votes[i].reputation = getReputation(
|
||||||
post.active_votes[i].reputation
|
post.active_votes[i].reputation
|
||||||
);
|
);
|
||||||
post.active_votes[i].percent = post.active_votes[i].percent / 100;
|
post.active_votes[i].percent = post.active_votes[i].percent / 100;
|
||||||
@ -124,18 +111,13 @@ export const parsePosts = (posts, user) => {
|
|||||||
export const parsePost = post => {
|
export const parsePost = post => {
|
||||||
post.json_metadata = JSON.parse(post.json_metadata);
|
post.json_metadata = JSON.parse(post.json_metadata);
|
||||||
post.json_metadata.image ? (post.image = post.json_metadata.image[0]) : "";
|
post.json_metadata.image ? (post.image = post.json_metadata.image[0]) : "";
|
||||||
post.pending_payout_value = parseFloat(post.pending_payout_value).toFixed(
|
post.pending_payout_value = parseFloat(post.pending_payout_value).toFixed(2);
|
||||||
2
|
post.created = getTimeFromNow(post.created);
|
||||||
);
|
|
||||||
post.created = moment
|
|
||||||
.utc(post.created)
|
|
||||||
.local()
|
|
||||||
.fromNow();
|
|
||||||
post.vote_count = post.active_votes.length;
|
post.vote_count = post.active_votes.length;
|
||||||
post.author_reputation = reputation(post.author_reputation);
|
post.author_reputation = getReputation(post.author_reputation);
|
||||||
post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`;
|
post.avatar = `https://steemitimages.com/u/${post.author}/avatar/small`;
|
||||||
post.body = markDown2Html(post.body);
|
post.body = markDown2Html(post.body);
|
||||||
post.summary = postSummary(post.body, 100);
|
post.summary = getPostSummary(post.body, 100);
|
||||||
post.raw_body = post.body;
|
post.raw_body = post.body;
|
||||||
post.active_votes.sort((a, b) => {
|
post.active_votes.sort((a, b) => {
|
||||||
return b.rshares - a.rshares;
|
return b.rshares - a.rshares;
|
||||||
@ -152,10 +134,10 @@ export const parsePost = post => {
|
|||||||
let ratio = totalPayout / voteRshares;
|
let ratio = totalPayout / voteRshares;
|
||||||
|
|
||||||
for (let i in post.active_votes) {
|
for (let i in post.active_votes) {
|
||||||
post.active_votes[i].value = (
|
post.active_votes[i].value = (post.active_votes[i].rshares * ratio).toFixed(
|
||||||
post.active_votes[i].rshares * ratio
|
2
|
||||||
).toFixed(2);
|
);
|
||||||
post.active_votes[i].reputation = reputation(
|
post.active_votes[i].reputation = getReputation(
|
||||||
post.active_votes[i].reputation
|
post.active_votes[i].reputation
|
||||||
);
|
);
|
||||||
post.active_votes[i].percent = post.active_votes[i].percent / 100;
|
post.active_votes[i].percent = post.active_votes[i].percent / 100;
|
||||||
@ -216,12 +198,9 @@ export const parseComments = comments => {
|
|||||||
comment.pending_payout_value = parseFloat(
|
comment.pending_payout_value = parseFloat(
|
||||||
comment.pending_payout_value
|
comment.pending_payout_value
|
||||||
).toFixed(2);
|
).toFixed(2);
|
||||||
comment.created = moment
|
comment.created = getTimeFromNow(comment.created);
|
||||||
.utc(comment.created)
|
|
||||||
.local()
|
|
||||||
.fromNow();
|
|
||||||
comment.vote_count = comment.active_votes.length;
|
comment.vote_count = comment.active_votes.length;
|
||||||
comment.author_reputation = reputation(comment.author_reputation);
|
comment.author_reputation = getReputation(comment.author_reputation);
|
||||||
comment.avatar = `https://steemitimages.com/u/${
|
comment.avatar = `https://steemitimages.com/u/${
|
||||||
comment.author
|
comment.author
|
||||||
}/avatar/small`;
|
}/avatar/small`;
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
export const postSummary = (postBody, length) => {
|
|
||||||
if (!postBody) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
postBody = postBody
|
|
||||||
.replace(/(<([^>]+)>)/gi, "") // Remove html tags
|
|
||||||
.replace(/\r?\n|\r/g, " ") // Remove new lines
|
|
||||||
.replace(/(?:https?|ftp):\/\/[\n\S]+/g, "") // Remove urls
|
|
||||||
.trim()
|
|
||||||
.replace(/ +(?= )/g, ""); // Remove all multiple spaces
|
|
||||||
|
|
||||||
if (length) {
|
|
||||||
// Truncate
|
|
||||||
postBody = postBody.substring(0, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
return postBody;
|
|
||||||
};
|
|
@ -1,18 +1,23 @@
|
|||||||
export const reputation = reputation => {
|
export const getReputation = reputation => {
|
||||||
if (reputation == null) return reputation;
|
if (reputation === null) return reputation;
|
||||||
reputation = parseInt(reputation);
|
|
||||||
let rep = String(reputation);
|
let _reputation = String(parseInt(reputation));
|
||||||
const neg = rep.charAt(0) === "-";
|
|
||||||
rep = neg ? rep.substring(1) : rep;
|
const neg = _reputation.charAt(0) === "-";
|
||||||
const str = rep;
|
_reputation = neg ? _reputation.substring(1) : _reputation;
|
||||||
|
|
||||||
|
const str = _reputation;
|
||||||
const leadingDigits = parseInt(str.substring(0, 4));
|
const leadingDigits = parseInt(str.substring(0, 4));
|
||||||
const log = Math.log(leadingDigits) / Math.log(10);
|
const log = Math.log(leadingDigits) / Math.log(10);
|
||||||
const n = str.length - 1;
|
const n = str.length - 1;
|
||||||
let out = n + (log - parseInt(log));
|
let out = n + (log - parseInt(log));
|
||||||
|
|
||||||
if (isNaN(out)) out = 0;
|
if (isNaN(out)) out = 0;
|
||||||
|
|
||||||
out = Math.max(out - 9, 0);
|
out = Math.max(out - 9, 0);
|
||||||
out = (neg ? -1 : 1) * out;
|
out = (neg ? -1 : 1) * out;
|
||||||
out = out * 9 + 25;
|
out = out * 9 + 25;
|
||||||
out = parseInt(out);
|
out = parseInt(out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
10
src/utils/time.js
Normal file
10
src/utils/time.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import moment from "moment";
|
||||||
|
|
||||||
|
export const getTimeFromNow = value => {
|
||||||
|
if (!value) return null;
|
||||||
|
|
||||||
|
return moment
|
||||||
|
.utc(value)
|
||||||
|
.local()
|
||||||
|
.fromNow();
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user