diff --git a/app/src/component/button/view.js b/app/src/component/button/view.js index 1c2f1182..04f4b9d2 100644 --- a/app/src/component/button/view.js +++ b/app/src/component/button/view.js @@ -3,7 +3,7 @@ import { Text, TouchableOpacity } from 'react-native'; import buttonStyle from '../../styles/button'; import Icon from 'react-native-vector-icons/FontAwesome'; -export default class Button extends React.PureComponent { +export default class Button extends React.PureComponent { render() { const { disabled, diff --git a/app/src/component/link/index.js b/app/src/component/link/index.js new file mode 100644 index 00000000..8c06e44b --- /dev/null +++ b/app/src/component/link/index.js @@ -0,0 +1,9 @@ +import { connect } from 'react-redux'; +import { doNotify } from 'lbry-redux'; +import Link from './view'; + +const perform = dispatch => ({ + notify: (data) => dispatch(doNotify(data)) +}); + +export default connect(null, perform)(Link); diff --git a/app/src/component/link/view.js b/app/src/component/link/view.js new file mode 100644 index 00000000..8ea60a19 --- /dev/null +++ b/app/src/component/link/view.js @@ -0,0 +1,38 @@ +import React from 'react'; +import { Linking, Text, TouchableOpacity } from 'react-native'; + +export default class Link extends React.PureComponent { + handlePress = () => { + const { error, href, navigation, notify } = this.props; + + if (navigation && href.startsWith('#')) { + navigation.navigate(href.substring(1)); + } else { + Linking.openURL(href).catch(err => notify({ + message: error, + displayType: ['toast'] + })); + } + } + + render() { + const { + onPress, + style, + text + } = this.props; + + let styles = []; + if (style.length) { + styles = styles.concat(style); + } else { + styles.push(style); + } + + return ( + + {text} + + ); + } +}; diff --git a/app/src/component/transactionList/index.js b/app/src/component/transactionList/index.js index e1079d22..c89b0a65 100644 --- a/app/src/component/transactionList/index.js +++ b/app/src/component/transactionList/index.js @@ -8,6 +8,4 @@ const select = state => ({ myClaims: selectAllMyClaimsByOutpoint(state), }); -const perform = dispatch => ({}); - -export default connect(select, perform)(TransactionList); +export default connect(select, null)(TransactionList); diff --git a/app/src/component/transactionList/internal/transaction-list-item.js b/app/src/component/transactionList/internal/transaction-list-item.js index a87753db..cb4d416f 100644 --- a/app/src/component/transactionList/internal/transaction-list-item.js +++ b/app/src/component/transactionList/internal/transaction-list-item.js @@ -1,7 +1,8 @@ // @flow import React from 'react'; -import { Text, View } from 'react-native'; -import { formatCredits } from 'lbry-redux'; +import { Text, View, Linking } from 'react-native'; +import { buildURI, formatCredits } from 'lbry-redux'; +import Link from '../../link'; import moment from 'moment'; import transactionListStyle from '../../../styles/transactionList'; @@ -11,14 +12,20 @@ class TransactionListItem extends React.PureComponent { } render() { - const { transaction } = this.props; + const { transaction, navigation } = this.props; const { amount, claim_id: claimId, claim_name: name, date, fee, txid, type } = transaction; - + return ( {this.capitalize(type)} + {name && claimId && ( + navigation && navigation.navigate('File', { uri: buildURI({ claimName: name, claimId }) })} + text={name} /> + )} {formatCredits(amount, 8)} @@ -27,7 +34,10 @@ class TransactionListItem extends React.PureComponent { - {txid.substring(0, 8)} + {date ? ( diff --git a/app/src/component/transactionList/view.js b/app/src/component/transactionList/view.js index 908aebf0..40afaf22 100644 --- a/app/src/component/transactionList/view.js +++ b/app/src/component/transactionList/view.js @@ -40,7 +40,7 @@ class TransactionList extends React.PureComponent { } render() { - const { emptyMessage, rewards, transactions } = this.props; + const { emptyMessage, rewards, transactions, navigation } = this.props; const { filter } = this.state; const transactionList = transactions.filter(this.filterTransaction); @@ -56,6 +56,7 @@ class TransactionList extends React.PureComponent { ))} diff --git a/app/src/component/transactionListRecent/view.js b/app/src/component/transactionListRecent/view.js index 42a9c30e..02dd9a11 100644 --- a/app/src/component/transactionListRecent/view.js +++ b/app/src/component/transactionListRecent/view.js @@ -3,6 +3,7 @@ import React from 'react'; //import BusyIndicator from 'component/common/busy-indicator'; import { Text, View } from 'react-native'; import Button from '../button'; +import Link from '../link'; import TransactionList from '../transactionList'; import type { Transaction } from '../transactionList/view'; import walletStyle from '../../styles/wallet'; @@ -26,14 +27,17 @@ class TransactionListRecent extends React.PureComponent { Recent Transactions -