be-components 7.3.6 → 7.3.8
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/CompetitionManager/api/index.js +9 -0
- package/lib/commonjs/CompetitionManager/api/index.js.map +1 -1
- package/lib/commonjs/CompetitionManager/components/ContestSelector.js +92 -2
- package/lib/commonjs/CompetitionManager/components/ContestSelector.js.map +1 -1
- package/lib/commonjs/EventComponents/api/index.js +90 -0
- package/lib/commonjs/EventComponents/api/index.js.map +1 -1
- package/lib/commonjs/FlashMarket/FlashHolder.js +5 -1
- package/lib/commonjs/FlashMarket/FlashHolder.js.map +1 -1
- package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js +212 -2
- package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js.map +1 -1
- package/lib/commonjs/Group/index.js +4 -1
- package/lib/commonjs/Group/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/api/index.js +14 -8
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/module/CompetitionManager/api/index.js +9 -0
- package/lib/module/CompetitionManager/api/index.js.map +1 -1
- package/lib/module/CompetitionManager/components/ContestSelector.js +93 -3
- package/lib/module/CompetitionManager/components/ContestSelector.js.map +1 -1
- package/lib/module/EventComponents/api/index.js +90 -0
- package/lib/module/EventComponents/api/index.js.map +1 -1
- package/lib/module/FlashMarket/FlashHolder.js +5 -1
- package/lib/module/FlashMarket/FlashHolder.js.map +1 -1
- package/lib/module/FlashMarket/components/ManageFlashMarket.js +212 -2
- package/lib/module/FlashMarket/components/ManageFlashMarket.js.map +1 -1
- package/lib/module/Group/index.js +4 -1
- package/lib/module/Group/index.js.map +1 -1
- package/lib/module/MarketComponents/api/index.js +14 -8
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/CompetitionManager/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSelector.d.ts +4 -1
- package/lib/typescript/lib/commonjs/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/EventComponents/api/index.d.ts +7 -0
- package/lib/typescript/lib/commonjs/EventComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/FlashMarket/FlashHolder.d.ts +2 -1
- package/lib/typescript/lib/commonjs/FlashMarket/FlashHolder.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Group/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/CompetitionManager/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/CompetitionManager/components/ContestSelector.d.ts +4 -1
- package/lib/typescript/lib/module/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/lib/module/EventComponents/api/index.d.ts +7 -0
- package/lib/typescript/lib/module/EventComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/FlashMarket/FlashHolder.d.ts +2 -1
- package/lib/typescript/lib/module/FlashMarket/FlashHolder.d.ts.map +1 -1
- package/lib/typescript/lib/module/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/lib/typescript/lib/module/Group/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +2 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/api/index.d.ts +1 -0
- package/lib/typescript/src/CompetitionManager/api/index.d.ts.map +1 -1
- package/lib/typescript/src/CompetitionManager/components/ContestSelector.d.ts +6 -3
- package/lib/typescript/src/CompetitionManager/components/ContestSelector.d.ts.map +1 -1
- package/lib/typescript/src/EventComponents/api/index.d.ts +12 -1
- package/lib/typescript/src/EventComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/FlashMarket/FlashHolder.d.ts +2 -1
- package/lib/typescript/src/FlashMarket/FlashHolder.d.ts.map +1 -1
- package/lib/typescript/src/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/lib/typescript/src/Group/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts +2 -0
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/CompetitionManager/api/index.ts +9 -0
- package/src/CompetitionManager/components/ContestSelector.tsx +109 -48
- package/src/EventComponents/api/index.ts +64 -1
- package/src/FlashMarket/FlashHolder.tsx +4 -3
- package/src/FlashMarket/components/ManageFlashMarket.tsx +119 -2
- package/src/Group/index.tsx +2 -1
- package/src/MarketComponents/api/index.ts +8 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { APIOverrides } from "../../ApiOverrides";
|
|
3
|
-
import type { EventProps, TeamProps } from '../../types';
|
|
3
|
+
import type { AthleteProps, EventProps, LeagueProps, MatchProps, TeamProps, TournamentProps } from '../../types';
|
|
4
4
|
|
|
5
5
|
let EVENT_SVC_API = ''
|
|
6
6
|
//let AUTH_SVC_API = ''
|
|
@@ -23,6 +23,69 @@ const EventComponentApi = {
|
|
|
23
23
|
return undefined
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
+
getLeagues: async():Promise<LeagueProps[]> => {
|
|
27
|
+
try {
|
|
28
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/leagues?status=active`)
|
|
29
|
+
return resp.data.leagues
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return []
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
getEventsByEventIds: async(event_ids:string[]):Promise<EventProps[]> => {
|
|
35
|
+
try {
|
|
36
|
+
if(event_ids.length == 0){ return [] }
|
|
37
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/events/bulk/get`, { attribute:'event_id', values: event_ids })
|
|
38
|
+
return resp.data.events
|
|
39
|
+
} catch (e) {
|
|
40
|
+
return []
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
getEventsByDate: async(league_id:string, date:string, timezone?:string):Promise<{day:string, days:string[], events:EventProps[]}> => {
|
|
44
|
+
try {
|
|
45
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/events/league/date/${league_id}/${date}?timezone=${timezone}`);
|
|
46
|
+
return resp.data
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return { day: date, days:[], events: [] }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
getMatchesByMatchIds: async(match_ids:string[]):Promise<MatchProps[]> => {
|
|
52
|
+
try {
|
|
53
|
+
if(match_ids.length == 0){ return [] }
|
|
54
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/matches/bulk/get`, { attribute: 'match_id', values: match_ids })
|
|
55
|
+
return resp.data.matches
|
|
56
|
+
} catch (e) {
|
|
57
|
+
return []
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
},
|
|
61
|
+
getAthletesByIds : async(athlete_ids:string[]):Promise<AthleteProps[]> => {
|
|
62
|
+
try {
|
|
63
|
+
if(athlete_ids.length == 0){ return [] }
|
|
64
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/athletes/bulk/get`, { attribute: 'athlete_id', values: athlete_ids })
|
|
65
|
+
return resp.data.athletes
|
|
66
|
+
} catch (e) {
|
|
67
|
+
return []
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
getTournamentsByTournamentIds: async(tournament_ids:string[]):Promise<TournamentProps[]> => {
|
|
71
|
+
try {
|
|
72
|
+
if(tournament_ids.length == 0){ return [] }
|
|
73
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/tournaments/bulk/get`, { attribute: 'event_id', values: tournament_ids })
|
|
74
|
+
return resp.data.tournaments
|
|
75
|
+
} catch (e) {
|
|
76
|
+
return []
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
getTeamsByIds: async(team_ids:string[]) => {
|
|
80
|
+
try {
|
|
81
|
+
if(team_ids.length == 0){ return [] }
|
|
82
|
+
const resp = await axios.post(`${EVENT_SVC_API}/v1/teams/bulk/get`, { attribute:'team_id', values: team_ids })
|
|
83
|
+
return resp.data.teams
|
|
84
|
+
} catch (e) {
|
|
85
|
+
return []
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
},
|
|
26
89
|
getUpcomingScheduleByTeams: async(team_ids:string, offset:number):Promise<EventProps[]> => {
|
|
27
90
|
try {
|
|
28
91
|
const resp = await axios.get(`${EVENT_SVC_API}/v1/teams/schedule/upcoming/${team_ids}?offset=${offset}`)
|
|
@@ -14,6 +14,7 @@ type FlashHolderProps = {
|
|
|
14
14
|
player_id?:string,
|
|
15
15
|
float?:boolean,
|
|
16
16
|
distinct_id?:string,
|
|
17
|
+
restricted_flash_ids?:string[],
|
|
17
18
|
compact?:boolean,
|
|
18
19
|
player?:MyPlayerProps,
|
|
19
20
|
company_id?:string,
|
|
@@ -39,7 +40,7 @@ type FlashHolderProps = {
|
|
|
39
40
|
onRequestAuthenticate: () => void
|
|
40
41
|
}
|
|
41
42
|
const sections = [ 'selector','explainer','flash_market','options','footer' ]
|
|
42
|
-
const FlashHolder = ({ float, poll_campaign_id, company_id, compact, style, default_poll_id, hide_timer, distinct_id, hide_footer, no_highlight, hide_tabs, parent_style, league_id, init_expanded, player_id, player, location, contest_type, contest_id, side_type, side_id, poll_id, onSelectCompactPoll, onRequestAuthenticate, onFocusPosition, onRequestLocation, onManageFlash } : FlashHolderProps) => {
|
|
43
|
+
const FlashHolder = ({ float, poll_campaign_id, restricted_flash_ids, company_id, compact, style, default_poll_id, hide_timer, distinct_id, hide_footer, no_highlight, hide_tabs, parent_style, league_id, init_expanded, player_id, player, location, contest_type, contest_id, side_type, side_id, poll_id, onSelectCompactPoll, onRequestAuthenticate, onFocusPosition, onRequestLocation, onManageFlash } : FlashHolderProps) => {
|
|
43
44
|
const Colors = useColors();
|
|
44
45
|
const [ needs_reload, setNeedsReload ] = useState(false);
|
|
45
46
|
const [ socket_campaigns, setSocketCampaigns ] = useState<PollCampaignProps[]>([]);
|
|
@@ -78,8 +79,8 @@ const FlashHolder = ({ float, poll_campaign_id, company_id, compact, style, defa
|
|
|
78
79
|
const { holder_loading, flash_markets, loaded } = flash_data;
|
|
79
80
|
const [ active_flash_market, setActiveFlashMarket ] = useState<string | undefined>(undefined);
|
|
80
81
|
const flash_market = flash_markets.find(fm => fm.poll_id == active_flash_market);
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
let sorted_flashes = flash_markets.sort((a,b) => moment(a.end_datetime).unix() - moment(b.end_datetime).unix() || parseInt(a.poll_id) - parseInt(b.poll_id))
|
|
83
|
+
if(restricted_flash_ids && restricted_flash_ids.length > 0){ sorted_flashes = sorted_flashes.filter(f => restricted_flash_ids.includes(f.poll_id)) }
|
|
83
84
|
useEffect(() => {
|
|
84
85
|
loadData();
|
|
85
86
|
},[league_id, contest_type, contest_id, side_type, side_id, poll_id]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Button, Text, TextInput, View } from "../../Components/Themed"
|
|
3
3
|
import { FlatList, Image, type ViewStyle } from 'react-native';
|
|
4
|
-
import type { FocusPositionProps, MyPlayerProps, PollCampaignProps, PollOptionProps, PollProps, PollSummaryProps, PublicPlayerProps } from '../../types';
|
|
4
|
+
import type { EventProps, FocusPositionProps, LeagueProps, MatchProps, MyPlayerProps, PollCampaignProps, PollOptionProps, PollProps, PollSummaryProps, PublicPlayerProps, TournamentProps } from '../../types';
|
|
5
5
|
import { Icons, Switch, Toggle } from '../../Components';
|
|
6
6
|
import { PollApi, PollCampaignApi, PollOptionApi } from '../../Poll/api';
|
|
7
7
|
import ImageUploader from '../../Components/ImageUploader';
|
|
@@ -11,6 +11,9 @@ import moment from 'moment-mini';
|
|
|
11
11
|
import BETimePicker from '../../Components/BETimePicker';
|
|
12
12
|
import { FlashMarketHelpers } from '../api';
|
|
13
13
|
import { showConfirmAlert } from '../../Components/ConfirmAlert';
|
|
14
|
+
import { MarketComponentApi, MarketComponentHelpers } from '../../MarketComponents/api';
|
|
15
|
+
import ContestSelector from '../../CompetitionManager/components/ContestSelector';
|
|
16
|
+
import { ManageCompetitionApi } from '../../CompetitionManager/api';
|
|
14
17
|
|
|
15
18
|
type ManageFlashMarketProps = {
|
|
16
19
|
poll_id:string,
|
|
@@ -22,7 +25,7 @@ type ManageFlashMarketProps = {
|
|
|
22
25
|
onFocusPosition?:(pos:FocusPositionProps) => void
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
const sections = ['header','activate','pause_resume','closed','resolve','toggle', 'image','question','options','settings','results', 'danger']
|
|
28
|
+
const sections = ['header','activate','pause_resume','closed','resolve','toggle', 'image','question','options','settings', 'contest_selector','results', 'danger']
|
|
26
29
|
const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFocusPosition }:ManageFlashMarketProps) => {
|
|
27
30
|
const Colors = useColors();
|
|
28
31
|
const [ labels, setLabels ] = useState({
|
|
@@ -31,6 +34,17 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
31
34
|
max_stake: '0'
|
|
32
35
|
});
|
|
33
36
|
const { min_stake, max_stake, base_stake } = labels;
|
|
37
|
+
const [ contest_state, setContestState ] = useState<{
|
|
38
|
+
contest_selector:boolean,
|
|
39
|
+
leagues:LeagueProps[],
|
|
40
|
+
event?:EventProps,
|
|
41
|
+
tournament?:TournamentProps,
|
|
42
|
+
match?:MatchProps,
|
|
43
|
+
}>({
|
|
44
|
+
contest_selector: false,
|
|
45
|
+
leagues:[]
|
|
46
|
+
});
|
|
47
|
+
const { event, tournament, match, leagues } = contest_state;
|
|
34
48
|
const [ expand_participants, setExpandParticipants ] = useState(false);
|
|
35
49
|
const [ flash_state, setFlashState ] = useState<{
|
|
36
50
|
loading:boolean,
|
|
@@ -59,8 +73,11 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
59
73
|
const prob_locked = unlocked_options.length <= 1 ? true : false
|
|
60
74
|
const errors = FlashMarketHelpers.isNewValid(real_options, poll_summaries, poll);
|
|
61
75
|
const winning_option = real_options.find(o => o.poll_option_id == poll?.winning_option_id);
|
|
76
|
+
|
|
62
77
|
useEffect(() => {
|
|
63
78
|
PollCampaignApi.setEnvironment();
|
|
79
|
+
ManageCompetitionApi.setEnvironment();
|
|
80
|
+
MarketComponentApi.setEnvironment();
|
|
64
81
|
if(!poll_id){ return }
|
|
65
82
|
getData(poll_id);
|
|
66
83
|
},[poll_id]);
|
|
@@ -74,6 +91,35 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
74
91
|
s.player_ids.map(id => id != '4985' ? player_ids.push(id) : console.log(''))
|
|
75
92
|
})
|
|
76
93
|
const server_players = await PollCampaignApi.getPlayersByPlayerIds([ ...new Set(player_ids.map(id => id))]);
|
|
94
|
+
const s_leagues = await MarketComponentApi.getLeagues();
|
|
95
|
+
let ev:EventProps|undefined = undefined
|
|
96
|
+
let tn:TournamentProps|undefined = undefined
|
|
97
|
+
let mt:MatchProps|undefined = undefined
|
|
98
|
+
switch(server_response.poll.contest_type){
|
|
99
|
+
case 'team':
|
|
100
|
+
if(!server_response.poll.contest_id){ break }
|
|
101
|
+
let evs = await MarketComponentApi.getEventsByEventIds([server_response.poll.contest_id]);
|
|
102
|
+
ev = evs[0]
|
|
103
|
+
break
|
|
104
|
+
case 'tournament':
|
|
105
|
+
if(!server_response.poll.contest_id){ break }
|
|
106
|
+
let tns = await MarketComponentApi.getTournamentsByTournamentIds([server_response.poll.contest_id]);
|
|
107
|
+
tn = tns[0]
|
|
108
|
+
break
|
|
109
|
+
case 'match':
|
|
110
|
+
if(!server_response.poll.contest_id){ break }
|
|
111
|
+
let mtchs = await MarketComponentApi.getMatchesByMatchIds([server_response.poll.contest_id]);
|
|
112
|
+
mt = mtchs[0]
|
|
113
|
+
break
|
|
114
|
+
default: break
|
|
115
|
+
}
|
|
116
|
+
setContestState({
|
|
117
|
+
...contest_state,
|
|
118
|
+
event: ev,
|
|
119
|
+
tournament: tn,
|
|
120
|
+
leagues: s_leagues.filter(l => l.status == 'active').sort((a,b) => a.priority - b.priority),
|
|
121
|
+
match: mt
|
|
122
|
+
})
|
|
77
123
|
setFlashState({
|
|
78
124
|
...flash_state,
|
|
79
125
|
poll: server_response.poll,
|
|
@@ -608,6 +654,40 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
608
654
|
:<></>}
|
|
609
655
|
</View>
|
|
610
656
|
)
|
|
657
|
+
case 'contest_selector':
|
|
658
|
+
if(!poll){ return <></> }
|
|
659
|
+
if(active_step != 'settings'){ return <></> }
|
|
660
|
+
const { contest_title, scheduled_datetime } = MarketComponentHelpers.getContestDetails(poll.contest_type ?? 'tean', event, tournament, match);
|
|
661
|
+
return (
|
|
662
|
+
<View transparent style={{ padding:20, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
663
|
+
<Text theme='h1'>Select Contest</Text>
|
|
664
|
+
<Text theme='description' style={{ marginTop:3 }}>Is this market associated with an existing contest?</Text>
|
|
665
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center' }}>
|
|
666
|
+
<Button float style={{ flex:1, marginTop:10, padding:10 }} onPress={() => setContestState({ ...contest_state, contest_selector:!contest_state.contest_selector })}>
|
|
667
|
+
{contest_title ?
|
|
668
|
+
<View transparent>
|
|
669
|
+
<Text theme='h1'>{contest_title}</Text>
|
|
670
|
+
<Text theme='description' style={{ marginTop:3 }}>{scheduled_datetime.format('MMM DD hh:mm a')}</Text>
|
|
671
|
+
</View>
|
|
672
|
+
:
|
|
673
|
+
<Text theme='h1'>{'Select Contest'}</Text>
|
|
674
|
+
}
|
|
675
|
+
</Button>
|
|
676
|
+
{poll.contest_id ?
|
|
677
|
+
<Button
|
|
678
|
+
title='X'
|
|
679
|
+
transparent
|
|
680
|
+
style={{ padding:10 }}
|
|
681
|
+
title_color={Colors.text.error}
|
|
682
|
+
onPress={() => {
|
|
683
|
+
setContestState({ ...contest_state, event: undefined })
|
|
684
|
+
updatePoll({ ...poll, contest_type: undefined, contest_id: undefined });
|
|
685
|
+
}}
|
|
686
|
+
/>
|
|
687
|
+
:<></>}
|
|
688
|
+
</View>
|
|
689
|
+
</View>
|
|
690
|
+
)
|
|
611
691
|
case 'options':
|
|
612
692
|
if(!poll){ return <></> }
|
|
613
693
|
if(active_step != 'options'){ return <></> }
|
|
@@ -801,6 +881,43 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
801
881
|
renderItem={renderSections}
|
|
802
882
|
/>
|
|
803
883
|
</View>
|
|
884
|
+
{contest_state.contest_selector ?
|
|
885
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, padding:10 }}>
|
|
886
|
+
<ContestSelector
|
|
887
|
+
leagues={leagues}
|
|
888
|
+
action_loading={action_loading}
|
|
889
|
+
onClose={() => setContestState({ ...contest_state, contest_selector: false })}
|
|
890
|
+
onSelectTeamEvent={(event) => {
|
|
891
|
+
if(!poll){ return }
|
|
892
|
+
let new_end_time = moment(event.scheduled_datetime)
|
|
893
|
+
let new_poll:PollProps = { ...poll, contest_type: 'team', contest_id: event.event_id }
|
|
894
|
+
if(moment().isBefore(new_end_time)){ new_poll.end_datetime = new_end_time }
|
|
895
|
+
updatePoll(new_poll)
|
|
896
|
+
setContestState({ ...contest_state, event: event })
|
|
897
|
+
}}
|
|
898
|
+
onDeSelectTournament={(_) => {
|
|
899
|
+
if(!poll){ return }
|
|
900
|
+
setContestState({ ...contest_state, event: undefined, tournament: undefined })
|
|
901
|
+
updatePoll({ ...poll, contest_type: undefined, contest_id: undefined });
|
|
902
|
+
}}
|
|
903
|
+
onSelectTournament={(t) => {
|
|
904
|
+
if(!poll){ return }
|
|
905
|
+
let new_end_time = moment(t.scheduled_datetime)
|
|
906
|
+
let new_poll:PollProps = { ...poll, contest_type: 'tournament', contest_id: t.tournament_id }
|
|
907
|
+
if(moment().isBefore(new_end_time)){ new_poll.end_datetime = new_end_time }
|
|
908
|
+
updatePoll(new_poll)
|
|
909
|
+
setContestState({ ...contest_state, tournament: t, event:undefined })
|
|
910
|
+
}}
|
|
911
|
+
onDeselectTeamEvent={(_) => {
|
|
912
|
+
if(!poll){ return }
|
|
913
|
+
setContestState({ ...contest_state, event: undefined })
|
|
914
|
+
updatePoll({ ...poll, contest_type: undefined, contest_id: undefined });
|
|
915
|
+
}}
|
|
916
|
+
selected_tournaments={tournament ? [tournament] : []}
|
|
917
|
+
selected_team_events={event ? [event] : []}
|
|
918
|
+
/>
|
|
919
|
+
</View>
|
|
920
|
+
:<></>}
|
|
804
921
|
{poll && poll.status == 'inactive' ?
|
|
805
922
|
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
806
923
|
<View float style={{ width: '70%' }}>
|
package/src/Group/index.tsx
CHANGED
|
@@ -262,7 +262,7 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
|
|
|
262
262
|
let my_gp = g_data.my_group_player && g_data.my_group_player.status == 'inactive' ? undefined : g_data.my_group_player
|
|
263
263
|
|
|
264
264
|
let server_flash = await GroupApi.getActivePolls(group_id);
|
|
265
|
-
setFlashData({ flash_campaigns: server_flash.poll_campaigns, flash_markets: server_flash.polls.filter(p => p.status
|
|
265
|
+
setFlashData({ flash_campaigns: server_flash.poll_campaigns, flash_markets: server_flash.polls.filter(p => !['pending','closed'].includes(p.status)) });
|
|
266
266
|
|
|
267
267
|
setGroupData({
|
|
268
268
|
...group_data,
|
|
@@ -546,6 +546,7 @@ const GroupComponent = ({ refresh_key, group_id, player, mode, init_invite_code,
|
|
|
546
546
|
)
|
|
547
547
|
case 'flash':
|
|
548
548
|
if(flash_campaigns.length == 0){ return <></> }
|
|
549
|
+
if(flash_markets.length == 0){ return <></> }
|
|
549
550
|
return (
|
|
550
551
|
<View float style={{ margin:10 }}>
|
|
551
552
|
<Button style={{ backgroundColor:Colors.views.header, flexDirection:'row', alignItems:'center', padding:10, borderBottomLeftRadius:expanded?0:8, borderBottomRightRadius:expanded?0:8 }} onPress={() => setFlashData({ ...flash_data, expanded: !expanded })}>
|
|
@@ -266,7 +266,6 @@ const MarketComponentApi = {
|
|
|
266
266
|
},
|
|
267
267
|
getTeamById: async(team_id:string):Promise<undefined | { team:TeamProps, team_rankings:TeamRankingProps[], team_records:TeamRecordProps[], league:LeagueProps }> => {
|
|
268
268
|
try {
|
|
269
|
-
console.log('getting data')
|
|
270
269
|
const resp = await axios.get(`${EVENT_SVC_API}/v1/teams/team/${team_id}`);
|
|
271
270
|
return resp.data
|
|
272
271
|
} catch (e) {
|
|
@@ -486,18 +485,18 @@ const MarketComponentHelpers = {
|
|
|
486
485
|
});
|
|
487
486
|
return order_ids
|
|
488
487
|
},
|
|
489
|
-
getContestDetails: (contest_type:string, event?:EventProps, tournament?:TournamentProps, match?:MatchProps):{ contest_title:string } => {
|
|
488
|
+
getContestDetails: (contest_type:string, event?:EventProps, tournament?:TournamentProps, match?:MatchProps):{ contest_title:string, scheduled_datetime:Moment } => {
|
|
490
489
|
switch(contest_type){
|
|
491
490
|
case 'team':
|
|
492
|
-
if(!event){ return { contest_title: '' } }
|
|
493
|
-
return { contest_title: event.event_title }
|
|
491
|
+
if(!event){ return { contest_title: '', scheduled_datetime: moment() } }
|
|
492
|
+
return { contest_title: event.event_title, scheduled_datetime: moment(event.scheduled_datetime) }
|
|
494
493
|
case 'tournament':
|
|
495
|
-
if(!tournament){ return { contest_title: '' } }
|
|
496
|
-
return { contest_title: tournament.tournament_name }
|
|
494
|
+
if(!tournament){ return { contest_title: '', scheduled_datetime: moment() } }
|
|
495
|
+
return { contest_title: tournament.tournament_name, scheduled_datetime: moment(tournament.scheduled_datetime) }
|
|
497
496
|
case 'match':
|
|
498
|
-
if(!match){ return { contest_title: '' } }
|
|
499
|
-
return { contest_title: match.match_title }
|
|
500
|
-
default: return { contest_title: '' }
|
|
497
|
+
if(!match){ return { contest_title: '', scheduled_datetime: moment() } }
|
|
498
|
+
return { contest_title: match.match_title, scheduled_datetime: moment(match.scheduled_datetime) }
|
|
499
|
+
default: return { contest_title: '', scheduled_datetime: moment() }
|
|
501
500
|
}
|
|
502
501
|
},
|
|
503
502
|
getReconFromMarketStats: (ms:MarketStatsProps[]) => {
|