be-components 2.4.7 → 2.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/LocationTracker/LocationStatus.js.map +1 -1
- package/lib/commonjs/LocationTracker/api/index.js +14 -0
- package/lib/commonjs/LocationTracker/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +91 -3
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/commonjs/MarketMaker/api/index.js +1307 -0
- package/lib/commonjs/MarketMaker/api/index.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/Contest.js +150 -0
- package/lib/commonjs/MarketMaker/components/Contest.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/ContestMarkets.js +300 -0
- package/lib/commonjs/MarketMaker/components/ContestMarkets.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/ContestSelector.js +111 -0
- package/lib/commonjs/MarketMaker/components/ContestSelector.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/Dashboard.js +164 -0
- package/lib/commonjs/MarketMaker/components/Dashboard.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/FundActions.js +232 -0
- package/lib/commonjs/MarketMaker/components/FundActions.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/FundOwnershipList.js +94 -0
- package/lib/commonjs/MarketMaker/components/FundOwnershipList.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/FundSelector.js +99 -0
- package/lib/commonjs/MarketMaker/components/FundSelector.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/FundingRequestList.js +112 -0
- package/lib/commonjs/MarketMaker/components/FundingRequestList.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/ManageFundForm.js +122 -0
- package/lib/commonjs/MarketMaker/components/ManageFundForm.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/MarketSelector.js +81 -0
- package/lib/commonjs/MarketMaker/components/MarketSelector.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/SetMarketForm.js +305 -0
- package/lib/commonjs/MarketMaker/components/SetMarketForm.js.map +1 -0
- package/lib/commonjs/MarketMaker/components/WeightProgress.js +40 -0
- package/lib/commonjs/MarketMaker/components/WeightProgress.js.map +1 -0
- package/lib/commonjs/MarketMaker/index.js +452 -0
- package/lib/commonjs/MarketMaker/index.js.map +1 -0
- package/lib/commonjs/SocialComponents/api/index.js +0 -1
- package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.d.js +4 -0
- package/lib/module/LocationTracker/LocationStatus.js.map +1 -1
- package/lib/module/LocationTracker/api/index.js +14 -0
- package/lib/module/LocationTracker/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js +91 -3
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/module/MarketMaker/api/index.js +1301 -0
- package/lib/module/MarketMaker/api/index.js.map +1 -0
- package/lib/module/MarketMaker/components/Contest.js +143 -0
- package/lib/module/MarketMaker/components/Contest.js.map +1 -0
- package/lib/module/MarketMaker/components/ContestMarkets.js +291 -0
- package/lib/module/MarketMaker/components/ContestMarkets.js.map +1 -0
- package/lib/module/MarketMaker/components/ContestSelector.js +102 -0
- package/lib/module/MarketMaker/components/ContestSelector.js.map +1 -0
- package/lib/module/MarketMaker/components/Dashboard.js +155 -0
- package/lib/module/MarketMaker/components/Dashboard.js.map +1 -0
- package/lib/module/MarketMaker/components/FundActions.js +223 -0
- package/lib/module/MarketMaker/components/FundActions.js.map +1 -0
- package/lib/module/MarketMaker/components/FundOwnershipList.js +87 -0
- package/lib/module/MarketMaker/components/FundOwnershipList.js.map +1 -0
- package/lib/module/MarketMaker/components/FundSelector.js +92 -0
- package/lib/module/MarketMaker/components/FundSelector.js.map +1 -0
- package/lib/module/MarketMaker/components/FundingRequestList.js +105 -0
- package/lib/module/MarketMaker/components/FundingRequestList.js.map +1 -0
- package/lib/module/MarketMaker/components/ManageFundForm.js +113 -0
- package/lib/module/MarketMaker/components/ManageFundForm.js.map +1 -0
- package/lib/module/MarketMaker/components/MarketSelector.js +74 -0
- package/lib/module/MarketMaker/components/MarketSelector.js.map +1 -0
- package/lib/module/MarketMaker/components/SetMarketForm.js +297 -0
- package/lib/module/MarketMaker/components/SetMarketForm.js.map +1 -0
- package/lib/module/MarketMaker/components/WeightProgress.js +33 -0
- package/lib/module/MarketMaker/components/WeightProgress.js.map +1 -0
- package/lib/module/MarketMaker/index.js +442 -0
- package/lib/module/MarketMaker/index.js.map +1 -0
- package/lib/module/SocialComponents/api/index.js +0 -1
- package/lib/module/SocialComponents/api/index.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.d.js +1 -1
- package/lib/typescript/src/LocationTracker/LocationStatus.d.ts.map +1 -1
- package/lib/typescript/src/LocationTracker/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +2 -2
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts +2 -2
- package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketMaker/api/index.d.ts +131 -0
- package/lib/typescript/src/MarketMaker/api/index.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/Contest.d.ts +25 -0
- package/lib/typescript/src/MarketMaker/components/Contest.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/ContestMarkets.d.ts +26 -0
- package/lib/typescript/src/MarketMaker/components/ContestMarkets.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/ContestSelector.d.ts +19 -0
- package/lib/typescript/src/MarketMaker/components/ContestSelector.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/Dashboard.d.ts +25 -0
- package/lib/typescript/src/MarketMaker/components/Dashboard.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/FundActions.d.ts +12 -0
- package/lib/typescript/src/MarketMaker/components/FundActions.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/FundOwnershipList.d.ts +9 -0
- package/lib/typescript/src/MarketMaker/components/FundOwnershipList.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/FundSelector.d.ts +13 -0
- package/lib/typescript/src/MarketMaker/components/FundSelector.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/FundingRequestList.d.ts +11 -0
- package/lib/typescript/src/MarketMaker/components/FundingRequestList.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/ManageFundForm.d.ts +10 -0
- package/lib/typescript/src/MarketMaker/components/ManageFundForm.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/MarketSelector.d.ts +12 -0
- package/lib/typescript/src/MarketMaker/components/MarketSelector.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/SetMarketForm.d.ts +15 -0
- package/lib/typescript/src/MarketMaker/components/SetMarketForm.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/components/WeightProgress.d.ts +10 -0
- package/lib/typescript/src/MarketMaker/components/WeightProgress.d.ts.map +1 -0
- package/lib/typescript/src/MarketMaker/index.d.ts +7 -0
- package/lib/typescript/src/MarketMaker/index.d.ts.map +1 -0
- package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/LocationTracker/LocationStatus.tsx +0 -1
- package/src/LocationTracker/api/index.tsx +16 -0
- package/src/MarketComponents/components/TeamEventMarket/index.tsx +54 -4
- package/src/MarketMaker/api/index.ts +1023 -0
- package/src/MarketMaker/components/Contest.tsx +106 -0
- package/src/MarketMaker/components/ContestMarkets.tsx +174 -0
- package/src/MarketMaker/components/ContestSelector.tsx +84 -0
- package/src/MarketMaker/components/Dashboard.tsx +112 -0
- package/src/MarketMaker/components/FundActions.tsx +149 -0
- package/src/MarketMaker/components/FundOwnershipList.tsx +54 -0
- package/src/MarketMaker/components/FundSelector.tsx +65 -0
- package/src/MarketMaker/components/FundingRequestList.tsx +71 -0
- package/src/MarketMaker/components/ManageFundForm.tsx +83 -0
- package/src/MarketMaker/components/MarketSelector.tsx +50 -0
- package/src/MarketMaker/components/SetMarketForm.tsx +213 -0
- package/src/MarketMaker/components/WeightProgress.tsx +25 -0
- package/src/MarketMaker/index.tsx +378 -0
- package/src/SocialComponents/api/index.ts +0 -1
- package/src/index.tsx +2 -1
- package/src/types.d.ts +135 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Image, FlatList } from 'react-native';
|
|
3
|
+
import type { BestAvailableOrderProps, EventProps, ExternalPriceProps, FundOrderProps, FundProps, LeagueProps, MarketProps, MatchProps, OrderProps, TournamentProps, TradeProps } from '../../types';
|
|
4
|
+
import { view_styles } from '../../constants/styles';
|
|
5
|
+
import { Text } from '../../Components';
|
|
6
|
+
import ContestMarket from './ContestMarkets';
|
|
7
|
+
import { MarketMaketHelpers } from '../api';
|
|
8
|
+
import Colors from '../../constants/colors';
|
|
9
|
+
|
|
10
|
+
type ContestProps = {
|
|
11
|
+
fund:FundProps,
|
|
12
|
+
league?:LeagueProps,
|
|
13
|
+
contest_id:string,
|
|
14
|
+
contest_type:string,
|
|
15
|
+
time_detail:string,
|
|
16
|
+
contest_title:string,
|
|
17
|
+
best_available_orders:BestAvailableOrderProps[],
|
|
18
|
+
latest_trades:TradeProps[],
|
|
19
|
+
external_prices:ExternalPriceProps[],
|
|
20
|
+
backup_prices?:ExternalPriceProps[],
|
|
21
|
+
orders:OrderProps[],
|
|
22
|
+
fund_orders:FundOrderProps[],
|
|
23
|
+
markets:MarketProps[],
|
|
24
|
+
event?:EventProps,
|
|
25
|
+
tournament?:TournamentProps,
|
|
26
|
+
match?:MatchProps,
|
|
27
|
+
onSetMarket:(orders:OrderProps[], market:MarketProps, prices:ExternalPriceProps[]) => void
|
|
28
|
+
onClearMarket:(order_ids:string[]) => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const Contest = ({ fund, contest_id, time_detail, event, external_prices, backup_prices, tournament, match, contest_type, league, contest_title, best_available_orders, latest_trades, orders, fund_orders, markets, onSetMarket, onClearMarket }:ContestProps) => {
|
|
32
|
+
|
|
33
|
+
console.log(markets)
|
|
34
|
+
const { called_amt, open_potential_winnings } = MarketMaketHelpers.getOrderStats(orders);
|
|
35
|
+
//const hedges = MarketMaketHelpers.getHedgesFromPositions(orders, markets);
|
|
36
|
+
console.log('HERE WE GO')
|
|
37
|
+
const renderMarkets = (data:{ item:MarketProps, index:number }) => {
|
|
38
|
+
const market_orders = orders.filter(o => o.market_id == data.item.market_id);
|
|
39
|
+
const market_fund_orders = fund_orders.filter(fo => market_orders.map(o => o.order_id.toString()).includes(fo.order_id.toString()))
|
|
40
|
+
const market_trades = latest_trades.filter(t => t.market_id == data.item.market_id);
|
|
41
|
+
const market_available_orders = best_available_orders.filter(o => o.market_id == data.item.market_id);
|
|
42
|
+
const market_prices = external_prices.filter(p => p.market_id == data.item.market_id);
|
|
43
|
+
|
|
44
|
+
const { unique_var_1, default_var_1 } = MarketMaketHelpers.getAvailableVar1s(market_orders, market_available_orders, market_prices, data.item);
|
|
45
|
+
const side_id_resp = MarketMaketHelpers.getAvailableSideIds(market_orders, market_available_orders, market_prices, data.item);
|
|
46
|
+
console.log(side_id_resp)
|
|
47
|
+
console.log(unique_var_1, default_var_1)
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<View style={{ borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}>
|
|
51
|
+
<ContestMarket
|
|
52
|
+
fund={fund}
|
|
53
|
+
contest_id={contest_id}
|
|
54
|
+
contest_type={contest_type}
|
|
55
|
+
market={data.item}
|
|
56
|
+
orders={market_orders}
|
|
57
|
+
fund_orders={market_fund_orders}
|
|
58
|
+
unique_var_1={unique_var_1}
|
|
59
|
+
latest_trades={market_trades}
|
|
60
|
+
best_available_orders={market_available_orders}
|
|
61
|
+
var_1={default_var_1}
|
|
62
|
+
external_prices={market_prices}
|
|
63
|
+
backup_prices={backup_prices}
|
|
64
|
+
event={event}
|
|
65
|
+
tournament={tournament}
|
|
66
|
+
match={match}
|
|
67
|
+
onSetMarket={onSetMarket}
|
|
68
|
+
onClearMarket={onClearMarket}
|
|
69
|
+
/>
|
|
70
|
+
</View>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<View style={{ ...view_styles.section, borderWidth:1, borderColor:Colors.shades.shade600, padding:0, flex:1 }}>
|
|
76
|
+
<View style={{ flexDirection:'row', backgroundColor:Colors.brand.midnight, borderTopRightRadius:8, borderTopLeftRadius:8, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}>
|
|
77
|
+
<View style={{ backgroundColor:Colors.shades.shade100, padding:8, borderTopLeftRadius:8 }}>
|
|
78
|
+
{league ?
|
|
79
|
+
<Image
|
|
80
|
+
source={{ uri: league.league_image }}
|
|
81
|
+
style={{ height:30, width:30, alignSelf:'center' }}
|
|
82
|
+
resizeMode='cover'
|
|
83
|
+
/>
|
|
84
|
+
:<></>}
|
|
85
|
+
</View>
|
|
86
|
+
<View style={{ flex:1, padding:8, justifyContent:'center' }}>
|
|
87
|
+
<Text size={14} color={Colors.shades.shade100} weight='bold'>{contest_title}</Text>
|
|
88
|
+
<Text style={{ marginTop:3 }} size={12} color={Colors.shades.shade100} weight='semibold'>{time_detail}</Text>
|
|
89
|
+
</View>
|
|
90
|
+
<View style={{ marginLeft:10, padding:5 }}>
|
|
91
|
+
<Text size={12} color={Colors.utility.success} textAlign='right'>O: ${open_potential_winnings.toFixed(2)}</Text>
|
|
92
|
+
<Text size={12} color={Colors.brand.midnight} textAlign='right'>F: ${called_amt.toFixed(2)}</Text>
|
|
93
|
+
</View>
|
|
94
|
+
</View>
|
|
95
|
+
<View>
|
|
96
|
+
<FlatList
|
|
97
|
+
data={markets}
|
|
98
|
+
renderItem={renderMarkets}
|
|
99
|
+
keyExtractor={(item) => item.market_id.toString()}
|
|
100
|
+
/>
|
|
101
|
+
</View>
|
|
102
|
+
</View>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default Contest
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
3
|
+
import type { AthleteProps, BestAvailableOrderProps, EventProps, ExternalPriceProps, FundOrderProps, FundProps, MarketProps, MatchProps, OrderProps, TeamProps, TournamentProps, TradeProps } from '../../types';
|
|
4
|
+
import { Button, Text } from '../../Components';
|
|
5
|
+
import { view_styles } from '../../constants/styles';
|
|
6
|
+
import Colors from '../../constants/colors';
|
|
7
|
+
import { MarketMaketHelpers } from '../api';
|
|
8
|
+
import WeightProgress from './WeightProgress';
|
|
9
|
+
|
|
10
|
+
type ContestMarketProps = {
|
|
11
|
+
contest_id:string,
|
|
12
|
+
contest_type:string,
|
|
13
|
+
fund:FundProps,
|
|
14
|
+
market:MarketProps,
|
|
15
|
+
best_available_orders:BestAvailableOrderProps[],
|
|
16
|
+
latest_trades:TradeProps[],
|
|
17
|
+
orders:OrderProps[],
|
|
18
|
+
fund_orders:FundOrderProps[],
|
|
19
|
+
var_1:number,
|
|
20
|
+
unique_var_1:number[],
|
|
21
|
+
event?:EventProps,
|
|
22
|
+
tournament?:TournamentProps,
|
|
23
|
+
match?:MatchProps,
|
|
24
|
+
athlete?:AthleteProps,
|
|
25
|
+
team?:TeamProps,
|
|
26
|
+
external_prices:ExternalPriceProps[],
|
|
27
|
+
backup_prices?:ExternalPriceProps[],
|
|
28
|
+
onSetMarket:(orders:OrderProps[], market:MarketProps, prices:ExternalPriceProps[]) => void
|
|
29
|
+
onClearMarket:(order_ids:string[]) => void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const ContestMarket = ({ fund, event, external_prices, unique_var_1, market, orders, best_available_orders, latest_trades, var_1, athlete, backup_prices, onSetMarket, onClearMarket }:ContestMarketProps) => {
|
|
33
|
+
const [ selected_var_1, setSelectedVar1 ] = useState(var_1);
|
|
34
|
+
|
|
35
|
+
const { var_1_orders, var_1_available, var_1_prices } = MarketMaketHelpers.filterByVar1(selected_var_1, orders, best_available_orders, external_prices, market, backup_prices);
|
|
36
|
+
|
|
37
|
+
const { trade_side, o_side, trade_side_orders, o_side_orders, trade_side_ba, o_side_ba } = MarketMaketHelpers.getSideMarketData(var_1_orders, var_1_available, latest_trades, market);
|
|
38
|
+
const trade_side_order_stats = MarketMaketHelpers.getOrderStats(trade_side_orders);
|
|
39
|
+
const hedges = MarketMaketHelpers.getHedgesFromPositions(orders, [market]);
|
|
40
|
+
const hedged_amt = (hedges.reduce((a,b) => a + b.delayed_cash_draw, 0) * -1) + hedges.reduce((a,b) => a + b.delayed_cash_no_draw, 0);
|
|
41
|
+
const o_side_order_stats = MarketMaketHelpers.getOrderStats(o_side_orders);
|
|
42
|
+
const stake_weight = MarketMaketHelpers.getWeight(o_side_order_stats.stake_potential_winnings, trade_side_order_stats.stake_potential_winnings, market);
|
|
43
|
+
const open_weight = MarketMaketHelpers.getWeight(o_side_order_stats.open_potential_winnings, trade_side_order_stats.open_potential_winnings, market);
|
|
44
|
+
const o_price = var_1_prices.find(p => p.side != market.trade_side);
|
|
45
|
+
const trade_price = var_1_prices.find(p => p.side == market.trade_side);
|
|
46
|
+
|
|
47
|
+
const handleSelectBA = (ba:BestAvailableOrderProps) => {
|
|
48
|
+
const side_option = market.side_options.find(so => so.side == ba.side)
|
|
49
|
+
if(!side_option){ return alert('Unable to process') }
|
|
50
|
+
if(!event){ return alert('Not set up for events!!!') }
|
|
51
|
+
const side_id_data = MarketMaketHelpers.getTeamEventSideIds(event, market, side_option)
|
|
52
|
+
if(!side_id_data){ return alert('Unable to process') }
|
|
53
|
+
const ba_trade = MarketMaketHelpers.getTradeFromAvailableOrder(ba, side_id_data.reversed_side_id);
|
|
54
|
+
//console.log(ba_trade);
|
|
55
|
+
const order = MarketMaketHelpers.getOrderFromTrade(ba_trade, 10, ba.order_id);
|
|
56
|
+
const order_title = MarketMaketHelpers.getOrderTitleForTeamEvent(order, market, event, athlete);
|
|
57
|
+
console.log(order_title)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<View style={{ }}>
|
|
62
|
+
<View style={{ ...view_styles.body_row, justifyContent:'center', borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
63
|
+
<Text textAlign='left' size={12} color={Colors.brand.midnight} weight='regular'>{o_side?.toUpperCase()}</Text>
|
|
64
|
+
{market.var_1_required ?
|
|
65
|
+
<View style={{ flex:1, justifyContent:'center', alignItems:'center', flexDirection:'row', overflow:'scroll' }}>
|
|
66
|
+
{unique_var_1.map(var_1 => {
|
|
67
|
+
const selected = selected_var_1 == var_1 ? true : false
|
|
68
|
+
return (
|
|
69
|
+
<TouchableOpacity style={{ margin:3 }} onPress={() => setSelectedVar1(var_1)}>
|
|
70
|
+
<Text weight={selected?'bold':'regular'} size={12} color={Colors.brand.midnight}>{var_1}</Text>
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
)
|
|
73
|
+
})}
|
|
74
|
+
</View>
|
|
75
|
+
:
|
|
76
|
+
<Text style={{ flex:1 }} textAlign='center' size={12} color={Colors.brand.midnight} weight='bold'>{market.type == 'Stat' ? market.stat_label : market.type}{market.var_1_required ? ` ${MarketMaketHelpers.getVar1Label(market, selected_var_1)}`:''}</Text>
|
|
77
|
+
}
|
|
78
|
+
<Text textAlign='right' size={12} color={Colors.brand.midnight} weight='regular'>{trade_side.toUpperCase()}</Text>
|
|
79
|
+
</View>
|
|
80
|
+
<View style={{ ...view_styles.body_row, justifyContent:'center' }}>
|
|
81
|
+
<View style={{ flex:1, flexDirection:'row', justifyContent:'flex-start' }}>
|
|
82
|
+
{o_price ?
|
|
83
|
+
<TouchableOpacity style={{ marginRight:5, padding:5, borderRadius:4, backgroundColor:Colors.shades.shade100, justifyContent:'center', alignItems:'center' }}>
|
|
84
|
+
<Text size={12} color={Colors.brand.midnight}>{MarketMaketHelpers.getOddsLabel(o_price.odds)}</Text>
|
|
85
|
+
</TouchableOpacity>
|
|
86
|
+
:<></>}
|
|
87
|
+
<TouchableOpacity style={{ padding:5, borderRadius:4, backgroundColor:Colors.shades.shade600, justifyContent:'center', alignItems:'center' }}>
|
|
88
|
+
<Text size={12} color={Colors.brand.midnight}>{o_side_order_stats.open_odds.toFixed()}</Text>
|
|
89
|
+
<Text size={12} color={Colors.brand.midnight}>{o_side_order_stats.open_potential_winnings.toFixed(2)}</Text>
|
|
90
|
+
</TouchableOpacity>
|
|
91
|
+
{o_side_ba ?
|
|
92
|
+
<TouchableOpacity style={{ marginLeft:5, padding:5, borderRadius:4, backgroundColor:MarketMaketHelpers.getOrderColor(o_side_ba), justifyContent:'center', alignItems:'center' }}
|
|
93
|
+
onPress={() => handleSelectBA(o_side_ba)}>
|
|
94
|
+
<Text size={12} color={Colors.brand.midnight}>{o_side_ba.odds.toFixed()}</Text>
|
|
95
|
+
<Text size={12} color={Colors.brand.midnight}>{o_side_ba.open_amt.toFixed(2)}</Text>
|
|
96
|
+
</TouchableOpacity>
|
|
97
|
+
:<></>}
|
|
98
|
+
</View>
|
|
99
|
+
<View style={{ marginRight:5, marginLeft:5}}>
|
|
100
|
+
{orders.length > 0 ?
|
|
101
|
+
<Button
|
|
102
|
+
title='CLEAR'
|
|
103
|
+
backgroundColor={Colors.utility.error}
|
|
104
|
+
title_color={Colors.shades.white}
|
|
105
|
+
padding={3}
|
|
106
|
+
onPress={() => onClearMarket(orders.map(o => o.order_id))}
|
|
107
|
+
/>
|
|
108
|
+
:
|
|
109
|
+
<Button
|
|
110
|
+
title='SET'
|
|
111
|
+
backgroundColor={Colors.utility.success}
|
|
112
|
+
title_color={Colors.shades.white}
|
|
113
|
+
padding={3}
|
|
114
|
+
onPress={() => {
|
|
115
|
+
if(!event){ return alert('Unable to set market') }
|
|
116
|
+
const set_orders = MarketMaketHelpers.setMarkets(fund, var_1_available, var_1_prices, market, .05, event);
|
|
117
|
+
if(set_orders.length != 2){ return alert('Unable to set market at this time') }
|
|
118
|
+
return onSetMarket(set_orders, market, var_1_prices);
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
121
|
+
}
|
|
122
|
+
</View>
|
|
123
|
+
<View style={{ flex:1, flexDirection:'row', justifyContent:'flex-end' }}>
|
|
124
|
+
{trade_side_ba ?
|
|
125
|
+
<TouchableOpacity style={{ marginRight:5, padding:5, borderRadius:4, backgroundColor:MarketMaketHelpers.getOrderColor(trade_side_ba), justifyContent:'center', alignItems:'center' }}
|
|
126
|
+
onPress={() => handleSelectBA(trade_side_ba)}>
|
|
127
|
+
<Text size={12} color={Colors.brand.midnight}>{trade_side_ba.odds.toFixed()}</Text>
|
|
128
|
+
<Text size={12} color={Colors.brand.midnight}>{trade_side_ba.open_amt.toFixed(2)}</Text>
|
|
129
|
+
</TouchableOpacity>
|
|
130
|
+
:<></>}
|
|
131
|
+
<TouchableOpacity style={{ padding:5, borderRadius:4, backgroundColor:Colors.shades.shade600, justifyContent:'center', alignItems:'center' }}>
|
|
132
|
+
<Text size={12} color={Colors.brand.midnight}>{trade_side_order_stats.open_odds.toFixed()}</Text>
|
|
133
|
+
<Text size={12} color={Colors.brand.midnight}>{trade_side_order_stats.open_potential_winnings.toFixed(2)}</Text>
|
|
134
|
+
</TouchableOpacity>
|
|
135
|
+
{trade_price ?
|
|
136
|
+
<TouchableOpacity style={{ marginLeft:5, padding:5, borderRadius:4, backgroundColor:Colors.shades.shade100, justifyContent:'center', alignItems:'center' }}>
|
|
137
|
+
<Text size={12} color={Colors.brand.midnight}>{MarketMaketHelpers.getOddsLabel(trade_price.odds)}</Text>
|
|
138
|
+
</TouchableOpacity>
|
|
139
|
+
:<></>}
|
|
140
|
+
</View>
|
|
141
|
+
</View>
|
|
142
|
+
<View style={{ backgroundColor:Colors.shades.shade100, padding:5 }}>
|
|
143
|
+
<WeightProgress
|
|
144
|
+
width={225}
|
|
145
|
+
min_value={0}
|
|
146
|
+
max_value={100}
|
|
147
|
+
value={open_weight.weighted_pct}
|
|
148
|
+
/>
|
|
149
|
+
</View>
|
|
150
|
+
<View style={{ ...view_styles.body_row, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
151
|
+
<View style={{ flex:1 }}>
|
|
152
|
+
<Text size={12} color={Colors.brand.midnight} weight='bold'>${o_side_order_stats.stake_earnings.toFixed(2)}</Text>
|
|
153
|
+
</View>
|
|
154
|
+
<Text size={12} color={hedged_amt < 0 ? Colors.utility.error : Colors.utility.success} weight='semibold'>${hedged_amt.toFixed(2)}</Text>
|
|
155
|
+
<View style={{ flex:1 }}>
|
|
156
|
+
<Text size={12} color={Colors.brand.midnight} weight='bold' textAlign='right'>${trade_side_order_stats.stake_earnings.toFixed(2)}</Text>
|
|
157
|
+
</View>
|
|
158
|
+
</View>
|
|
159
|
+
<View style={{ backgroundColor:Colors.shades.shade100, padding:5 }}>
|
|
160
|
+
|
|
161
|
+
<View style={{ margin:3 }}>
|
|
162
|
+
<WeightProgress
|
|
163
|
+
width={225}
|
|
164
|
+
min_value={0}
|
|
165
|
+
max_value={100}
|
|
166
|
+
value={stake_weight.weighted_pct}
|
|
167
|
+
/>
|
|
168
|
+
</View>
|
|
169
|
+
</View>
|
|
170
|
+
</View>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export default ContestMarket
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View, FlatList, TouchableOpacity } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { EventProps, LeagueProps, MatchProps, TournamentProps } from "../../types"
|
|
5
|
+
import { view_styles } from '../../constants/styles';
|
|
6
|
+
import { Checkbox, Text } from '../../Components';
|
|
7
|
+
import DropDown from '../../Components/Dropdown';
|
|
8
|
+
import moment from 'moment-mini';
|
|
9
|
+
import Colors from '../../constants/colors';
|
|
10
|
+
|
|
11
|
+
type ContestSelectorProps = {
|
|
12
|
+
leagues:LeagueProps[],
|
|
13
|
+
maxHeight?:number,
|
|
14
|
+
events:EventProps[],
|
|
15
|
+
tournaments:TournamentProps[],
|
|
16
|
+
matches:MatchProps[],
|
|
17
|
+
selected_events:string[],
|
|
18
|
+
onSelectEvent:(e:EventProps) => void,
|
|
19
|
+
onDeselectEvent:(e:EventProps) => void,
|
|
20
|
+
selected_tournaments:string[],
|
|
21
|
+
onSelectTournament:(t:TournamentProps) => void
|
|
22
|
+
selected_matches:string[],
|
|
23
|
+
onSelectMatch:(m:MatchProps) => void
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const ContestSelector = ({ maxHeight, leagues, events, onSelectEvent, selected_events, onDeselectEvent }:ContestSelectorProps) => {
|
|
27
|
+
const [ selector_data, setSelectorData ] = useState<{
|
|
28
|
+
selected_league?:LeagueProps
|
|
29
|
+
}>({
|
|
30
|
+
|
|
31
|
+
});
|
|
32
|
+
const { selected_league } = selector_data;
|
|
33
|
+
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if(!selected_league){ setSelectorData({ ...selector_data, selected_league: leagues.find(l => l.priority == 1) }) }
|
|
36
|
+
},[leagues.length]);
|
|
37
|
+
|
|
38
|
+
const filtered_events = events.filter(e => e.league_id == selected_league?.league_id).sort((a,b) => moment(a.scheduled_datetime).unix() - moment(b.scheduled_datetime).unix());
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
const renderEvents = (data:{ item:EventProps, index:number }) => {
|
|
42
|
+
const selected = selected_events.find(se => se == data.item.event_id) ? true : false;
|
|
43
|
+
return (
|
|
44
|
+
<TouchableOpacity style={{ ...view_styles.body_row, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }} onPress={() => selected ? onDeselectEvent(data.item) : onSelectEvent(data.item)}>
|
|
45
|
+
<Checkbox checked={selected} disabled onSelect={() => console.log('')}/>
|
|
46
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
47
|
+
<Text size={12} weight='bold' color={Colors.brand.midnight}>{data.item.event_title}</Text>
|
|
48
|
+
<Text style={{ marginTop:3 }} theme='body_2'>{data.item.time_detail == 'scheduled' ? moment(data.item.scheduled_datetime).format('MMM DD : hh:mm a') : data.item.time_detail}</Text>
|
|
49
|
+
</View>
|
|
50
|
+
</TouchableOpacity>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<View style={{ ...view_styles.section, maxHeight }}>
|
|
57
|
+
<View style={{ ...view_styles.section_header }}>
|
|
58
|
+
<View style={{ flex:1 }}>
|
|
59
|
+
<Text theme='header'>Select Contest</Text>
|
|
60
|
+
<Text theme='body' style={{ marginTop:3 }}>Use league dropdown to filter</Text>
|
|
61
|
+
</View>
|
|
62
|
+
<DropDown
|
|
63
|
+
selected_value={selected_league?.league_name ?? ''}
|
|
64
|
+
dropdown_options={[
|
|
65
|
+
{ value: 'league', eligible_options: leagues.sort((a,b) => a.priority - b.priority).map(l => l.league_name) }
|
|
66
|
+
]}
|
|
67
|
+
onOptionSelect={(option) => {
|
|
68
|
+
let league = leagues.find(l => l.league_name == option);
|
|
69
|
+
setSelectorData({ ...selector_data, selected_league: league })
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
</View>
|
|
73
|
+
<View style={{ ...view_styles.section_body }}>
|
|
74
|
+
<FlatList
|
|
75
|
+
data={filtered_events}
|
|
76
|
+
renderItem={renderEvents}
|
|
77
|
+
keyExtractor={(item) => item.event_id.toString()}
|
|
78
|
+
/>
|
|
79
|
+
</View>
|
|
80
|
+
</View>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default ContestSelector
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, ActivityIndicator } from 'react-native';
|
|
3
|
+
import { view_styles } from "../../constants/styles"
|
|
4
|
+
import type { BestAvailableOrderProps, EventProps, ExternalPriceProps, FundOrderProps, FundProps, LeagueProps, MarketProps, MatchProps, OrderProps, SortedContestProps, TournamentProps, TradeProps } from "../../types"
|
|
5
|
+
import { Text } from '../../Components';
|
|
6
|
+
import Contest from './Contest';
|
|
7
|
+
import { MarketMaketHelpers } from '../api';
|
|
8
|
+
import Colors from '../../constants/colors';
|
|
9
|
+
import FundActions from './FundActions';
|
|
10
|
+
|
|
11
|
+
type DashboardProps = {
|
|
12
|
+
loaded:boolean,
|
|
13
|
+
fund?:FundProps,
|
|
14
|
+
leagues:LeagueProps[],
|
|
15
|
+
events:EventProps[],
|
|
16
|
+
markets:MarketProps[],
|
|
17
|
+
tournaments:TournamentProps[],
|
|
18
|
+
matches:MatchProps[],
|
|
19
|
+
best_available_orders:BestAvailableOrderProps[],
|
|
20
|
+
trades:TradeProps[],
|
|
21
|
+
prices:ExternalPriceProps[],
|
|
22
|
+
orders:OrderProps[],
|
|
23
|
+
fund_orders:FundOrderProps[],
|
|
24
|
+
external_name?:string,
|
|
25
|
+
onSetMarket:(orders:OrderProps[], market:MarketProps, prices:ExternalPriceProps[]) => void,
|
|
26
|
+
onClearMarket:(order_ids:string[]) => void,
|
|
27
|
+
onWorkCapital:(amount:number) => void,
|
|
28
|
+
onLayoffCapital: (amount: number) => void,
|
|
29
|
+
onDepositFund: (amount:number) => void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
const Dashboard = ({ fund, loaded, external_name, prices, leagues, events, tournaments, matches, markets, orders, fund_orders, best_available_orders, trades, onSetMarket, onClearMarket, onWorkCapital, onLayoffCapital, onDepositFund }:DashboardProps) => {
|
|
34
|
+
const [ dash_size, setDashSize ] = useState({ height:400, width:400 });
|
|
35
|
+
const contests = MarketMaketHelpers.sortContests(events, tournaments, matches, markets)
|
|
36
|
+
const renderContests = (data:{item:SortedContestProps, index:number}) => {
|
|
37
|
+
if(!fund){ return <></> }
|
|
38
|
+
const league = leagues.find(l => l.league_id == data.item.league_id)
|
|
39
|
+
const contest_orders = orders.filter(o => o.event_type == data.item.contest_type && o.event_id == data.item.id);
|
|
40
|
+
const contest_fund_orders = fund_orders.filter(fo => contest_orders.map(o => o.order_id.toString()).includes(fo.order_id.toString()));
|
|
41
|
+
const contest_trades = trades.filter(t => t.event_type == data.item.contest_type && t.event_id == data.item.id);
|
|
42
|
+
const contest_ba = best_available_orders.filter(o => o.event_type == data.item.contest_type && o.event_id == data.item.id);
|
|
43
|
+
|
|
44
|
+
const event = events.find(e => e.event_id == data.item.id && data.item.contest_type == 'team');
|
|
45
|
+
const tournament = tournaments.find(t => t.tournament_id == data.item.id && data.item.contest_type == 'tournament');
|
|
46
|
+
const match = matches.find(m => m.match_id == data.item.id && data.item.contest_type == 'match');
|
|
47
|
+
const contest_prices = prices.filter(p => p.event_type == data.item.contest_type && p.event_id == data.item.id);
|
|
48
|
+
const book_prices = contest_prices.filter(p => p.external_name == external_name)
|
|
49
|
+
return (
|
|
50
|
+
<View style={{ minWidth:335 }} key={`${data.item.contest_type}${data.item.id}`}>
|
|
51
|
+
<Contest
|
|
52
|
+
contest_id={data.item.id}
|
|
53
|
+
contest_type={data.item.contest_type}
|
|
54
|
+
time_detail={data.item.time_detail}
|
|
55
|
+
league={league}
|
|
56
|
+
event={event}
|
|
57
|
+
tournament={tournament}
|
|
58
|
+
match={match}
|
|
59
|
+
fund={fund}
|
|
60
|
+
contest_title={data.item.title}
|
|
61
|
+
latest_trades={contest_trades}
|
|
62
|
+
best_available_orders={contest_ba}
|
|
63
|
+
external_prices={book_prices}
|
|
64
|
+
backup_prices={contest_prices}
|
|
65
|
+
orders={contest_orders}
|
|
66
|
+
fund_orders={contest_fund_orders}
|
|
67
|
+
onSetMarket={onSetMarket}
|
|
68
|
+
onClearMarket={onClearMarket}
|
|
69
|
+
markets={data.item.markets}
|
|
70
|
+
/>
|
|
71
|
+
</View>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<View style={{ ...view_styles.section, flexGrow:1, flexShrink:1 }} onLayout={(ev) => {
|
|
77
|
+
const { width, height } = ev.nativeEvent.layout;
|
|
78
|
+
setDashSize({ width, height })
|
|
79
|
+
}}>
|
|
80
|
+
<View style={{ ...view_styles.section_header }}>
|
|
81
|
+
<View style={{ flex:1 }}>
|
|
82
|
+
<Text theme='header'>Dashboard</Text>
|
|
83
|
+
<Text style={{ marginTop:3 }} theme='body'>Select contests and markets to see activity and market options</Text>
|
|
84
|
+
</View>
|
|
85
|
+
</View>
|
|
86
|
+
{fund?
|
|
87
|
+
<FundActions
|
|
88
|
+
fund={fund}
|
|
89
|
+
onDepositFund={onDepositFund}
|
|
90
|
+
onLayoffCapital={onLayoffCapital}
|
|
91
|
+
onWorkCapital={onWorkCapital}
|
|
92
|
+
onReleaseFunds={() => console.log('WITDHRAW!!!')}
|
|
93
|
+
/>
|
|
94
|
+
:<></>}
|
|
95
|
+
<View style={{ maxWidth: dash_size.width, flexDirection:'row', flexWrap:'wrap' }}>
|
|
96
|
+
{contests.sort((a,b) => a.scheduled_datetime.unix() - b.scheduled_datetime.unix()).map((c,i) => {
|
|
97
|
+
return renderContests({ item: c, index:i })
|
|
98
|
+
})}
|
|
99
|
+
</View>
|
|
100
|
+
{!loaded ?
|
|
101
|
+
<View style={{ position:'absolute', top:0, left:0, right:0, bottom:0, backgroundColor:Colors.shades.black_faded, justifyContent:'center', alignItems:'center' }}>
|
|
102
|
+
<View style={{ ...view_styles.section, minWidth:200, minHeight:200, justifyContent:'center', alignItems:'center' }}>
|
|
103
|
+
<ActivityIndicator style={{ alignSelf:'center'}} size='large' color={Colors.brand.midnight} />
|
|
104
|
+
<Text style={{ marginTop:10 }} theme='header_2'>Loading Your Data...</Text>
|
|
105
|
+
</View>
|
|
106
|
+
</View>
|
|
107
|
+
:<></>}
|
|
108
|
+
</View>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export default Dashboard
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View, TouchableOpacity, FlatList } from 'react-native';
|
|
3
|
+
import type { FundProps } from "../../types";
|
|
4
|
+
import { view_styles } from '../../constants/styles';
|
|
5
|
+
import { Button, Text, TextInput } from '../../Components';
|
|
6
|
+
import Colors from '../../constants/colors';
|
|
7
|
+
|
|
8
|
+
type FundActionsProps = {
|
|
9
|
+
fund:FundProps,
|
|
10
|
+
onWorkCapital:(amount:number) => void,
|
|
11
|
+
onLayoffCapital:(amount: number) => void,
|
|
12
|
+
onDepositFund:(amount: number) => void,
|
|
13
|
+
onReleaseFunds:(amount:number) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const FundActions = ({ fund, onWorkCapital, onLayoffCapital, onDepositFund }:FundActionsProps) => {
|
|
17
|
+
const [ show_actions, setShowActions ] = useState(false);
|
|
18
|
+
const [ selected_action, setSelectedAction ] = useState<any | undefined>(undefined);
|
|
19
|
+
const [ amount, setAmount ] = useState('');
|
|
20
|
+
|
|
21
|
+
const actions = [
|
|
22
|
+
{action:'deposit', label:'Deposit Capital', color:Colors.utility.success},
|
|
23
|
+
{action:'work', label:'Work Capital', color:Colors.brand.electric},
|
|
24
|
+
{action:'layoff', label:'Layoff Capital', color:Colors.utility.error}
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
const renderActions = (data:{item:any, index:number}) => {
|
|
28
|
+
return (
|
|
29
|
+
<TouchableOpacity style={{ ...view_styles.body_row, padding:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }} onPress={() => setSelectedAction(data.item)}>
|
|
30
|
+
<View style={{ flex:1 }}>
|
|
31
|
+
<Text size={14} color={data.item.color} weight='semibold'>{data.item.label}</Text>
|
|
32
|
+
</View>
|
|
33
|
+
</TouchableOpacity>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let action_valid = selected_action && !isNaN(parseFloat(amount)) ? true : false
|
|
38
|
+
|
|
39
|
+
const handleAction = (selected_action:{ action:string }) => {
|
|
40
|
+
setSelectedAction(undefined);
|
|
41
|
+
setShowActions(false);
|
|
42
|
+
switch(selected_action.action){
|
|
43
|
+
case 'deposit':
|
|
44
|
+
return onDepositFund(parseFloat(amount))
|
|
45
|
+
case 'work':
|
|
46
|
+
return onWorkCapital(parseFloat(amount))
|
|
47
|
+
case 'layoff':
|
|
48
|
+
return onLayoffCapital(parseFloat(amount))
|
|
49
|
+
default: return alert('Not handled')
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<View style={{ ...view_styles.section_header, zIndex:1 }}>
|
|
55
|
+
<View style={{ flex:1 }}>
|
|
56
|
+
<Text theme='header'>{fund.name}</Text>
|
|
57
|
+
<Text style={{ marginTop:3 }} theme='body'>${fund.invested_capital.toFixed(2)} Total Invested</Text>
|
|
58
|
+
</View>
|
|
59
|
+
<View style={{ padding:10, borderRightWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
60
|
+
<Text textAlign='center' size={14} color={Colors.utility.success}>${fund.available_capital.toFixed(2)}</Text>
|
|
61
|
+
<Text textAlign='center' size={14} color={Colors.utility.success}>Available</Text>
|
|
62
|
+
</View>
|
|
63
|
+
<View style={{ padding:10, borderRightWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
64
|
+
<Text textAlign='center' size={14} color={Colors.brand.electric}>${fund.working_capital.toFixed(2)}</Text>
|
|
65
|
+
<Text textAlign='center' size={14} color={Colors.brand.electric}>Working</Text>
|
|
66
|
+
</View>
|
|
67
|
+
<View style={{ padding:10 }}>
|
|
68
|
+
<Text textAlign='center' size={14} color={Colors.brand.midnight}>${fund.deployed_capital.toFixed(2)}</Text>
|
|
69
|
+
<Text textAlign='center' size={14} color={Colors.brand.midnight}>Deployed</Text>
|
|
70
|
+
</View>
|
|
71
|
+
<Button
|
|
72
|
+
title='ACTIONS'
|
|
73
|
+
style={{ marginLeft:10 }}
|
|
74
|
+
onPress={() => setShowActions(true)}
|
|
75
|
+
backgroundColor={Colors.brand.electric}
|
|
76
|
+
title_color={Colors.shades.white}
|
|
77
|
+
/>
|
|
78
|
+
{show_actions ?
|
|
79
|
+
<View style={{ position:'absolute', top:0, right:0 }}>
|
|
80
|
+
<View style={{ ...view_styles.section, minWidth:275 }}>
|
|
81
|
+
<View style={{ ...view_styles.section_header }}>
|
|
82
|
+
<View style={{ flex:1 }}>
|
|
83
|
+
<Text theme='header_2'>Fund Actions</Text>
|
|
84
|
+
</View>
|
|
85
|
+
<Button
|
|
86
|
+
title='X'
|
|
87
|
+
title_color={Colors.brand.midnight}
|
|
88
|
+
borderRadius={100}
|
|
89
|
+
backgroundColor={Colors.shades.shade100}
|
|
90
|
+
onPress={() => setShowActions(false)}
|
|
91
|
+
/>
|
|
92
|
+
</View>
|
|
93
|
+
{!selected_action ?
|
|
94
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
95
|
+
<FlatList
|
|
96
|
+
data={actions}
|
|
97
|
+
key={'action_list'}
|
|
98
|
+
keyExtractor={(item) => item.action}
|
|
99
|
+
renderItem={renderActions}
|
|
100
|
+
/>
|
|
101
|
+
</View>
|
|
102
|
+
:
|
|
103
|
+
<View>
|
|
104
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
105
|
+
<View style={{ padding:10 }}>
|
|
106
|
+
<Text size={14} color={Colors.brand.midnight} textAlign='center'>{selected_action.label}</Text>
|
|
107
|
+
</View>
|
|
108
|
+
<View style={{ ...view_styles.body_row }}>
|
|
109
|
+
<Text size={14} color={Colors.brand.midnight} weight='bold'>$</Text>
|
|
110
|
+
<TextInput
|
|
111
|
+
style={{ ...view_styles.input, marginLeft:3, flex:1 }}
|
|
112
|
+
placeholder='0'
|
|
113
|
+
placeholderTextColor={Colors.shades.shade600}
|
|
114
|
+
value={amount}
|
|
115
|
+
onChangeText={(text) => setAmount(text)}
|
|
116
|
+
/>
|
|
117
|
+
</View>
|
|
118
|
+
</View>
|
|
119
|
+
<View style={{ ...view_styles.section_footer }}>
|
|
120
|
+
<Button
|
|
121
|
+
title='CANCEL'
|
|
122
|
+
style={{ flex:1, minWidth:80, marginRight:5 }}
|
|
123
|
+
borderRadius={8}
|
|
124
|
+
title_color={Colors.shades.white}
|
|
125
|
+
backgroundColor={Colors.utility.error}
|
|
126
|
+
onPress={() => setSelectedAction(undefined)}
|
|
127
|
+
/>
|
|
128
|
+
<Button
|
|
129
|
+
title='SUBMIT'
|
|
130
|
+
style={{ flex:2, opacity: action_valid ? 1 : 0.5 }}
|
|
131
|
+
disabled={!action_valid}
|
|
132
|
+
borderRadius={8}
|
|
133
|
+
title_color={Colors.shades.white}
|
|
134
|
+
backgroundColor={Colors.utility.success}
|
|
135
|
+
onPress={() => handleAction(selected_action)}
|
|
136
|
+
/>
|
|
137
|
+
</View>
|
|
138
|
+
</View>
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
</View>
|
|
142
|
+
</View>
|
|
143
|
+
:<></>}
|
|
144
|
+
</View>
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export default FundActions
|