mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-21 20:31:37 +03:00
fixed undefined memo text and enanced animations
This commit is contained in:
parent
63285341d0
commit
80ce9661b3
@ -4,13 +4,13 @@ import { View } from 'react-native';
|
|||||||
import Placeholder from 'rn-placeholder';
|
import Placeholder from 'rn-placeholder';
|
||||||
|
|
||||||
import styles from './listItemPlaceHolderStyles';
|
import styles from './listItemPlaceHolderStyles';
|
||||||
// TODO: make container for place holder wrapper after alpha
|
|
||||||
const ListItemPlaceHolderView = ({ isDarkTheme }) => {
|
const ListItemPlaceHolderView = ({ isDarkTheme }) => {
|
||||||
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
|
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Placeholder.Media size={40} hasRadius animate="fade" color={color} />
|
<Placeholder.Media size={30} hasRadius animate="fade" color={color} />
|
||||||
<View style={styles.paragraphWrapper}>
|
<View style={styles.paragraphWrapper}>
|
||||||
<Placeholder.Paragraph
|
<Placeholder.Paragraph
|
||||||
color={color}
|
color={color}
|
||||||
|
@ -1,10 +1,29 @@
|
|||||||
import React from 'react';
|
/* eslint-disable radix */
|
||||||
|
import React, { Fragment } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { View } from 'react-native';
|
import { View, Dimensions } from 'react-native';
|
||||||
import Placeholder from 'rn-placeholder';
|
import Placeholder from 'rn-placeholder';
|
||||||
|
import times from 'lodash/times';
|
||||||
|
|
||||||
import styles from './walletDetailsPlaceHolderStyles';
|
import styles from './walletDetailsPlaceHolderStyles';
|
||||||
|
|
||||||
|
const HEIGHT = Dimensions.get('window').height;
|
||||||
|
|
||||||
|
const listPlaceHolderView = color => {
|
||||||
|
const ratio = (HEIGHT - 300) / 50;
|
||||||
|
const listElements = [];
|
||||||
|
|
||||||
|
times(parseInt(ratio), i => {
|
||||||
|
listElements.push(
|
||||||
|
<View key={i} style={styles.textWrapper}>
|
||||||
|
<Placeholder.Box animate="fade" height={30} width="100%" radius={5} color={color} />
|
||||||
|
</View>,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return <Fragment>{listElements}</Fragment>;
|
||||||
|
};
|
||||||
|
|
||||||
const WalletDetailsPlaceHolder = ({ isDarkTheme }) => {
|
const WalletDetailsPlaceHolder = ({ isDarkTheme }) => {
|
||||||
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
|
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
|
||||||
|
|
||||||
@ -13,18 +32,7 @@ const WalletDetailsPlaceHolder = ({ isDarkTheme }) => {
|
|||||||
<View style={styles.textWrapper}>
|
<View style={styles.textWrapper}>
|
||||||
<Placeholder.Paragraph lineNumber={1} color={color} />
|
<Placeholder.Paragraph lineNumber={1} color={color} />
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.textWrapper}>
|
{listPlaceHolderView(color)}
|
||||||
<Placeholder.Box animate="fade" height={30} width="100%" radius={5} color={color} />
|
|
||||||
</View>
|
|
||||||
<View style={styles.textWrapper}>
|
|
||||||
<Placeholder.Box animate="fade" height={30} width="100%" radius={5} color={color} />
|
|
||||||
</View>
|
|
||||||
<View style={styles.textWrapper}>
|
|
||||||
<Placeholder.Box animate="fade" height={30} width="100%" radius={5} color={color} />
|
|
||||||
</View>
|
|
||||||
<View style={styles.textWrapper}>
|
|
||||||
<Placeholder.Box animate="fade" height={30} width="100%" radius={5} color={color} />
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -66,7 +66,7 @@ const WalletLineItem = ({
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
{rightText && (
|
{!!rightText && (
|
||||||
<View style={styles.rightTextWrapper}>
|
<View style={styles.rightTextWrapper}>
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
/* eslint-disable react/jsx-wrap-multilines */
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { injectIntl } from 'react-intl';
|
import { injectIntl } from 'react-intl';
|
||||||
import { View } from 'react-native';
|
import { View } from 'react-native';
|
||||||
|
import get from 'lodash/get';
|
||||||
|
|
||||||
// Utilities
|
// Utilities
|
||||||
import { groomingTransactionData } from '../../../utils/wallet';
|
import { groomingTransactionData } from '../../../utils/wallet';
|
||||||
@ -27,7 +29,7 @@ class TransactionView extends PureComponent {
|
|||||||
// Component Life Cycles
|
// Component Life Cycles
|
||||||
|
|
||||||
// Component Functions
|
// Component Functions
|
||||||
_handleOnDropdownSelect = () => {};
|
// _handleOnDropdownSelect = () => {};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
@ -69,7 +71,7 @@ class TransactionView extends PureComponent {
|
|||||||
id: `wallet.${transactionData.opName}`,
|
id: `wallet.${transactionData.opName}`,
|
||||||
})}
|
})}
|
||||||
// description={intl.formatRelative(transactionData.transDate)}
|
// description={intl.formatRelative(transactionData.transDate)}
|
||||||
description={getTimeFromNow(transactionData.transDate)}
|
description={getTimeFromNow(get(transactionData, 'transDate'))}
|
||||||
isCircleIcon
|
isCircleIcon
|
||||||
isThin
|
isThin
|
||||||
circleIconColor="white"
|
circleIconColor="white"
|
||||||
@ -80,13 +82,13 @@ class TransactionView extends PureComponent {
|
|||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{(!!transactionData.details || !!transactionData.memo) && (
|
{(get(transactionData, 'details') || get(transactionData, 'memo')) && (
|
||||||
<WalletLineItem
|
<WalletLineItem
|
||||||
key={index.toString()}
|
key={index.toString()}
|
||||||
text={!!transactionData.details && transactionData.details}
|
text={get(transactionData, 'details', 'pipi')}
|
||||||
isBlackText
|
isBlackText
|
||||||
isThin
|
isThin
|
||||||
description={!!transactionData.memo && transactionData.memo}
|
description={get(transactionData, 'memo')}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</CollapsibleCard>
|
</CollapsibleCard>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import get from 'lodash/get';
|
||||||
import parseDate from './parseDate';
|
import parseDate from './parseDate';
|
||||||
import parseToken from './parseToken';
|
import parseToken from './parseToken';
|
||||||
import { vestsToSp } from './conversions';
|
import { vestsToSp } from './conversions';
|
||||||
@ -25,7 +26,7 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
|
|||||||
result.value = `${formatNumber(vestsToSp(parseToken(reward), steemPerMVests), {
|
result.value = `${formatNumber(vestsToSp(parseToken(reward), steemPerMVests), {
|
||||||
minimumFractionDigits: 3,
|
minimumFractionDigits: 3,
|
||||||
})} SP`;
|
})} SP`;
|
||||||
result.details = `@${commentAuthor}/${commentPermlink}`;
|
result.details = commentAuthor ? `@${commentAuthor}/${commentPermlink}` : null;
|
||||||
break;
|
break;
|
||||||
case 'author_reward':
|
case 'author_reward':
|
||||||
case 'comment_benefactor_reward':
|
case 'comment_benefactor_reward':
|
||||||
@ -47,7 +48,7 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
|
|||||||
steemPayout > 0 ? `${steemPayout} steemPayout` : ''
|
steemPayout > 0 ? `${steemPayout} steemPayout` : ''
|
||||||
} ${vestingPayout > 0 ? `${vestingPayout} SP` : ''}`;
|
} ${vestingPayout > 0 ? `${vestingPayout} SP` : ''}`;
|
||||||
|
|
||||||
result.details = `@${author}/${permlink}`;
|
result.details = author && permlink ? `@${author}/${permlink}` : null;
|
||||||
if (result.opName === 'comment_benefactor_reward') {
|
if (result.opName === 'comment_benefactor_reward') {
|
||||||
result.icon = 'comment';
|
result.icon = 'comment';
|
||||||
}
|
}
|
||||||
@ -71,8 +72,8 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
|
|||||||
|
|
||||||
result.value = `${amount}`;
|
result.value = `${amount}`;
|
||||||
result.icon = 'compare-arrows';
|
result.icon = 'compare-arrows';
|
||||||
result.details = `@${from} to @${to}`;
|
result.details = from && to ? `@${from} to @${to}` : null;
|
||||||
result.memo = memo;
|
result.memo = memo || null;
|
||||||
break;
|
break;
|
||||||
case 'withdraw_vesting':
|
case 'withdraw_vesting':
|
||||||
const { acc } = opData;
|
const { acc } = opData;
|
||||||
@ -83,7 +84,7 @@ export const groomingTransactionData = (transaction, steemPerMVests, formatNumbe
|
|||||||
minimumFractionDigits: 3,
|
minimumFractionDigits: 3,
|
||||||
})} SP`;
|
})} SP`;
|
||||||
result.icon = 'attach-money';
|
result.icon = 'attach-money';
|
||||||
result.details = `@${acc}`;
|
result.details = acc ? `@${acc}` : null;
|
||||||
break;
|
break;
|
||||||
case 'fill_order':
|
case 'fill_order':
|
||||||
const { current_pays: currentPays, open_pays: openPays } = opData;
|
const { current_pays: currentPays, open_pays: openPays } = opData;
|
||||||
@ -104,7 +105,7 @@ export const groomingWalletData = async (user, globalProps) => {
|
|||||||
return walletData;
|
return walletData;
|
||||||
}
|
}
|
||||||
|
|
||||||
const state = await getState(`/@${user.name}/transfers`);
|
const state = await getState(`/@${get(user, 'name')}/transfers`);
|
||||||
const { accounts } = state;
|
const { accounts } = state;
|
||||||
|
|
||||||
// TODO: move them to utils these so big for a lifecycle function
|
// TODO: move them to utils these so big for a lifecycle function
|
||||||
|
Loading…
Reference in New Issue
Block a user