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,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, FlatList, Image } from 'react-native';
|
|
3
|
+
import type { FundOwnershipProps, PublicPlayerProps } from "../../types"
|
|
4
|
+
import { view_styles } from '../../constants/styles';
|
|
5
|
+
import { Text } from '../../Components';
|
|
6
|
+
import Colors from '../../constants/colors';
|
|
7
|
+
import moment from 'moment-mini';
|
|
8
|
+
|
|
9
|
+
type FundOwnershipListProps = {
|
|
10
|
+
fund_ownerships:FundOwnershipProps[],
|
|
11
|
+
players:PublicPlayerProps[]
|
|
12
|
+
}
|
|
13
|
+
const FundOwnershipList = ({ fund_ownerships, players }:FundOwnershipListProps) => {
|
|
14
|
+
|
|
15
|
+
const renderFundOwnerships = (data:{ item:FundOwnershipProps, index:number }) => {
|
|
16
|
+
const player = players.find(p => p.player_id == data.item.player_id);
|
|
17
|
+
if(!player){ return <></> }
|
|
18
|
+
return (
|
|
19
|
+
<View style={{ ...view_styles.body_row, padding:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
20
|
+
<Image
|
|
21
|
+
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
22
|
+
style={{ height:40, width:40, borderRadius:100 }}
|
|
23
|
+
resizeMode='cover'
|
|
24
|
+
/>
|
|
25
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
26
|
+
<Text size={14} color={Colors.brand.midnight} weight='bold'>{player.first_name} {player.last_name}</Text>
|
|
27
|
+
<Text style={{ marginTop:3 }} size={12} weight='regular' color={Colors.brand.midnight}>Owner since {moment(data.item.create_datetime).format('MMM DD YYYY')}</Text>
|
|
28
|
+
</View>
|
|
29
|
+
<Text size={14} weight='bold' color={Colors.brand.midnight}>{(data.item.ownership_pct * 100).toFixed(2)}%</Text>
|
|
30
|
+
</View>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={{ ...view_styles.section }}>
|
|
36
|
+
<View style={{ ...view_styles.section_header }}>
|
|
37
|
+
<View style={{ flex:1 }}>
|
|
38
|
+
<Text theme='header'>Fund Owners</Text>
|
|
39
|
+
<Text style={{ marginTop:3 }} theme='body'>Below are the players that have invested in this fund sorted by their ownership pct.</Text>
|
|
40
|
+
</View>
|
|
41
|
+
</View>
|
|
42
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
43
|
+
<FlatList
|
|
44
|
+
key={'fund_ownerships'}
|
|
45
|
+
data={fund_ownerships.sort((a,b) => b.ownership_pct - a.ownership_pct)}
|
|
46
|
+
keyExtractor={(item) => item.fund_ownership_id.toString()}
|
|
47
|
+
renderItem={renderFundOwnerships}
|
|
48
|
+
/>
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default FundOwnershipList
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, FlatList, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { view_styles } from "../../constants/styles"
|
|
4
|
+
import type { FundProps } from '../../types';
|
|
5
|
+
import { Button, Checkbox, Icons, Text } from '../../Components';
|
|
6
|
+
import Colors from '../../constants/colors';
|
|
7
|
+
import { MarketMakerApi } from '../api';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
type FundSelectorProps = {
|
|
11
|
+
funds:FundProps[],
|
|
12
|
+
selected_fund_id?:string,
|
|
13
|
+
maxHeight:number,
|
|
14
|
+
onSelectFund:(f:FundProps) => void,
|
|
15
|
+
onCreateFund:(f:FundProps) => void,
|
|
16
|
+
onEditFund:(f:FundProps) => void
|
|
17
|
+
}
|
|
18
|
+
const FundSelector = ({ selected_fund_id, funds, maxHeight, onSelectFund, onCreateFund, onEditFund }:FundSelectorProps) => {
|
|
19
|
+
|
|
20
|
+
const renderFunds = (data:{item:FundProps, index:number}) => {
|
|
21
|
+
const selected = selected_fund_id == data.item.fund_id ? true : false
|
|
22
|
+
return (
|
|
23
|
+
<TouchableOpacity style={{ ...view_styles.body_row, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }} onPress={() => onSelectFund(data.item)}>
|
|
24
|
+
<Checkbox checked={selected} disabled onSelect={() => console.log('')}/>
|
|
25
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
26
|
+
<Text size={12} weight='bold' color={Colors.brand.midnight}>{data.item.name}</Text>
|
|
27
|
+
<Text style={{ marginTop:3 }} theme='body_2'>This is a cool fund!</Text>
|
|
28
|
+
</View>
|
|
29
|
+
<TouchableOpacity onPress={() => onEditFund(data.item)}>
|
|
30
|
+
<Icons.EditIcon size={18} color={Colors.brand.electric} />
|
|
31
|
+
</TouchableOpacity>
|
|
32
|
+
</TouchableOpacity>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
return (
|
|
36
|
+
<View style={{ ...view_styles.section, maxHeight }}>
|
|
37
|
+
<View style={{ ...view_styles.section_header }}>
|
|
38
|
+
<View style={{ flex:1 }}>
|
|
39
|
+
<Text theme='header'>Select Fund</Text>
|
|
40
|
+
<Text style={{ marginTop:3 }} theme='body_2'>Select a fund to populate the dashboard with the funds orders and data</Text>
|
|
41
|
+
</View>
|
|
42
|
+
<Button
|
|
43
|
+
title='NEW'
|
|
44
|
+
backgroundColor={Colors.utility.success}
|
|
45
|
+
title_color={Colors.shades.white}
|
|
46
|
+
onPress={async() => {
|
|
47
|
+
const new_fund = await MarketMakerApi.createFund('Pending Fund', 100, 'FOR_MONEY');
|
|
48
|
+
if(!new_fund){ return alert('Unable to process') }
|
|
49
|
+
onCreateFund(new_fund)
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
</View>
|
|
53
|
+
<View style={{ ...view_styles.section_body }}>
|
|
54
|
+
<FlatList
|
|
55
|
+
key={'market_selector'}
|
|
56
|
+
data={funds}
|
|
57
|
+
renderItem={renderFunds}
|
|
58
|
+
keyExtractor={(item) => item.fund_id.toString()}
|
|
59
|
+
/>
|
|
60
|
+
</View>
|
|
61
|
+
</View>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default FundSelector
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, FlatList, Image } from 'react-native';
|
|
3
|
+
import type { FundingRequestProps, PublicPlayerProps } from "../../types"
|
|
4
|
+
import { view_styles } from '../../constants/styles';
|
|
5
|
+
import { Button, Text } from '../../Components';
|
|
6
|
+
import Colors from '../../constants/colors';
|
|
7
|
+
import moment from 'moment-mini';
|
|
8
|
+
|
|
9
|
+
type FundingRequestListProps = {
|
|
10
|
+
funding_requests:FundingRequestProps[],
|
|
11
|
+
players:PublicPlayerProps[],
|
|
12
|
+
onApproveRequest:(funding_request_id:string) => void,
|
|
13
|
+
onDeclineRequest:(funding_request_id:string) => void
|
|
14
|
+
}
|
|
15
|
+
const FundingRequestList = ({ funding_requests, players, onApproveRequest, onDeclineRequest }:FundingRequestListProps) => {
|
|
16
|
+
|
|
17
|
+
const renderFundingRequests = (data:{ item:FundingRequestProps, index:number }) => {
|
|
18
|
+
const player = players.find(p => p.player_id == data.item.player_id)
|
|
19
|
+
if(!player){ return <></> }
|
|
20
|
+
return (
|
|
21
|
+
<View style={{ ...view_styles.body_row, padding:10, borderBottomWidth:1, borderColor:Colors.shades.shade600 }}>
|
|
22
|
+
<Image
|
|
23
|
+
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
24
|
+
style={{ height:40, width:40, borderRadius:100 }}
|
|
25
|
+
resizeMode='cover'
|
|
26
|
+
/>
|
|
27
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
28
|
+
<Text size={14} color={Colors.brand.midnight} weight='bold'>{player.first_name} {player.last_name}</Text>
|
|
29
|
+
<Text style={{ marginTop:3 }} size={12} weight='regular' color={Colors.brand.midnight}>Requested on {moment(data.item.create_datetime).format('MMM DD hh:mm a')}</Text>
|
|
30
|
+
</View>
|
|
31
|
+
<Text size={14} weight='bold' color={Colors.brand.midnight}>${data.item.amount.toFixed(2)}</Text>
|
|
32
|
+
<Button
|
|
33
|
+
title='DECLINE'
|
|
34
|
+
style={{ marginRight:5, marginLeft:5 }}
|
|
35
|
+
title_color={Colors.shades.white}
|
|
36
|
+
backgroundColor={Colors.utility.error}
|
|
37
|
+
borderRadius={4}
|
|
38
|
+
onPress={() => onDeclineRequest(data.item.funding_request_id)}
|
|
39
|
+
/>
|
|
40
|
+
<Button
|
|
41
|
+
title='APPROVE'
|
|
42
|
+
title_color={Colors.shades.white}
|
|
43
|
+
backgroundColor={Colors.utility.success}
|
|
44
|
+
borderRadius={4}
|
|
45
|
+
onPress={() => onApproveRequest(data.item.funding_request_id)}
|
|
46
|
+
/>
|
|
47
|
+
</View>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<View style={{ ...view_styles.section }}>
|
|
53
|
+
<View style={{ ...view_styles.section_header }}>
|
|
54
|
+
<View style={{ flex:1 }}>
|
|
55
|
+
<Text theme='header'>Funding Requests</Text>
|
|
56
|
+
<Text style={{ marginTop:3 }} theme='body'>Below are the pending funding requests. Approve or decline them.</Text>
|
|
57
|
+
</View>
|
|
58
|
+
</View>
|
|
59
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
60
|
+
<FlatList
|
|
61
|
+
key={'funding_requests'}
|
|
62
|
+
data={funding_requests}
|
|
63
|
+
keyExtractor={(item) => item.funding_request_id.toString()}
|
|
64
|
+
renderItem={renderFundingRequests}
|
|
65
|
+
/>
|
|
66
|
+
</View>
|
|
67
|
+
</View>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default FundingRequestList
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View } 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
|
+
import { MarketMakerApi } from '../api';
|
|
8
|
+
|
|
9
|
+
type ManageFundFormProps = {
|
|
10
|
+
fund: FundProps
|
|
11
|
+
onFundUpdate:(fund:FundProps) => void,
|
|
12
|
+
onClose:() => void
|
|
13
|
+
}
|
|
14
|
+
const ManageFundForm = ({ fund, onFundUpdate, onClose }:ManageFundFormProps) => {
|
|
15
|
+
const [ form_data, setFormData ] = useState<{
|
|
16
|
+
loading:boolean,
|
|
17
|
+
draft_fund?:FundProps
|
|
18
|
+
}>({
|
|
19
|
+
loading:false
|
|
20
|
+
});
|
|
21
|
+
const { loading, draft_fund } = form_data;
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setFormData({ ...form_data, draft_fund: fund })
|
|
25
|
+
},[fund])
|
|
26
|
+
|
|
27
|
+
if(!draft_fund){ return <></> }
|
|
28
|
+
|
|
29
|
+
const is_name_changed = fund.name != draft_fund.name ? true : false
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<View style={{ ...view_styles.section }}>
|
|
33
|
+
<View style={{ ...view_styles.section_header }}>
|
|
34
|
+
<View style={{ flex:1 }}>
|
|
35
|
+
<Text theme='header'>Manage Fund</Text>
|
|
36
|
+
<Text style={{ marginTop:3 }} theme='body'>Update fund settings below and save</Text>
|
|
37
|
+
</View>
|
|
38
|
+
<Button
|
|
39
|
+
title='X'
|
|
40
|
+
title_color={Colors.brand.midnight}
|
|
41
|
+
borderRadius={100}
|
|
42
|
+
backgroundColor={Colors.shades.shade100}
|
|
43
|
+
onPress={() => onClose()}
|
|
44
|
+
/>
|
|
45
|
+
</View>
|
|
46
|
+
<View style={{ ...view_styles.section_body }}>
|
|
47
|
+
<View style={{ ...view_styles.body_row }}>
|
|
48
|
+
<View style={{ flex:1 }}>
|
|
49
|
+
<Text theme='header_2'>Fund Name</Text>
|
|
50
|
+
<View style={{ marginTop:5, flexDirection:'row', alignItems:'center' }}>
|
|
51
|
+
<TextInput
|
|
52
|
+
style={{ ...view_styles.input }}
|
|
53
|
+
value={draft_fund.name}
|
|
54
|
+
onChangeText={(text) => setFormData({ ...form_data, draft_fund: { ...draft_fund, name: text } })}
|
|
55
|
+
/>
|
|
56
|
+
<Button
|
|
57
|
+
title='SAVE'
|
|
58
|
+
backgroundColor={Colors.utility.success}
|
|
59
|
+
style={{ opacity: is_name_changed && !loading ? 1: 0.5, marginLeft:10 }}
|
|
60
|
+
disabled={!is_name_changed || loading}
|
|
61
|
+
onPress={async() => {
|
|
62
|
+
setFormData({ ...form_data, loading: true });
|
|
63
|
+
let new_fund = await MarketMakerApi.udpateFundName(fund.fund_id, draft_fund.name)
|
|
64
|
+
if(!new_fund){ return alert('Unable to process') }
|
|
65
|
+
setFormData({
|
|
66
|
+
...form_data,
|
|
67
|
+
loading: false,
|
|
68
|
+
draft_fund: new_fund
|
|
69
|
+
});
|
|
70
|
+
onFundUpdate(new_fund)
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
</View>
|
|
74
|
+
|
|
75
|
+
</View>
|
|
76
|
+
</View>
|
|
77
|
+
</View>
|
|
78
|
+
|
|
79
|
+
</View>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export default ManageFundForm
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, FlatList, TouchableOpacity } from 'react-native';
|
|
3
|
+
import { view_styles } from "../../constants/styles"
|
|
4
|
+
import type { MarketProps } from '../../types';
|
|
5
|
+
import { Checkbox, Text } from '../../Components';
|
|
6
|
+
import Colors from '../../constants/colors';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
type MarketSelectorProps = {
|
|
10
|
+
maxHeight?:number,
|
|
11
|
+
markets:MarketProps[],
|
|
12
|
+
selected_markets:string[],
|
|
13
|
+
onSelectMarket:(m:MarketProps) => void,
|
|
14
|
+
onDeselectMarket:(m:MarketProps) => void
|
|
15
|
+
}
|
|
16
|
+
const MarketSelector = ({ maxHeight, markets, selected_markets, onSelectMarket, onDeselectMarket }:MarketSelectorProps) => {
|
|
17
|
+
|
|
18
|
+
const renderMarkets = (data:{item:MarketProps, index:number}) => {
|
|
19
|
+
const selected = selected_markets.find(se => se == data.item.market_id) ? true : false;
|
|
20
|
+
return (
|
|
21
|
+
<TouchableOpacity style={{ ...view_styles.body_row, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }} onPress={() => selected ? onDeselectMarket(data.item) : onSelectMarket(data.item)}>
|
|
22
|
+
<Checkbox checked={selected} disabled onSelect={() => console.log('')}/>
|
|
23
|
+
<View style={{ flex:1, marginLeft:10 }}>
|
|
24
|
+
<Text size={12} weight='bold' color={Colors.brand.midnight}>{data.item.type == 'Stat' ? data.item.stat_label : data.item.type}</Text>
|
|
25
|
+
<Text style={{ marginTop:3 }} theme='body_2'>{data.item.description}</Text>
|
|
26
|
+
</View>
|
|
27
|
+
</TouchableOpacity>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
return (
|
|
31
|
+
<View style={{ ...view_styles.section, maxHeight }}>
|
|
32
|
+
<View style={{ ...view_styles.section_header }}>
|
|
33
|
+
<View style={{ flex:1 }}>
|
|
34
|
+
<Text theme='header'>Select Market</Text>
|
|
35
|
+
<Text style={{ marginTop:3 }} theme='body_2'>Manage the markets that are shown on the dashboard</Text>
|
|
36
|
+
</View>
|
|
37
|
+
</View>
|
|
38
|
+
<View style={{ ...view_styles.section_body }}>
|
|
39
|
+
<FlatList
|
|
40
|
+
key={'market_selector'}
|
|
41
|
+
data={markets}
|
|
42
|
+
renderItem={renderMarkets}
|
|
43
|
+
keyExtractor={(item) => item.market_id.toString()}
|
|
44
|
+
/>
|
|
45
|
+
</View>
|
|
46
|
+
</View>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default MarketSelector
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { ExternalPriceProps, FundProps, MarketProps, OrderProps } from '../../types';
|
|
4
|
+
import { view_styles } from '../../constants/styles';
|
|
5
|
+
import { Button, Text, TextInput } from '../../Components';
|
|
6
|
+
import Colors from '../../constants/colors';
|
|
7
|
+
import { MarketMaketHelpers } from '../api';
|
|
8
|
+
|
|
9
|
+
type SetMarketFormProps = {
|
|
10
|
+
fund:FundProps,
|
|
11
|
+
form_key:string,
|
|
12
|
+
orders:OrderProps[],
|
|
13
|
+
market:MarketProps,
|
|
14
|
+
prices:ExternalPriceProps[],
|
|
15
|
+
spread_pct:string,
|
|
16
|
+
onSetMarket:(orders:OrderProps[]) => void
|
|
17
|
+
onClose:() => void
|
|
18
|
+
}
|
|
19
|
+
const SetMarketForm = ({ form_key, orders, market, prices, onClose, onSetMarket }:SetMarketFormProps) => {
|
|
20
|
+
const [ form_data, setFormData ] = useState<{
|
|
21
|
+
spread_pct:string,
|
|
22
|
+
trade_side?:OrderProps,
|
|
23
|
+
o_side?:OrderProps
|
|
24
|
+
}>({
|
|
25
|
+
spread_pct: '5'
|
|
26
|
+
})
|
|
27
|
+
const { trade_side, o_side, spread_pct } = form_data;
|
|
28
|
+
|
|
29
|
+
const no_vig_data = MarketMaketHelpers.getNoVigPrice(prices, market);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if(!form_key) { return }
|
|
33
|
+
let trade_side_o = orders.find(o => o.side == market.trade_side);
|
|
34
|
+
let o_side_o = orders.find(o => o.side != market.trade_side);
|
|
35
|
+
setFormData({ trade_side:trade_side_o, o_side: o_side_o, spread_pct });
|
|
36
|
+
},[form_key])
|
|
37
|
+
|
|
38
|
+
if(!trade_side || !o_side){ return <></> }
|
|
39
|
+
const actual_margin = (1 - [trade_side, o_side].reduce((a, b) => a + b.probability, 0)) * 100
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<View style={{ ...view_styles.section, minWidth:330 }}>
|
|
43
|
+
<View style={{ ...view_styles.section_header, paddingLeft:10 }}>
|
|
44
|
+
<View style={{ flex:1 }}>
|
|
45
|
+
<Text theme='header'>Set Market</Text>
|
|
46
|
+
<Text style={{ marginTop:3 }} theme='body'>Customize the orders below or submit</Text>
|
|
47
|
+
</View>
|
|
48
|
+
<Button
|
|
49
|
+
title='X'
|
|
50
|
+
borderRadius={100}
|
|
51
|
+
backgroundColor={Colors.shades.shade100}
|
|
52
|
+
title_color={Colors.utility.error}
|
|
53
|
+
onPress={() => onClose()}
|
|
54
|
+
/>
|
|
55
|
+
</View>
|
|
56
|
+
<View style={{ ...view_styles.section_body, padding:0 }}>
|
|
57
|
+
{no_vig_data ?
|
|
58
|
+
<View style={{ ...view_styles.body_row, padding:10 }}>
|
|
59
|
+
<View style={{ flex:1 }}>
|
|
60
|
+
<Text theme='header_2'>{no_vig_data.external_name}</Text>
|
|
61
|
+
<Text style={{ marginTop:3 }} theme='body_2'>The NO VIG price retrieved from {no_vig_data.external_name}</Text>
|
|
62
|
+
</View>
|
|
63
|
+
<Text size={16}>{MarketMaketHelpers.getOddsLabel(no_vig_data.trade_side_odds)}</Text>
|
|
64
|
+
</View>
|
|
65
|
+
:<></>}
|
|
66
|
+
<View style={{ ...view_styles.body_row, padding:10, borderBottomWidth:1, borderColor:Colors.shades.shade600, backgroundColor:Colors.shades.shade100 }}>
|
|
67
|
+
<View style={{ flex:1, marginRight:10}}>
|
|
68
|
+
<Text theme='header_2'>Customize Margin</Text>
|
|
69
|
+
<Text style={{ marginTop:3 }} theme='body_2'>Set the margin pct to automatically create prices.</Text>
|
|
70
|
+
</View>
|
|
71
|
+
{actual_margin.toFixed(2) != parseInt(spread_pct).toFixed(2) ?
|
|
72
|
+
<Text size={14} color={actual_margin < 0 ? Colors.utility.error : actual_margin < 5 ? Colors.utility.success : actual_margin > 8 ? Colors.utility.error : Colors.utility.warning} weight='bold'>{actual_margin .toFixed(2)}%</Text>
|
|
73
|
+
:<></>}
|
|
74
|
+
<TextInput
|
|
75
|
+
style={{ ...view_styles.input, width:40 }}
|
|
76
|
+
value={spread_pct}
|
|
77
|
+
onChangeText={(text) => setFormData({ ...form_data, spread_pct: text })}
|
|
78
|
+
/>
|
|
79
|
+
<Text size={16} color={Colors.brand.midnight}>%</Text>
|
|
80
|
+
</View>
|
|
81
|
+
<View style={{ ...view_styles.body_row, paddingBottom:10 }}>
|
|
82
|
+
<View style={{ flex:1 }}>
|
|
83
|
+
<View style={{ padding:10, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}>
|
|
84
|
+
<Text size={14} color={Colors.brand.midnight} weight='bold' textAlign='center'>{o_side.title}</Text>
|
|
85
|
+
</View>
|
|
86
|
+
</View>
|
|
87
|
+
<View style={{ flex:1 }}>
|
|
88
|
+
<View style={{ padding:10, borderBottomWidth:1, borderBottomColor:Colors.shades.shade600 }}>
|
|
89
|
+
<Text size={14} color={Colors.brand.midnight} weight='bold' textAlign='center'>{trade_side.title}</Text>
|
|
90
|
+
</View>
|
|
91
|
+
</View>
|
|
92
|
+
</View>
|
|
93
|
+
|
|
94
|
+
<View style={{ ...view_styles.body_row }}>
|
|
95
|
+
<Text style={{ flex:1 }} textAlign='center' size={14} color={Colors.brand.midnight}>${o_side.open_amt.toFixed(2)}</Text>
|
|
96
|
+
<Text size={14} color={Colors.brand.midnight} textAlign='center'>TO STAKE</Text>
|
|
97
|
+
<Text style={{ flex:1 }} textAlign='center' size={14} color={Colors.brand.midnight}>${trade_side.open_amt.toFixed(2)}</Text>
|
|
98
|
+
</View>
|
|
99
|
+
</View>
|
|
100
|
+
<View style={{ ...view_styles.section_footer }}>
|
|
101
|
+
<Button
|
|
102
|
+
title='Review'
|
|
103
|
+
style={{ flex:1 }}
|
|
104
|
+
borderRadius={4}
|
|
105
|
+
backgroundColor={Colors.brand.electric}
|
|
106
|
+
title_color={Colors.shades.white}
|
|
107
|
+
onPress={() => onSetMarket([o_side, trade_side])}
|
|
108
|
+
/>
|
|
109
|
+
</View>
|
|
110
|
+
|
|
111
|
+
</View>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export default SetMarketForm
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
/*
|
|
119
|
+
|
|
120
|
+
<View style={{ ...view_styles.body_row, padding:10 }}>
|
|
121
|
+
<TextInput
|
|
122
|
+
style={{ flex:1, ...view_styles.input }}
|
|
123
|
+
value={o_side.working_pct}
|
|
124
|
+
onChangeText={(text) => {
|
|
125
|
+
let open_amt = fund.working_capital * parseFloat(text)
|
|
126
|
+
|
|
127
|
+
setFormData({
|
|
128
|
+
...form_data,
|
|
129
|
+
o_side: {
|
|
130
|
+
...o_side,
|
|
131
|
+
working_pct: text,
|
|
132
|
+
open_amt: open_amt,
|
|
133
|
+
potential_winnings: MarketMaketHelpers.calcPotentialWinnings(open_amt, o_side.odds)
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
<Text style={{ marginLeft:5, marginRight:5 }} size={14} color={Colors.brand.midnight}>WORK %</Text>
|
|
139
|
+
<TextInput
|
|
140
|
+
style={{ flex:1, ...view_styles.input }}
|
|
141
|
+
value={trade_side.working_pct}
|
|
142
|
+
onChangeText={(text) => {
|
|
143
|
+
let open_amt = fund.working_capital * parseFloat(text)
|
|
144
|
+
|
|
145
|
+
setFormData({
|
|
146
|
+
...form_data,
|
|
147
|
+
trade_side: {
|
|
148
|
+
...trade_side,
|
|
149
|
+
working_pct: text,
|
|
150
|
+
open_amt: open_amt,
|
|
151
|
+
potential_winnings: MarketMaketHelpers.calcPotentialWinnings(open_amt, trade_side.odds)
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
</View>
|
|
157
|
+
<View style={{ ...view_styles.body_row, padding:10 }}>
|
|
158
|
+
<TextInput
|
|
159
|
+
style={{ flex:1, ...view_styles.input }}
|
|
160
|
+
value={o_side.potential_winnings}
|
|
161
|
+
onChangeText={(text) => setFormData({
|
|
162
|
+
...form_data,
|
|
163
|
+
o_side: {
|
|
164
|
+
...o_side,
|
|
165
|
+
potential_winnings: text,
|
|
166
|
+
open_amt: MarketMaketHelpers.calcSaleValue(o_side.odds, text)
|
|
167
|
+
}
|
|
168
|
+
})}
|
|
169
|
+
/>
|
|
170
|
+
<Text style={{ marginLeft:5, marginRight:5 }} size={14} color={Colors.brand.midnight}>TO WIN</Text>
|
|
171
|
+
<TextInput
|
|
172
|
+
style={{ flex:1, ...view_styles.input }}
|
|
173
|
+
value={trade_side.potential_winnings}
|
|
174
|
+
onChangeText={(text) => setFormData({
|
|
175
|
+
...form_data,
|
|
176
|
+
trade_side: {
|
|
177
|
+
...trade_side,
|
|
178
|
+
potential_winnings: text,
|
|
179
|
+
open_amt: MarketMaketHelpers.calcSaleValue(trade_side.odds, text)
|
|
180
|
+
}
|
|
181
|
+
})}
|
|
182
|
+
/>
|
|
183
|
+
</View>
|
|
184
|
+
<View style={{ ...view_styles.body_row, padding:10 }}>
|
|
185
|
+
<TextInput
|
|
186
|
+
style={{ flex:1, ...view_styles.input }}
|
|
187
|
+
value={o_side.odds}
|
|
188
|
+
onChangeText={(text) => setFormData({
|
|
189
|
+
...form_data,
|
|
190
|
+
o_side: {
|
|
191
|
+
...o_side,
|
|
192
|
+
odds: text,
|
|
193
|
+
probability: MarketMaketHelpers.calcProbabilityFromOdds(parseInt(text)),
|
|
194
|
+
potential_winnings: MarketMaketHelpers.calcPotentialWinnings(parseInt(text), o_side.potential_winnings)
|
|
195
|
+
}
|
|
196
|
+
})}
|
|
197
|
+
/>
|
|
198
|
+
<Text style={{ marginLeft:5, marginRight:5 }} size={14} color={Colors.brand.midnight}>ODDS</Text>
|
|
199
|
+
<TextInput
|
|
200
|
+
style={{ flex:1, ...view_styles.input }}
|
|
201
|
+
value={trade_side.odds}
|
|
202
|
+
onChangeText={(text) => setFormData({
|
|
203
|
+
...form_data,
|
|
204
|
+
trade_side: {
|
|
205
|
+
...trade_side,
|
|
206
|
+
odds: text,
|
|
207
|
+
probability: MarketMaketHelpers.calcProbabilityFromOdds(parseInt(text)),
|
|
208
|
+
open_amt: MarketMaketHelpers.calcSaleValue(parseInt(text), trade_side.potential_winnings)
|
|
209
|
+
}
|
|
210
|
+
})}
|
|
211
|
+
/>
|
|
212
|
+
</View>
|
|
213
|
+
*/
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import Colors from '../../constants/colors';
|
|
4
|
+
|
|
5
|
+
type WeightProgressProps = {
|
|
6
|
+
min_value:number,
|
|
7
|
+
max_value:number,
|
|
8
|
+
value: number,
|
|
9
|
+
width:number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const WeightProgress = ({ width, value }:WeightProgressProps) => {
|
|
13
|
+
let progress_width = value * width / 2
|
|
14
|
+
let start_point = width/2
|
|
15
|
+
if(progress_width < 0){
|
|
16
|
+
start_point += progress_width
|
|
17
|
+
}
|
|
18
|
+
return (
|
|
19
|
+
<View style={{ alignSelf:'center', width: width, height:4, borderRadius:2, backgroundColor:Colors.shades.white }}>
|
|
20
|
+
<View style={{ position:'absolute', left:start_point, width:Math.abs(progress_width), backgroundColor:Colors.brand.midnight, height:4, borderRadius:4 }}/>
|
|
21
|
+
</View>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default WeightProgress
|