forked from sigillabs/mobidex
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9853f7
commit 2ffc49d
Showing
23 changed files
with
280 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React, { Component } from "react"; | ||
import { Button, Card } from "react-native-elements"; | ||
import Icon from "react-native-vector-icons/MaterialIcons"; | ||
import { connect } from "react-redux"; | ||
import { setError } from "../actions"; | ||
|
||
class Err extends Component { | ||
leave = () => { | ||
this.props.dispatch(setError(null)); | ||
}; | ||
|
||
render() { | ||
let { message } = this.props.error; | ||
|
||
return ( | ||
<Card title={message}> | ||
<Button | ||
large | ||
text="Get Out Of Here" | ||
icon={<Icon name="refresh" color="white" />} | ||
buttonStyle={{ borderRadius: 0 }} | ||
onPress={this.leave} /> | ||
</Card> | ||
); | ||
} | ||
} | ||
|
||
export default connect((state) => ({ }), dispatch => ({ dispatch }))(Err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import * as _ from "lodash"; | ||
import React, { Component } from "react"; | ||
import { View, TouchableOpacity } from "react-native"; | ||
import { List, ListItem } from "react-native-elements"; | ||
import { connect } from "react-redux"; | ||
import { setBaseToken, setQuoteToken } from "../../actions"; | ||
import { loadOrders } from "../../thunks"; | ||
import { productTokenAddresses } from "../../utils/orders"; | ||
import OrderList from "../components/OrderList"; | ||
import TokenFilterBar from "../components/TokenFilterBar"; | ||
import NormalHeader from "../headers/Normal"; | ||
|
||
class MyOrdersScreen extends Component { | ||
static navigationOptions = ({ navigation }) => { | ||
return { | ||
header: <NormalHeader navigation={navigation} /> | ||
}; | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
filteredOrders: [], | ||
quoteTokens: [], | ||
baseTokens: [] | ||
}; | ||
} | ||
|
||
componentWillReceiveProps(nextProps) { | ||
let { address, tokens, orders, products, quoteToken, baseToken } = nextProps; | ||
|
||
let filteredOrders = orders | ||
.filter(order => order.maker === address || order.taker === address) | ||
.filter(order => order.makerTokenAddress === quoteToken.address || order.takerTokenAddress === quoteToken.address); | ||
let quoteTokens = productTokenAddresses(products, "tokenB").map(address => _.find(tokens, { address })); | ||
let baseTokens = productTokenAddresses(products, "tokenA").map(address => _.find(tokens, { address })); | ||
|
||
this.setState({ filteredOrders, quoteTokens, baseTokens }); | ||
} | ||
|
||
componentDidMount() { | ||
this.props.dispatch(loadOrders()); | ||
} | ||
|
||
render() { | ||
let { quoteToken, baseToken } = this.props; | ||
let { filteredOrders, quoteTokens, baseTokens } = this.state; | ||
|
||
return ( | ||
<View> | ||
<TokenFilterBar | ||
quoteTokens={quoteTokens} | ||
baseTokens={baseTokens} | ||
selectedQuoteToken={quoteToken} | ||
selectedBaseToken={baseToken} | ||
onQuoteTokenSelect={quoteToken => this.props.dispatch(setQuoteToken(quoteToken))} | ||
onBaseTokenSelect={baseToken => this.props.dispatch(setBaseToken(baseToken))} /> | ||
<OrderList | ||
quoteToken={quoteToken} | ||
baseToken={baseToken} | ||
orders={filteredOrders} | ||
onPress={order => (this.props.navigation.navigate("OrderDetails", { order, quoteToken, baseToken }))} /> | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
export default connect((state) => ({ ...state.device, ...state.settings, ...state.wallet, ...state.relayer }), (dispatch) => ({ dispatch }))(MyOrdersScreen); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
App/screens/LoadingScreen.js → App/screens/TransactionsProcessingScreen.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import React, { Component } from "react"; | ||
import { Card } from "react-native-elements"; | ||
|
||
export default class LoadingScreen extends Component { | ||
export default class TransactionsProcessingScreen extends Component { | ||
render() { | ||
return ( | ||
<Card title="Loading" /> | ||
<Card title="Processing Transactions" /> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
import { createAction } from "redux-actions"; | ||
import * as Actions from "../constants/actions"; | ||
|
||
export const addErrors = createAction(Actions.ADD_ERRORS); | ||
export const addOrders = createAction(Actions.ADD_ORDERS); | ||
export const addProcessingOrders = createAction(Actions.ADD_PROCESSING_ORDERS); | ||
export const addTransactions = createAction(Actions.ADD_TRANSACTIONS); | ||
export const addAssets = createAction(Actions.ADD_ASSETS); | ||
export const finishedLoadingProducts = createAction(Actions.FINISHED_LOADING_PRODUCTS); | ||
export const finishedLoadingWallet = createAction(Actions.FINISHED_LOADING_WALLET); | ||
export const removeProcessingOrders = createAction(Actions.REMOVE_PROCESSING_ORDERS); | ||
export const setWallet = createAction(Actions.SET_WALLET); | ||
export const setProducts = createAction(Actions.SET_PRODUCTS); | ||
export const setBaseToken = createAction(Actions.SET_BASE_TOKEN); | ||
export const setError = createAction(Actions.SET_ERROR); | ||
export const setQuoteToken = createAction(Actions.SET_QUOTE_TOKEN); | ||
export const setProducts = createAction(Actions.SET_PRODUCTS); | ||
export const setWallet = createAction(Actions.SET_WALLET); | ||
export const setTokens = createAction(Actions.SET_TOKENS); | ||
export const setNetwork = createAction(Actions.SET_NETWORK); | ||
|
Oops, something went wrong.