be-components 5.8.1 → 5.8.3
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/Campaign/api/index.js +124 -0
- package/lib/commonjs/Campaign/api/index.js.map +1 -1
- package/lib/commonjs/Campaign/components/ActionList.js +46 -9
- package/lib/commonjs/Campaign/components/ActionList.js.map +1 -1
- package/lib/commonjs/Campaign/components/BetAlert.js +22 -10
- package/lib/commonjs/Campaign/components/BetAlert.js.map +1 -1
- package/lib/commonjs/Campaign/components/CampaignAnalytics.js +142 -11
- package/lib/commonjs/Campaign/components/CampaignAnalytics.js.map +1 -1
- package/lib/commonjs/Campaign/components/NewPlayerAlert.js +139 -0
- package/lib/commonjs/Campaign/components/NewPlayerAlert.js.map +1 -0
- package/lib/commonjs/Campaign/components/ParticipantCard.js +5 -0
- package/lib/commonjs/Campaign/components/ParticipantCard.js.map +1 -1
- package/lib/commonjs/Campaign/components/ParticipantsList.js +0 -1
- package/lib/commonjs/Campaign/components/ParticipantsList.js.map +1 -1
- package/lib/commonjs/Campaign/index.js +564 -222
- package/lib/commonjs/Campaign/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/api/index.js +21 -0
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/commonjs/Ticker/index.js +175 -31
- package/lib/commonjs/Ticker/index.js.map +1 -1
- package/lib/module/Campaign/api/index.js +124 -0
- package/lib/module/Campaign/api/index.js.map +1 -1
- package/lib/module/Campaign/components/ActionList.js +46 -9
- package/lib/module/Campaign/components/ActionList.js.map +1 -1
- package/lib/module/Campaign/components/BetAlert.js +22 -10
- package/lib/module/Campaign/components/BetAlert.js.map +1 -1
- package/lib/module/Campaign/components/CampaignAnalytics.js +144 -13
- package/lib/module/Campaign/components/CampaignAnalytics.js.map +1 -1
- package/lib/module/Campaign/components/NewPlayerAlert.js +132 -0
- package/lib/module/Campaign/components/NewPlayerAlert.js.map +1 -0
- package/lib/module/Campaign/components/ParticipantCard.js +5 -0
- package/lib/module/Campaign/components/ParticipantCard.js.map +1 -1
- package/lib/module/Campaign/components/ParticipantsList.js +0 -1
- package/lib/module/Campaign/components/ParticipantsList.js.map +1 -1
- package/lib/module/Campaign/index.js +564 -222
- package/lib/module/Campaign/index.js.map +1 -1
- package/lib/module/MarketComponents/api/index.js +21 -0
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/module/Ticker/index.js +178 -34
- package/lib/module/Ticker/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/api/index.d.ts +11 -0
- package/lib/typescript/lib/commonjs/Campaign/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/ActionList.d.ts +4 -1
- package/lib/typescript/lib/commonjs/Campaign/components/ActionList.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/BetAlert.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Campaign/components/BetAlert.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/CampaignAnalytics.d.ts +4 -2
- package/lib/typescript/lib/commonjs/Campaign/components/CampaignAnalytics.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/NewPlayerAlert.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Campaign/components/NewPlayerAlert.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantCard.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantCard.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantsList.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/index.d.ts +8 -5
- package/lib/typescript/lib/commonjs/Campaign/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/commonjs/Ticker/index.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Ticker/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/api/index.d.ts +11 -0
- package/lib/typescript/lib/module/Campaign/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/ActionList.d.ts +4 -1
- package/lib/typescript/lib/module/Campaign/components/ActionList.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/BetAlert.d.ts +3 -1
- package/lib/typescript/lib/module/Campaign/components/BetAlert.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/CampaignAnalytics.d.ts +4 -2
- package/lib/typescript/lib/module/Campaign/components/CampaignAnalytics.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/NewPlayerAlert.d.ts +10 -0
- package/lib/typescript/lib/module/Campaign/components/NewPlayerAlert.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantCard.d.ts +3 -1
- package/lib/typescript/lib/module/Campaign/components/ParticipantCard.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/components/ParticipantsList.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/index.d.ts +8 -5
- package/lib/typescript/lib/module/Campaign/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +1 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Ticker/index.d.ts +2 -1
- package/lib/typescript/lib/module/Ticker/index.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/api/index.d.ts +21 -6
- package/lib/typescript/src/Campaign/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/components/ActionList.d.ts +5 -2
- package/lib/typescript/src/Campaign/components/ActionList.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/components/BetAlert.d.ts +4 -2
- package/lib/typescript/src/Campaign/components/BetAlert.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/components/CampaignAnalytics.d.ts +6 -3
- package/lib/typescript/src/Campaign/components/CampaignAnalytics.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/components/NewPlayerAlert.d.ts +12 -0
- package/lib/typescript/src/Campaign/components/NewPlayerAlert.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ParticipantCard.d.ts +4 -2
- package/lib/typescript/src/Campaign/components/ParticipantCard.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/index.d.ts +7 -4
- package/lib/typescript/src/Campaign/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts +3 -2
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Ticker/index.d.ts +2 -1
- package/lib/typescript/src/Ticker/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Campaign/api/index.ts +86 -4
- package/src/Campaign/components/ActionList.tsx +38 -13
- package/src/Campaign/components/BetAlert.tsx +15 -6
- package/src/Campaign/components/CampaignAnalytics.tsx +76 -13
- package/src/Campaign/components/NewPlayerAlert.tsx +81 -0
- package/src/Campaign/components/ParticipantCard.tsx +7 -2
- package/src/Campaign/components/ParticipantsList.tsx +1 -1
- package/src/Campaign/index.tsx +421 -188
- package/src/MarketComponents/api/index.ts +16 -2
- package/src/Ticker/index.tsx +94 -35
- package/src/types.d.ts +3 -0
package/src/Campaign/index.tsx
CHANGED
|
@@ -1,52 +1,66 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { FlatList, Image, useWindowDimensions } from "react-native"
|
|
3
3
|
import { Button, Text, View } from '../Components/Themed';
|
|
4
|
-
import type { AthleteProps, CampaignParticipantProps, CampaignProps, EventProps, MarketProps, OrderAnalyticsProps, OrderProps, PublicPlayerProps, TeamProps } from '../types';
|
|
4
|
+
import type { AthleteProps, CampaignParticipantProps, CampaignProps, CompetitionProps, EventProps, LeagueProps, MarketProps, MatchProps, OrderAnalyticsProps, OrderProps, PollCampaignProps, PublicPlayerProps, TeamProps, TournamentProps } from '../types';
|
|
5
5
|
import { CampaignApi, CampaignHelpers } from '../Campaign/api';
|
|
6
|
-
|
|
7
6
|
import { MarketComponentApi } from '../MarketComponents/api';
|
|
8
7
|
import { useColors } from '../constants/useColors';
|
|
9
|
-
import
|
|
8
|
+
import { type Moment } from 'moment-mini';
|
|
10
9
|
import QRCode from 'react-qr-code';
|
|
11
10
|
import TickerApp from '../Ticker';
|
|
12
11
|
import BetAlert from './components/BetAlert';
|
|
13
12
|
import ParticipantsList from './components/ParticipantsList';
|
|
14
13
|
import ParticipantCard from './components/ParticipantCard';
|
|
15
14
|
import CampaignAnalytics from './components/CampaignAnalytics';
|
|
16
|
-
import
|
|
15
|
+
import SocketManager from '../Socket';
|
|
16
|
+
import NewPlayerAlert from './components/NewPlayerAlert';
|
|
17
|
+
import ActionList from './components/ActionList';
|
|
18
|
+
import { Icons, Toggle } from '../Components';
|
|
17
19
|
|
|
18
20
|
type CampaignAppProps = {
|
|
19
21
|
player_id?:string,
|
|
20
22
|
campaign_id:string,
|
|
21
23
|
distinct_id:string,
|
|
22
24
|
color_mode?:'light'|'dark',
|
|
25
|
+
onCreateOrder?:(order:OrderProps) => void,
|
|
23
26
|
action_loading?:boolean,
|
|
27
|
+
onSelectPollCampaign:(pc:PollCampaignProps) => void,
|
|
28
|
+
onSelectCompetition:(comp:CompetitionProps) => void,
|
|
24
29
|
insets?:{ bottom:number, top:number, left:number, right:number },
|
|
25
30
|
onBetNow?:() => void,
|
|
26
31
|
onViewProfile?:(player:PublicPlayerProps) => void,
|
|
27
32
|
onH2HChallenge?:(player:PublicPlayerProps) => void,
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
onCheckedIn?:(campaign_participant:CampaignParticipantProps) => void,
|
|
34
|
+
onCheckedOut?:(campaign_participant:CampaignParticipantProps) => void,
|
|
30
35
|
auto?:boolean
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
const HEADER_HEIGHT = 75
|
|
34
|
-
|
|
35
|
-
const Campaign = ({ campaign_id, insets, color_mode,
|
|
39
|
+
const sections = ['header', 'participants', 'toggle', 'desktop_data', 'mobile_ticker', 'mobile_player', 'mobile_leaderboard', 'engagements']
|
|
40
|
+
const Campaign = ({ player_id, campaign_id, insets, color_mode, distinct_id, onSelectCompetition, onSelectPollCampaign, onCreateOrder, onViewProfile, onCheckedIn, onCheckedOut, onBetNow }:CampaignAppProps) => {
|
|
36
41
|
const Colors = useColors();
|
|
42
|
+
const [ needs_reload, setNeedsReload ] = useState(false);
|
|
43
|
+
const [ new_player_alert, setNewPlayerAlert ] = useState<CampaignParticipantProps|undefined>(undefined);
|
|
37
44
|
const [ new_bet_alert, setNewBetAlert ] = useState<OrderProps | undefined>(undefined);
|
|
38
45
|
//const [ refresh, setRefresh ] = useState(0);
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
46
|
+
const { width } = useWindowDimensions();
|
|
47
|
+
const view_mode = width > 710 ? 'desktop' : 'mobile';
|
|
48
|
+
const [ active_toggle, setActiveToggle ] = useState('odds');
|
|
42
49
|
const time_options = CampaignHelpers.getTimeOptions();
|
|
43
|
-
const participants_location = width > 1200 ? 'left' : 'top';
|
|
44
50
|
//const ad_location = width > 1200 ? 'right': 'bottom';
|
|
45
|
-
const
|
|
46
|
-
|
|
51
|
+
const [ socket_participants, setSocketParticipants ] = useState<CampaignParticipantProps[]>([]);
|
|
47
52
|
const [ selected_participant, setSelectedParticipant ] = useState<CampaignParticipantProps|undefined>(undefined);
|
|
48
53
|
const [ new_event, setNewEvent ] = useState<EventProps|undefined>(undefined);
|
|
54
|
+
const [ new_tournaments, setNewTournaments ] = useState<TournamentProps|undefined>(undefined);
|
|
49
55
|
const [ analytics, setAnalytics ] = useState<OrderAnalyticsProps[]>([]);
|
|
56
|
+
const [ my_details, setMyDetails ] = useState<{
|
|
57
|
+
my_loading:boolean,
|
|
58
|
+
my_participant?:CampaignParticipantProps,
|
|
59
|
+
|
|
60
|
+
}>({
|
|
61
|
+
my_loading: false
|
|
62
|
+
});
|
|
63
|
+
const { my_loading, my_participant } = my_details;
|
|
50
64
|
const [ embed_state, setEmbedState ] = useState<{
|
|
51
65
|
loading:boolean,
|
|
52
66
|
campaign?:CampaignProps,
|
|
@@ -55,7 +69,12 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
55
69
|
campaign_participants:CampaignParticipantProps[],
|
|
56
70
|
teams:TeamProps[],
|
|
57
71
|
athletes:AthleteProps[],
|
|
72
|
+
leagues:LeagueProps[],
|
|
73
|
+
tournaments:TournamentProps[],
|
|
74
|
+
matches:MatchProps[],
|
|
58
75
|
markets:MarketProps[],
|
|
76
|
+
poll_campaigns:PollCampaignProps[],
|
|
77
|
+
competitions:CompetitionProps[],
|
|
59
78
|
orders:OrderProps[],
|
|
60
79
|
events:EventProps[],
|
|
61
80
|
players:PublicPlayerProps[]
|
|
@@ -63,6 +82,11 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
63
82
|
loading:false,
|
|
64
83
|
campaign_participants:[],
|
|
65
84
|
events:[],
|
|
85
|
+
leagues:[],
|
|
86
|
+
tournaments:[],
|
|
87
|
+
poll_campaigns: [],
|
|
88
|
+
competitions: [],
|
|
89
|
+
matches:[],
|
|
66
90
|
athletes:[],
|
|
67
91
|
participant_page: 0,
|
|
68
92
|
markets:[],
|
|
@@ -71,14 +95,61 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
71
95
|
players:[],
|
|
72
96
|
teams:[]
|
|
73
97
|
});
|
|
74
|
-
const { orders, events, athletes, campaign, participant_page, action_page, campaign_participants, players, teams, } = embed_state;
|
|
98
|
+
const { orders, events, tournaments, athletes, competitions, poll_campaigns, campaign, participant_page, action_page, leagues, campaign_participants, players, teams, } = embed_state;
|
|
75
99
|
//const visible_orders = orders.sort((a,b) => moment(b.create_datetime).unix() - moment(a.create_datetime).unix()).slice((action_page-1) * 5, ((action_page-1) * 5) + 5)
|
|
76
|
-
|
|
77
100
|
useEffect(() => {
|
|
78
101
|
if(!campaign_id){ return }
|
|
79
102
|
startUp(campaign_id);
|
|
80
103
|
},[campaign_id]);
|
|
81
104
|
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
if(!player_id || !campaign_id){ return }
|
|
107
|
+
getMyData(campaign_id);
|
|
108
|
+
},[campaign_id, player_id])
|
|
109
|
+
|
|
110
|
+
const getMyData = async(id:string) => {
|
|
111
|
+
const resp = await CampaignApi.getMyCampaignParticipants();
|
|
112
|
+
//find this campaign
|
|
113
|
+
const this_cp = resp.campaign_participants.find(cp => cp.campaign_id == id);
|
|
114
|
+
setMyDetails({
|
|
115
|
+
...my_details,
|
|
116
|
+
my_loading:false,
|
|
117
|
+
my_participant: this_cp
|
|
118
|
+
});
|
|
119
|
+
if(this_cp?.status == 'active' && onCheckedIn){ onCheckedIn(this_cp) }
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
if(socket_participants.length == 0){ return }
|
|
125
|
+
handleNewParticipants(socket_participants);
|
|
126
|
+
}, [JSON.stringify(socket_participants)]);
|
|
127
|
+
|
|
128
|
+
const handleNewParticipants = async(cps:CampaignParticipantProps[]) => {
|
|
129
|
+
if(cps.length == 0){ return }
|
|
130
|
+
let mine = cps.find(cp => cp.player_id == player_id);
|
|
131
|
+
if(mine){
|
|
132
|
+
setMyDetails({ ...my_details, my_participant:mine })
|
|
133
|
+
}
|
|
134
|
+
//Do we have this player
|
|
135
|
+
let needed_player_ids:string[] = []
|
|
136
|
+
let plsers:PublicPlayerProps[] = []
|
|
137
|
+
cps.map(cp => {
|
|
138
|
+
let found = players.find(p => p.player_id == cp.player_id);
|
|
139
|
+
if(!found){ needed_player_ids.push(cp.player_id) }
|
|
140
|
+
else { plsers.push(found) }
|
|
141
|
+
});
|
|
142
|
+
plsers = plsers.concat(await CampaignApi.getPlayersByPlayerIds(needed_player_ids));
|
|
143
|
+
//Set new bettor!!
|
|
144
|
+
let new_player = cps.filter(cp => cp.status == 'active')[0]
|
|
145
|
+
if(new_player && new_player.player_id != player_id){ setNewPlayerAlert(new_player) }
|
|
146
|
+
//Ok! Now lets update the participants
|
|
147
|
+
setEmbedState({
|
|
148
|
+
...embed_state,
|
|
149
|
+
players: players.filter(p => !plsers.find(np => np.player_id == p.player_id)).concat(plsers),
|
|
150
|
+
campaign_participants: campaign_participants.filter(cp => !cps.find(ncp => ncp.campaign_participant_id == cp.campaign_participant_id)).concat(cps)
|
|
151
|
+
})
|
|
152
|
+
}
|
|
82
153
|
|
|
83
154
|
useEffect(() => {
|
|
84
155
|
if(!new_event){ return }
|
|
@@ -87,7 +158,16 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
87
158
|
events: events.filter(e => e.event_id != new_event.event_id).concat(new_event)
|
|
88
159
|
})
|
|
89
160
|
setNewEvent(undefined);
|
|
90
|
-
},[new_event])
|
|
161
|
+
},[new_event]);
|
|
162
|
+
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if(!new_tournaments){ return }
|
|
165
|
+
setEmbedState({
|
|
166
|
+
...embed_state,
|
|
167
|
+
tournaments: tournaments.filter(e => e.tournament_id != new_tournaments.tournament_id).concat(new_tournaments)
|
|
168
|
+
})
|
|
169
|
+
setNewEvent(undefined);
|
|
170
|
+
},[new_tournaments]);
|
|
91
171
|
|
|
92
172
|
const startUp = async(campaign_id:string) => {
|
|
93
173
|
CampaignApi.setEnvironment();
|
|
@@ -110,10 +190,15 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
110
190
|
const ords = await CampaignApi.getCampaignAction(campaign_id);
|
|
111
191
|
let vis_ords = [ ...ords ]
|
|
112
192
|
let ev_ids = ords.filter(o => o.event_type == 'team').map(o => o.event_id);
|
|
193
|
+
let tn_ids = ords.filter(o => o.event_type == 'tournament').map(o => o.event_id);
|
|
113
194
|
const action_pages = Math.ceil(vis_ords.length / 5);
|
|
114
195
|
const participant_pages = Math.ceil(c_resp.campaign_participants.length / 5);
|
|
115
196
|
let next_participant_page = participant_page + 1
|
|
116
197
|
if(next_participant_page > participant_pages){ next_participant_page = 1 }
|
|
198
|
+
let comps:CompetitionProps[] = []
|
|
199
|
+
let pcs: PollCampaignProps[] = []
|
|
200
|
+
if(c_resp.campaign && c_resp.campaign.poll_campaign_ids){ pcs = await CampaignApi.getPollCampaignsByIds(c_resp.campaign.poll_campaign_ids) }
|
|
201
|
+
if(c_resp.campaign && c_resp.campaign.competition_ids){ comps = await CampaignApi.getCompetitionsByIds(c_resp.campaign.competition_ids) }
|
|
117
202
|
|
|
118
203
|
let next_action_page = action_page + 1
|
|
119
204
|
if(next_action_page > action_pages){ next_action_page = 1 }
|
|
@@ -123,14 +208,17 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
123
208
|
if(new_bet){
|
|
124
209
|
setNewBetAlert(new_bet);
|
|
125
210
|
if(new_bet.event_type == 'team'){ ev_ids.push(new_bet.event_id) }
|
|
211
|
+
if(new_bet.event_type == 'tournament'){ tn_ids.push(new_bet.event_id) }
|
|
126
212
|
if(new_bet.side_type == 'team'){ tm_ids.push(new_bet.side_id) }
|
|
127
213
|
if(new_bet.side_type == 'athlete'){ aths_ids.push(new_bet.side_id) }
|
|
128
214
|
}
|
|
129
215
|
}
|
|
130
216
|
|
|
131
217
|
const evs = await MarketComponentApi.getEventsByEventIds(ords.filter(o => o.event_type == 'team').map(o => o.event_id));
|
|
218
|
+
const tns = await MarketComponentApi.getTournamentsByTournamentIds(tn_ids);
|
|
132
219
|
const tms = await MarketComponentApi.getTeamsByIds(tm_ids);
|
|
133
220
|
const aths = await MarketComponentApi.getAthletesByIds(aths_ids);
|
|
221
|
+
const lgs = await MarketComponentApi.getLeagues();
|
|
134
222
|
|
|
135
223
|
setEmbedState({
|
|
136
224
|
...embed_state,
|
|
@@ -138,6 +226,10 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
138
226
|
campaign: c_resp.campaign,
|
|
139
227
|
campaign_participants: c_resp.campaign_participants,
|
|
140
228
|
teams: tms,
|
|
229
|
+
leagues: lgs,
|
|
230
|
+
competitions:comps,
|
|
231
|
+
poll_campaigns: pcs,
|
|
232
|
+
tournaments: tns,
|
|
141
233
|
athletes: aths,
|
|
142
234
|
participant_page: next_participant_page,
|
|
143
235
|
action_page: next_action_page,
|
|
@@ -145,193 +237,301 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
145
237
|
orders: vis_ords,
|
|
146
238
|
loading:false
|
|
147
239
|
})
|
|
148
|
-
|
|
149
240
|
}
|
|
150
241
|
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
242
|
+
const handleCheckIn = async() => {
|
|
243
|
+
setMyDetails({ ...my_details, my_loading: true })
|
|
244
|
+
const new_cp = await CampaignApi.joinCampaign(campaign_id);
|
|
245
|
+
setMyDetails({
|
|
246
|
+
...my_details,
|
|
247
|
+
my_participant: new_cp,
|
|
248
|
+
my_loading: false
|
|
249
|
+
});
|
|
250
|
+
if(new_cp && onCheckedIn){ onCheckedIn(new_cp) }
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const handleCheckOut = async() => {
|
|
254
|
+
if(!my_participant){ return }
|
|
255
|
+
setMyDetails({ ...my_details, my_loading: true })
|
|
256
|
+
const new_cp = await CampaignApi.leaveCampaign(my_participant.campaign_participant_id);
|
|
257
|
+
setMyDetails({
|
|
258
|
+
...my_details,
|
|
259
|
+
my_loading: false,
|
|
260
|
+
my_participant: new_cp
|
|
261
|
+
});
|
|
262
|
+
if(new_cp && onCheckedOut){ onCheckedOut(new_cp) }
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
const renderTicker = () => {
|
|
267
|
+
return (
|
|
268
|
+
<TickerApp
|
|
269
|
+
league_ids={campaign?.league_ids ?? []}
|
|
270
|
+
distinct_id={distinct_id}
|
|
271
|
+
onCreateOrder={onCreateOrder}
|
|
272
|
+
color_mode={color_mode}
|
|
273
|
+
onOrders={async(orders) => {
|
|
274
|
+
//find if the orders are new!
|
|
275
|
+
let new_bet = orders.find(o => o.campaign_id );
|
|
276
|
+
if(new_bet){
|
|
277
|
+
let og_bet = await MarketComponentApi.getOrderById(new_bet.order_id);
|
|
278
|
+
if(!og_bet){ return }
|
|
279
|
+
//Find the event
|
|
280
|
+
switch(og_bet.event_type){
|
|
281
|
+
case 'team':
|
|
167
282
|
let ev = events.find(e => e.event_id == og_bet.event_id);
|
|
168
283
|
if(!ev){
|
|
169
284
|
let evs = await MarketComponentApi.getEventsByEventIds([new_bet.event_id]);
|
|
170
285
|
setNewEvent(evs[0])
|
|
171
286
|
}
|
|
172
|
-
setNewBetAlert(og_bet)
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
287
|
+
return setNewBetAlert(og_bet)
|
|
288
|
+
case 'tournament':
|
|
289
|
+
let tn = tournaments.find(tn => tn.tournament_id == og_bet.event_id);
|
|
290
|
+
let ath = athletes.find(a => a.athlete_id == og_bet.side_id);
|
|
291
|
+
let tm = teams.find(t => t.team_id == og_bet.side_id);
|
|
292
|
+
if(!tn){
|
|
293
|
+
let evs = await MarketComponentApi.getTournamentsByTournamentIds([new_bet.event_id]);
|
|
294
|
+
setNewTournaments(evs[0])
|
|
295
|
+
}
|
|
296
|
+
if(og_bet.side_type == 'athlete' && !ath){
|
|
297
|
+
let athls = await MarketComponentApi.getAthletesByIds([new_bet.side_id]);
|
|
298
|
+
setEmbedState({ ...embed_state, athletes: athletes.concat(athls) })
|
|
299
|
+
}
|
|
300
|
+
if(og_bet.side_type == 'team' && !tm){
|
|
301
|
+
let tms = await MarketComponentApi.getTeamsByIds([new_bet.side_id]);
|
|
302
|
+
setEmbedState({ ...embed_state, teams: teams.concat(tms) })
|
|
303
|
+
}
|
|
304
|
+
return setNewBetAlert(og_bet);
|
|
305
|
+
default: return
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
}
|
|
309
|
+
}}
|
|
310
|
+
/>
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const renderEngagements = (data:{ item:{ id:string, type:string, scheduled_datetime:Moment }, index:number }) => {
|
|
315
|
+
|
|
316
|
+
switch(data.item.type){
|
|
317
|
+
case 'competition':
|
|
318
|
+
let comp = competitions.find(c => c.competition_id == data.item.id);
|
|
319
|
+
if(!comp){ return <></> }
|
|
320
|
+
return (
|
|
321
|
+
<Button
|
|
322
|
+
disabled={!onSelectCompetition}
|
|
323
|
+
style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}
|
|
324
|
+
onPress={() => onSelectCompetition ? onSelectCompetition(comp) : console.log('')}
|
|
325
|
+
>
|
|
326
|
+
<Image
|
|
327
|
+
source={{ uri:comp.image?.url }}
|
|
328
|
+
style={{ height:40, width:40, borderRadius:4 }}
|
|
329
|
+
resizeMode='cover'
|
|
330
|
+
/>
|
|
331
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
332
|
+
<Text theme='h1'>{comp.competition_name}</Text>
|
|
333
|
+
<Text theme='description' style={{ marginTop:3 }}>{comp.competition_description}</Text>
|
|
334
|
+
</View>
|
|
335
|
+
<Icons.ChevronIcon direction='right' size={12} color={Colors.text.action} />
|
|
336
|
+
</Button>
|
|
176
337
|
)
|
|
177
|
-
case '
|
|
178
|
-
|
|
179
|
-
if(!
|
|
180
|
-
const player = players.find(p => p.player_id == selected_participant.player_id)
|
|
181
|
-
if(!player){ return <></> }
|
|
338
|
+
case 'poll_campaign':
|
|
339
|
+
let pc = poll_campaigns.find(c => c.poll_campaign_id == data.item.id);
|
|
340
|
+
if(!pc){ return <></> }
|
|
182
341
|
return (
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
342
|
+
<Button
|
|
343
|
+
disabled={!onSelectPollCampaign}
|
|
344
|
+
style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomWidth:1, borderColor:Colors.borders.light }}
|
|
345
|
+
onPress={() => onSelectPollCampaign ? onSelectPollCampaign(pc) : console.log('')}
|
|
346
|
+
>
|
|
347
|
+
<Image
|
|
348
|
+
source={{ uri:pc.campaign_image?.url }}
|
|
349
|
+
style={{ height:40, width:40, borderRadius:4 }}
|
|
350
|
+
resizeMode='cover'
|
|
351
|
+
/>
|
|
352
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
353
|
+
<Text theme='h1'>{pc.name}</Text>
|
|
354
|
+
<Text theme='description' style={{ marginTop:3 }}>{pc.total_responders} Players</Text>
|
|
355
|
+
</View>
|
|
356
|
+
<Icons.ChevronIcon direction='right' size={12} color={Colors.text.action} />
|
|
357
|
+
</Button>
|
|
190
358
|
)
|
|
191
359
|
default: return <></>
|
|
192
360
|
}
|
|
193
361
|
}
|
|
194
362
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
363
|
+
const renderSections = (data:{ item:string, index:number }) => {
|
|
364
|
+
switch(data.item){
|
|
365
|
+
case 'header':
|
|
366
|
+
if(!campaign){ return <></> }
|
|
367
|
+
return (
|
|
368
|
+
<View type='header' style={{ height:HEADER_HEIGHT, padding:10, paddingLeft:20, paddingRight:20, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
369
|
+
<Image
|
|
370
|
+
source={{ uri: campaign.campaign_image?.url }}
|
|
371
|
+
style={{ height:55, width:55 }}
|
|
372
|
+
resizeMode='cover'
|
|
373
|
+
/>
|
|
374
|
+
<View transparent style={{ flex:1, marginLeft:20 }}>
|
|
375
|
+
<Text theme='h1' size={18}>{campaign.campaign_name}</Text>
|
|
376
|
+
<Text theme='description' style={{ marginTop:4 }}>{campaign.description}</Text>
|
|
377
|
+
</View>
|
|
378
|
+
{view_mode == 'desktop' ?
|
|
379
|
+
<View transparent style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
380
|
+
<View transparent style={{ marginRight:10 }}>
|
|
381
|
+
<Text theme='h1' textAlign='center'>CHECK IN</Text>
|
|
382
|
+
<Text theme='h1' textAlign='center'>HERE</Text>
|
|
383
|
+
</View>
|
|
384
|
+
<QRCode
|
|
385
|
+
value={`https://play.bettoredge.com/social/campaign/${campaign_id}`}
|
|
386
|
+
size={65}
|
|
387
|
+
/>
|
|
388
|
+
</View>
|
|
389
|
+
:<></>}
|
|
390
|
+
</View>
|
|
391
|
+
)
|
|
392
|
+
case 'participants':
|
|
393
|
+
return (
|
|
394
|
+
<View style={{ borderBottomWidth:3, borderColor:Colors.borders.light }}>
|
|
395
|
+
<ParticipantsList
|
|
396
|
+
campaign_participants={campaign_participants}
|
|
397
|
+
players={players}
|
|
398
|
+
horizontal
|
|
399
|
+
selected_participant={selected_participant?.campaign_participant_id}
|
|
400
|
+
onSelect={(cp) => setSelectedParticipant(cp)}
|
|
401
|
+
onDeselect={() => setSelectedParticipant(undefined)}
|
|
402
|
+
/>
|
|
211
403
|
</View>
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
404
|
+
)
|
|
405
|
+
case 'mobile_ticker':
|
|
406
|
+
if(view_mode != 'mobile'){ return <></> }
|
|
407
|
+
if(active_toggle != 'odds'){ return <></> }
|
|
408
|
+
if(selected_participant){ return <></> }
|
|
409
|
+
if(!campaign){ return <></> }
|
|
410
|
+
return (
|
|
411
|
+
<View>
|
|
412
|
+
{renderTicker()}
|
|
413
|
+
</View>
|
|
414
|
+
)
|
|
415
|
+
case 'toggle':
|
|
416
|
+
if(view_mode != 'mobile'){ return <></> }
|
|
417
|
+
if(selected_participant){ return <></> }
|
|
418
|
+
return (
|
|
419
|
+
<View style={{ padding:10 }}>
|
|
420
|
+
<Toggle
|
|
421
|
+
selected_option={active_toggle}
|
|
422
|
+
onSelectOption={(toggle) => setActiveToggle(toggle)}
|
|
423
|
+
options={[
|
|
424
|
+
{ key: 'odds', label: 'Live Odds' },
|
|
425
|
+
{ key: 'leaderboard', label: 'Leaderboard' },
|
|
426
|
+
{ key: 'engagements', label: 'Games' }
|
|
427
|
+
]}
|
|
428
|
+
/>
|
|
429
|
+
</View>
|
|
430
|
+
)
|
|
431
|
+
case 'mobile_leaderboard':
|
|
432
|
+
if(view_mode != 'mobile'){ return <></> }
|
|
433
|
+
if(active_toggle != 'leaderboard'){ return <></> }
|
|
434
|
+
return (
|
|
435
|
+
<CampaignAnalytics
|
|
436
|
+
campaign_id={campaign_id}
|
|
437
|
+
players={players}
|
|
438
|
+
campaign_participants={campaign_participants}
|
|
217
439
|
/>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
440
|
+
)
|
|
441
|
+
case 'engagements':
|
|
442
|
+
if(view_mode != 'mobile'){ return <></> }
|
|
443
|
+
if(active_toggle != 'engagements'){ return <></> }
|
|
444
|
+
const sorted_engagements = CampaignHelpers.sortEngagements(competitions, poll_campaigns);
|
|
445
|
+
return (
|
|
446
|
+
<FlatList
|
|
447
|
+
data={sorted_engagements}
|
|
448
|
+
renderItem={renderEngagements}
|
|
449
|
+
keyExtractor={(item) => item.id.toString()}
|
|
450
|
+
key={'engagement_list_campaign'}
|
|
451
|
+
/>
|
|
452
|
+
)
|
|
453
|
+
case 'mobile_player':
|
|
454
|
+
if(view_mode != 'mobile'){ return <></> }
|
|
455
|
+
let mobile_selected_player = players.find(p => p.player_id == selected_participant?.player_id);
|
|
456
|
+
if(!selected_participant || !mobile_selected_player){ return <></> }
|
|
457
|
+
return (
|
|
458
|
+
<View type='header'>
|
|
459
|
+
<ParticipantCard
|
|
460
|
+
campaign_participant={selected_participant}
|
|
461
|
+
player={mobile_selected_player}
|
|
462
|
+
analytics={analytics.filter(a => a.player_id == selected_participant.player_id)}
|
|
463
|
+
orders={orders.filter(o => o.player_id == selected_participant.player_id)}
|
|
464
|
+
events={events}
|
|
465
|
+
tournaments={tournaments}
|
|
466
|
+
matches={[]}
|
|
467
|
+
/>
|
|
468
|
+
</View>
|
|
469
|
+
)
|
|
470
|
+
case 'desktop_data':
|
|
471
|
+
if(view_mode != 'desktop'){ return <></> }
|
|
472
|
+
if(!campaign){ return <></> }
|
|
473
|
+
let selected_player = players.find(p => p.player_id == selected_participant?.player_id);
|
|
474
|
+
return (
|
|
475
|
+
<View style={{ flexDirection:'row' }}>
|
|
476
|
+
<View nativeID='recent_action' style={{ width:350, borderRightWidth:3, borderColor:Colors.borders.light }}>
|
|
477
|
+
{selected_participant && selected_player ?
|
|
478
|
+
<View type='header'>
|
|
479
|
+
<ParticipantCard
|
|
480
|
+
campaign_participant={selected_participant}
|
|
481
|
+
player={selected_player}
|
|
482
|
+
analytics={analytics.filter(a => a.player_id == selected_participant.player_id)}
|
|
483
|
+
orders={orders.filter(o => o.player_id == selected_participant.player_id)}
|
|
484
|
+
events={events}
|
|
485
|
+
tournaments={tournaments}
|
|
486
|
+
matches={[]}
|
|
487
|
+
/>
|
|
488
|
+
</View>
|
|
489
|
+
:
|
|
490
|
+
<ActionList
|
|
491
|
+
orders={orders}
|
|
492
|
+
events={events}
|
|
493
|
+
tournaments={tournaments}
|
|
494
|
+
matches={[]}
|
|
495
|
+
players={players}
|
|
496
|
+
/>
|
|
497
|
+
}
|
|
498
|
+
</View>
|
|
499
|
+
<View nativeID='ticker' style={{ flex:1, borderRightWidth:3, borderColor:Colors.borders.light }}>
|
|
500
|
+
{renderTicker()}
|
|
501
|
+
</View>
|
|
502
|
+
<View nativeID='leaderboard' style={{ width: 350, borderLeftWidth:1, borderColor:Colors.borders.light }}>
|
|
503
|
+
<CampaignAnalytics
|
|
504
|
+
campaign_id={campaign_id}
|
|
505
|
+
players={players}
|
|
506
|
+
campaign_participants={campaign_participants}
|
|
507
|
+
/>
|
|
508
|
+
</View>
|
|
509
|
+
</View>
|
|
510
|
+
)
|
|
511
|
+
|
|
224
512
|
|
|
513
|
+
default: return <></>
|
|
514
|
+
}
|
|
515
|
+
}
|
|
225
516
|
|
|
517
|
+
const new_player = players.find(p => p.player_id == new_player_alert?.player_id);
|
|
226
518
|
const new_bet_player = players.find(p => p.player_id == new_bet_alert?.player_id);
|
|
227
519
|
const new_bet_team = teams.find(t => t.team_id == new_bet_alert?.side_id);
|
|
228
520
|
const new_bet_athlete = athletes.find(a => a.athlete_id == new_bet_alert?.side_id);
|
|
229
521
|
const new_bet_event = events.find(e => e.event_id == new_bet_alert?.event_id);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const selected_player = players.find(p => p.player_id == selected_participant?.player_id);
|
|
233
|
-
|
|
522
|
+
const new_bet_tournament = tournaments.find(t => t.tournament_id == new_bet_alert?.event_id);
|
|
523
|
+
const new_bet_league = new_bet_event ? leagues.find(l => l.league_id == new_bet_event.league_id) : leagues.find(l => l.league_id == new_bet_tournament?.league_id);
|
|
234
524
|
return (
|
|
235
525
|
<View style={{ flex:1 }}>
|
|
236
|
-
{
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
/>
|
|
243
|
-
<View transparent style={{ flex:1, marginLeft:20 }}>
|
|
244
|
-
<Text theme='h1' size={18}>{campaign.campaign_name}</Text>
|
|
245
|
-
<Text theme='description' style={{ marginTop:4 }}>{campaign.description}</Text>
|
|
246
|
-
</View>
|
|
247
|
-
<View transparent style={{ width:250 }}>
|
|
248
|
-
<AutoManager
|
|
249
|
-
campaign_participants={campaign_participants}
|
|
250
|
-
orders={orders}
|
|
251
|
-
campaign={campaign}
|
|
252
|
-
active={auto ? true : false}
|
|
253
|
-
analytics={analytics}
|
|
254
|
-
onChangeAd={(ad) => {
|
|
255
|
-
setCTAType('ad');
|
|
256
|
-
setSelectedAd(ad);
|
|
257
|
-
}}
|
|
258
|
-
onChangeParticipant={(cp) => {
|
|
259
|
-
setCTAType('participant');
|
|
260
|
-
setSelectedParticipant(cp)
|
|
261
|
-
}}
|
|
262
|
-
/>
|
|
263
|
-
</View>
|
|
264
|
-
</View>
|
|
265
|
-
:<></>}
|
|
266
|
-
|
|
267
|
-
<CampaignAnalytics
|
|
268
|
-
campaign_id={campaign_id}
|
|
269
|
-
/>
|
|
270
|
-
{participants_location == 'top' ?
|
|
271
|
-
<View style={{ borderRightWidth:1, borderColor:Colors.borders.light }}>
|
|
272
|
-
<ParticipantsList
|
|
273
|
-
campaign_participants={campaign_participants}
|
|
274
|
-
players={players}
|
|
275
|
-
selected_participant={selected_participant?.campaign_participant_id}
|
|
276
|
-
horizontal
|
|
277
|
-
onDeselect={() => setSelectedParticipant(undefined)}
|
|
278
|
-
onSelect={(cp) => setSelectedParticipant(cp)}
|
|
526
|
+
<View style={{ flex:1 }}>
|
|
527
|
+
<FlatList
|
|
528
|
+
data={sections}
|
|
529
|
+
renderItem={renderSections}
|
|
530
|
+
key={'campaign_sections'}
|
|
531
|
+
keyExtractor={item => item}
|
|
279
532
|
/>
|
|
280
533
|
</View>
|
|
281
|
-
|
|
282
|
-
<View style={{ flex:1, flexDirection:'row' }}>
|
|
283
|
-
{participants_location == 'left' ?
|
|
284
|
-
<View transparent style={{ width:400 }}>
|
|
285
|
-
<ParticipantsList
|
|
286
|
-
campaign_participants={campaign_participants}
|
|
287
|
-
players={players}
|
|
288
|
-
selected_participant={selected_participant?.campaign_participant_id}
|
|
289
|
-
onSelect={(cp) => setSelectedParticipant(cp)}
|
|
290
|
-
onDeselect={() => setSelectedParticipant(undefined)}
|
|
291
|
-
/>
|
|
292
|
-
<View type='header' style={{ padding:20, justifyContent:'center', alignItems:'center' }}>
|
|
293
|
-
<Text theme='h1' style={{ marginBottom:20 }}>SCAN TO CHECK IN NOW</Text>
|
|
294
|
-
<QRCode
|
|
295
|
-
size={250}
|
|
296
|
-
value={`https://play.bettoredge.com/social/campaign/${campaign_id}`}
|
|
297
|
-
|
|
298
|
-
/>
|
|
299
|
-
</View>
|
|
300
|
-
</View>
|
|
301
|
-
:<></>}
|
|
302
|
-
<View style={{ flex:1, height:height - HEADER_HEIGHT }}>
|
|
303
|
-
<FlatList
|
|
304
|
-
data={['ticker','participant']}
|
|
305
|
-
key={'list_items'}
|
|
306
|
-
showsVerticalScrollIndicator={false}
|
|
307
|
-
keyExtractor={item => item}
|
|
308
|
-
renderItem={renderSections}
|
|
309
|
-
/>
|
|
310
|
-
</View>
|
|
311
|
-
|
|
312
|
-
{campaign && participants_location == 'left' ?
|
|
313
|
-
<View type='header' style={{ width:400, height:height - HEADER_HEIGHT }}>
|
|
314
|
-
{cta_type == 'participant' && selected_player && selected_participant ?
|
|
315
|
-
<ParticipantCard
|
|
316
|
-
campaign_participant={selected_participant}
|
|
317
|
-
player={selected_player}
|
|
318
|
-
events={events}
|
|
319
|
-
analytics={analytics.filter(a => a.player_id == selected_participant.player_id)}
|
|
320
|
-
orders={orders.filter(o => o.player_id == selected_participant.player_id)}
|
|
321
|
-
/>
|
|
322
|
-
:cta_type == 'ad' && selected_ad?.url ?
|
|
323
|
-
<View transparent>
|
|
324
|
-
<Image
|
|
325
|
-
source={{ uri: selected_ad.url }}
|
|
326
|
-
style={{ width: (height-HEADER_HEIGHT) * 0.2857, height:height - HEADER_HEIGHT, alignSelf:'center'}}
|
|
327
|
-
resizeMode='contain'
|
|
328
|
-
/>
|
|
329
|
-
</View>
|
|
330
|
-
:<></>}
|
|
331
|
-
</View>
|
|
332
|
-
:<></>}
|
|
333
|
-
</View>
|
|
334
|
-
|
|
534
|
+
{view_mode == 'mobile' ?
|
|
335
535
|
<View type='footer' style={{ flexDirection:'row', padding:10, paddingBottom:(insets?.bottom ?? 0) + 10}}>
|
|
336
536
|
{onBetNow ?
|
|
337
537
|
<Button
|
|
@@ -343,27 +543,32 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
343
543
|
:<></>}
|
|
344
544
|
{my_participant?.status == 'active' ?
|
|
345
545
|
<Button
|
|
346
|
-
type='
|
|
347
|
-
style={{ flex:2, opacity:0.5, alignItems:'center' }}
|
|
348
|
-
title={'
|
|
349
|
-
|
|
546
|
+
type='error'
|
|
547
|
+
style={{ flex:2, opacity:my_loading?0.5:1, alignItems:'center' }}
|
|
548
|
+
title={'Check Out'}
|
|
549
|
+
loading={my_loading}
|
|
550
|
+
disabled={my_loading}
|
|
551
|
+
onPress={() => handleCheckOut()}
|
|
350
552
|
/>
|
|
351
|
-
:
|
|
553
|
+
:
|
|
352
554
|
<Button
|
|
353
555
|
type='success'
|
|
354
|
-
style={{ flex:2 }}
|
|
355
|
-
loading={
|
|
356
|
-
disabled={
|
|
556
|
+
style={{ flex:2, opacity: my_loading?0.5:1 }}
|
|
557
|
+
loading={my_loading}
|
|
558
|
+
disabled={my_loading}
|
|
357
559
|
title="Check In Now"
|
|
358
|
-
onPress={() =>
|
|
560
|
+
onPress={() => handleCheckIn()}
|
|
359
561
|
/>
|
|
360
|
-
|
|
562
|
+
}
|
|
361
563
|
</View>
|
|
564
|
+
:<></>}
|
|
362
565
|
{new_bet_alert ?
|
|
363
566
|
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, alignItems:'center', paddingTop:100 }}>
|
|
364
567
|
<BetAlert
|
|
365
568
|
order={new_bet_alert}
|
|
366
569
|
event={new_bet_event}
|
|
570
|
+
league={new_bet_league}
|
|
571
|
+
tournament={new_bet_tournament}
|
|
367
572
|
player={new_bet_player}
|
|
368
573
|
team={new_bet_team}
|
|
369
574
|
athlete={new_bet_athlete}
|
|
@@ -371,6 +576,34 @@ const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_parti
|
|
|
371
576
|
/>
|
|
372
577
|
</View>
|
|
373
578
|
:<></>}
|
|
579
|
+
{new_player_alert && new_player ?
|
|
580
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, alignItems:'center', paddingTop:100 }}>
|
|
581
|
+
<NewPlayerAlert
|
|
582
|
+
campaign_participant={new_player_alert}
|
|
583
|
+
player={new_player}
|
|
584
|
+
view_mode={view_mode}
|
|
585
|
+
onViewProfile={onViewProfile}
|
|
586
|
+
onClose={() => setNewPlayerAlert(undefined)}
|
|
587
|
+
/>
|
|
588
|
+
</View>
|
|
589
|
+
:<></>}
|
|
590
|
+
<SocketManager
|
|
591
|
+
onConnect={() => {
|
|
592
|
+
if(!needs_reload){ return }
|
|
593
|
+
console.log('GET DATA!!!`')
|
|
594
|
+
}}
|
|
595
|
+
onDisconnect={() => setNeedsReload(true)}
|
|
596
|
+
subscribed_events={['UPDATE_CAMPAIGN_PARTICIPANTS']}
|
|
597
|
+
onSocketEvent={(event) => {
|
|
598
|
+
switch(event.type){
|
|
599
|
+
case 'UPDATE_CAMPAIGN_PARTICIPANTS':
|
|
600
|
+
let this_participants = event.campaign_participants.filter((cp:CampaignParticipantProps) => cp.campaign_id == campaign_id);
|
|
601
|
+
if(this_participants.length == 0){ return }
|
|
602
|
+
return setSocketParticipants(event.campaign_participants);
|
|
603
|
+
default: return
|
|
604
|
+
}
|
|
605
|
+
}}
|
|
606
|
+
/>
|
|
374
607
|
</View>
|
|
375
608
|
)
|
|
376
609
|
}
|