be-components 6.6.3 → 6.6.5
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/Components/ConfirmAlert.js +34 -0
- package/lib/commonjs/Components/ConfirmAlert.js.map +1 -0
- package/lib/commonjs/Group/api/index.js +108 -9
- package/lib/commonjs/Group/api/index.js.map +1 -1
- package/lib/commonjs/Group/components/GroupCTAButton.js +23 -21
- package/lib/commonjs/Group/components/GroupCTAButton.js.map +1 -1
- package/lib/commonjs/Group/index.js +372 -91
- package/lib/commonjs/Group/index.js.map +1 -1
- package/lib/module/Components/ConfirmAlert.js +29 -0
- package/lib/module/Components/ConfirmAlert.js.map +1 -0
- package/lib/module/Group/api/index.js +108 -9
- package/lib/module/Group/api/index.js.map +1 -1
- package/lib/module/Group/components/GroupCTAButton.js +23 -21
- package/lib/module/Group/components/GroupCTAButton.js.map +1 -1
- package/lib/module/Group/index.js +372 -91
- package/lib/module/Group/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Components/ConfirmAlert.d.ts +6 -0
- package/lib/typescript/lib/commonjs/Components/ConfirmAlert.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Group/api/index.d.ts +9 -1
- package/lib/typescript/lib/commonjs/Group/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Group/components/GroupCTAButton.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Group/components/GroupCTAButton.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Group/index.d.ts +5 -1
- package/lib/typescript/lib/commonjs/Group/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/ConfirmAlert.d.ts +5 -0
- package/lib/typescript/lib/module/Components/ConfirmAlert.d.ts.map +1 -0
- package/lib/typescript/lib/module/Group/api/index.d.ts +9 -1
- package/lib/typescript/lib/module/Group/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Group/components/GroupCTAButton.d.ts +3 -1
- package/lib/typescript/lib/module/Group/components/GroupCTAButton.d.ts.map +1 -1
- package/lib/typescript/lib/module/Group/index.d.ts +5 -1
- package/lib/typescript/lib/module/Group/index.d.ts.map +1 -1
- package/lib/typescript/src/Components/ConfirmAlert.d.ts +5 -0
- package/lib/typescript/src/Components/ConfirmAlert.d.ts.map +1 -0
- package/lib/typescript/src/Group/api/index.d.ts +15 -2
- package/lib/typescript/src/Group/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Group/components/GroupCTAButton.d.ts +4 -1
- package/lib/typescript/src/Group/components/GroupCTAButton.d.ts.map +1 -1
- package/lib/typescript/src/Group/index.d.ts +6 -2
- package/lib/typescript/src/Group/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Components/ConfirmAlert.tsx +39 -0
- package/src/Group/api/index.ts +81 -11
- package/src/Group/components/GroupCTAButton.tsx +12 -10
- package/src/Group/index.tsx +263 -77
|
@@ -11,15 +11,48 @@ import CompetitionCard from '../Engage/components/CompetitionCard';
|
|
|
11
11
|
import { PostCard } from '../SocialComponents';
|
|
12
12
|
import Pagination from '../Components/Pagination';
|
|
13
13
|
import GroupCTAButton from './components/GroupCTAButton';
|
|
14
|
-
|
|
14
|
+
import PollCampaignCard from '../Engage/components/PollCampaignCard';
|
|
15
|
+
import SquaresCompetitionCard from '../Engage/components/SquaresCompetitionCard';
|
|
16
|
+
import { showConfirmAlert } from '../Components/ConfirmAlert';
|
|
17
|
+
const sections = ['header', 'chat', 'toggle', 'me', 'competition_toggle', 'new_competition', 'members', 'competitions', 'activity'];
|
|
18
|
+
const member_stat_options = [{
|
|
19
|
+
stat_key: 'roi_pct',
|
|
20
|
+
label: 'ROI Percent',
|
|
21
|
+
multiplier: 100,
|
|
22
|
+
suffix: '%'
|
|
23
|
+
}, {
|
|
24
|
+
stat_key: 'winnings',
|
|
25
|
+
label: 'Winnings',
|
|
26
|
+
multiplier: 1,
|
|
27
|
+
prefix: '$'
|
|
28
|
+
}, {
|
|
29
|
+
stat_key: 'win_pct',
|
|
30
|
+
label: 'Win Percent',
|
|
31
|
+
multiplier: 100,
|
|
32
|
+
suffix: '%'
|
|
33
|
+
}, {
|
|
34
|
+
stat_key: 'fulfilled_positions',
|
|
35
|
+
label: 'Matched Bets',
|
|
36
|
+
multiplier: 1,
|
|
37
|
+
suffix: ' Bets'
|
|
38
|
+
}, {
|
|
39
|
+
stat_key: 'original_stake',
|
|
40
|
+
label: 'Betting Volume',
|
|
41
|
+
multiplier: 1,
|
|
42
|
+
prefix: '$'
|
|
43
|
+
}];
|
|
15
44
|
const GroupComponent = ({
|
|
45
|
+
refresh_key,
|
|
16
46
|
group_id,
|
|
17
47
|
player,
|
|
18
48
|
mode,
|
|
19
49
|
onInvitePlayer,
|
|
20
50
|
onSelectCompetition,
|
|
21
51
|
onSelectChat,
|
|
22
|
-
onSelectPlayer
|
|
52
|
+
onSelectPlayer,
|
|
53
|
+
onNudgePlayer,
|
|
54
|
+
onSelectPollCampaign,
|
|
55
|
+
onSelectSquaresCompetition
|
|
23
56
|
}) => {
|
|
24
57
|
const Colors = useColors();
|
|
25
58
|
const leader_options = [{
|
|
@@ -54,6 +87,9 @@ const GroupComponent = ({
|
|
|
54
87
|
toggle: 'upcoming',
|
|
55
88
|
competition_payout_types: [],
|
|
56
89
|
competition_result_types: [],
|
|
90
|
+
events: [],
|
|
91
|
+
squares_competitions: [],
|
|
92
|
+
poll_campaigns: [],
|
|
57
93
|
competition_types: [],
|
|
58
94
|
active_competitions: [],
|
|
59
95
|
competition_players: [],
|
|
@@ -75,28 +111,35 @@ const GroupComponent = ({
|
|
|
75
111
|
group_messages: [],
|
|
76
112
|
editing: false,
|
|
77
113
|
show_player_status: false,
|
|
114
|
+
stats_expanded: false,
|
|
78
115
|
active_toggle: 'members',
|
|
116
|
+
active_stat: member_stat_options[0],
|
|
79
117
|
group_players: [],
|
|
80
118
|
players: []
|
|
81
119
|
});
|
|
82
120
|
const {
|
|
83
121
|
loading,
|
|
84
122
|
group,
|
|
123
|
+
action_loading,
|
|
124
|
+
stats_expanded,
|
|
85
125
|
active_toggle,
|
|
86
126
|
editing,
|
|
87
127
|
show_player_status,
|
|
128
|
+
active_stat,
|
|
88
129
|
group_messages,
|
|
89
130
|
group_players,
|
|
90
131
|
my_group_player,
|
|
91
132
|
players
|
|
92
133
|
} = group_data;
|
|
134
|
+
const admin = player?.player_id == group?.group_admin ? true : false;
|
|
93
135
|
const {
|
|
94
136
|
sorted_players,
|
|
95
137
|
player_analytics
|
|
96
|
-
} = GroupHelpers.sortMembers(group_players, order_analytics);
|
|
138
|
+
} = GroupHelpers.sortMembers(group_players, order_analytics, active_stat?.stat_key);
|
|
139
|
+
const sorted_engagements = GroupHelpers.sortCompetitionAction([], comp_data.active_competitions, [], comp_data.squares_competitions, comp_data.poll_campaigns);
|
|
97
140
|
useEffect(() => {
|
|
98
141
|
getGroupData(group_id);
|
|
99
|
-
}, [group_id]);
|
|
142
|
+
}, [group_id, refresh_key]);
|
|
100
143
|
useEffect(() => {
|
|
101
144
|
getToggleData(active_toggle);
|
|
102
145
|
}, [active_toggle]);
|
|
@@ -118,7 +161,7 @@ const GroupComponent = ({
|
|
|
118
161
|
const getActitiyData = async page => {
|
|
119
162
|
setActivityData({
|
|
120
163
|
...activity_data,
|
|
121
|
-
loading:
|
|
164
|
+
loading: true
|
|
122
165
|
});
|
|
123
166
|
const activity = await GroupApi.getPostsByGroupId(group_id, page);
|
|
124
167
|
let order_ids = [];
|
|
@@ -143,16 +186,30 @@ const GroupComponent = ({
|
|
|
143
186
|
competition_records: [],
|
|
144
187
|
competition_results: []
|
|
145
188
|
};
|
|
189
|
+
let server_polls = [];
|
|
190
|
+
let server_sq = [];
|
|
191
|
+
let server_events = [];
|
|
146
192
|
if (type == 'upcoming') {
|
|
147
193
|
resp = await GroupApi.getActiveCompetitions(group_id);
|
|
194
|
+
server_polls = await GroupApi.getActivePolls(group_id);
|
|
195
|
+
server_sq = await GroupApi.getActiveSquares(group_id);
|
|
196
|
+
let event_ids = server_sq.map(sq => sq.event_id);
|
|
197
|
+
server_events = await GroupApi.getEventsByIds(event_ids);
|
|
148
198
|
} else {
|
|
149
199
|
resp = await GroupApi.getHistoryCompetitions(group_id, page);
|
|
200
|
+
server_polls = await GroupApi.getHistoryPolls(group_id, page);
|
|
201
|
+
server_sq = await GroupApi.getHistorySquares(group_id, page);
|
|
202
|
+
let event_ids = server_sq.map(sq => sq.event_id);
|
|
203
|
+
server_events = await GroupApi.getEventsByIds(event_ids);
|
|
150
204
|
}
|
|
151
205
|
const opts = await GroupApi.getCompetitionOptions();
|
|
152
206
|
setCompData({
|
|
153
207
|
...comp_data,
|
|
154
208
|
loading: false,
|
|
155
209
|
toggle: type,
|
|
210
|
+
poll_campaigns: server_polls,
|
|
211
|
+
squares_competitions: server_sq,
|
|
212
|
+
events: server_events,
|
|
156
213
|
competition_players: resp.competition_players,
|
|
157
214
|
competition_records: resp.competition_records,
|
|
158
215
|
competition_results: resp.competition_results,
|
|
@@ -205,11 +262,13 @@ const GroupComponent = ({
|
|
|
205
262
|
});
|
|
206
263
|
};
|
|
207
264
|
const renderPlayers = data => {
|
|
208
|
-
const
|
|
209
|
-
if (!
|
|
265
|
+
const pl = players.find(p => p.player_id == data.item.player_id);
|
|
266
|
+
if (!pl) {
|
|
210
267
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
211
268
|
}
|
|
212
269
|
const player_analytic = player_analytics[data.item.player_id];
|
|
270
|
+
const analytic = player_analytic ? player_analytic[active_stat?.stat_key] : 0;
|
|
271
|
+
const is_loading = action_loading == data.item.group_player_id ? true : false;
|
|
213
272
|
return /*#__PURE__*/React.createElement(Button, {
|
|
214
273
|
transparent: true,
|
|
215
274
|
style: {
|
|
@@ -220,8 +279,36 @@ const GroupComponent = ({
|
|
|
220
279
|
borderColor: Colors.borders.light,
|
|
221
280
|
borderRadius: 0
|
|
222
281
|
},
|
|
223
|
-
onPress: () => onSelectPlayer(
|
|
224
|
-
}, /*#__PURE__*/React.createElement(
|
|
282
|
+
onPress: () => onSelectPlayer(pl)
|
|
283
|
+
}, admin && data.item.player_id != player?.player_id ? /*#__PURE__*/React.createElement(Button, {
|
|
284
|
+
title: "X",
|
|
285
|
+
title_color: Colors.text.error,
|
|
286
|
+
loading: is_loading,
|
|
287
|
+
style: {
|
|
288
|
+
padding: 10,
|
|
289
|
+
opacity: is_loading ? 0.5 : 1
|
|
290
|
+
},
|
|
291
|
+
onPress: () => {
|
|
292
|
+
showConfirmAlert('Are you sure?', 'This will boot and ban this player from the group. You can unban the player later', async () => {
|
|
293
|
+
//Ok we have confirmed it!
|
|
294
|
+
let new_pl = await GroupApi.bootPlayer(data.item.group_player_id);
|
|
295
|
+
if (!new_pl) {
|
|
296
|
+
setGroupData({
|
|
297
|
+
...group_data,
|
|
298
|
+
action_loading: undefined
|
|
299
|
+
});
|
|
300
|
+
return alert('Unable to boot player at this time. Please try again');
|
|
301
|
+
}
|
|
302
|
+
setGroupData({
|
|
303
|
+
...group_data,
|
|
304
|
+
action_loading: undefined,
|
|
305
|
+
group_players: group_players.filter(gp => gp.group_player_id != new_pl.group_player_id).concat(new_pl)
|
|
306
|
+
});
|
|
307
|
+
}), () => {
|
|
308
|
+
console.log('cancelled');
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(View, {
|
|
225
312
|
float: true,
|
|
226
313
|
style: {
|
|
227
314
|
borderRadius: 100,
|
|
@@ -229,7 +316,7 @@ const GroupComponent = ({
|
|
|
229
316
|
}
|
|
230
317
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
231
318
|
source: {
|
|
232
|
-
uri:
|
|
319
|
+
uri: pl.profile_pic
|
|
233
320
|
},
|
|
234
321
|
style: {
|
|
235
322
|
height: 45,
|
|
@@ -245,32 +332,123 @@ const GroupComponent = ({
|
|
|
245
332
|
}
|
|
246
333
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
247
334
|
theme: "h1"
|
|
248
|
-
}, "@",
|
|
335
|
+
}, "@", pl.username), /*#__PURE__*/React.createElement(Text, {
|
|
249
336
|
theme: "description",
|
|
250
337
|
style: {
|
|
251
338
|
marginTop: 3
|
|
252
339
|
}
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
|
|
340
|
+
}, data.item.status == 'active' ? 'Joined' : 'Invited', " ", moment(data.item.last_update_datetime).fromNow())), active_stat && player_analytic && data.item.status == 'active' ? /*#__PURE__*/React.createElement(View, {
|
|
341
|
+
style: {
|
|
342
|
+
alignItems: 'flex-end'
|
|
343
|
+
}
|
|
344
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
345
|
+
theme: "h1"
|
|
346
|
+
}, active_stat.prefix, (parseFloat(analytic) * active_stat.multiplier).toFixed(2), active_stat.suffix), /*#__PURE__*/React.createElement(Text, {
|
|
347
|
+
theme: "light",
|
|
348
|
+
style: {
|
|
349
|
+
marginTop: 3
|
|
350
|
+
}
|
|
351
|
+
}, active_stat.label)) : /*#__PURE__*/React.createElement(React.Fragment, null), data.item.status == 'invited' ? /*#__PURE__*/React.createElement(Button, {
|
|
352
|
+
disabled: !admin,
|
|
353
|
+
type: "text",
|
|
354
|
+
style: {
|
|
355
|
+
padding: 10,
|
|
356
|
+
opacity: is_loading ? 0.5 : 1
|
|
357
|
+
},
|
|
358
|
+
loading: is_loading,
|
|
359
|
+
title_color: Colors.text.action,
|
|
360
|
+
title: admin ? 'Nudge' : 'Invited',
|
|
361
|
+
onPress: () => onNudgePlayer(pl, data.item)
|
|
362
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null), admin && data.item.status == 'invited' ? /*#__PURE__*/React.createElement(Button, {
|
|
363
|
+
transparent: true,
|
|
364
|
+
style: {
|
|
365
|
+
padding: 10,
|
|
366
|
+
opacity: is_loading ? 0.5 : 1
|
|
367
|
+
},
|
|
368
|
+
title_color: Colors.text.error,
|
|
369
|
+
loading: is_loading,
|
|
370
|
+
title: "Uninvite",
|
|
371
|
+
onPress: async () => {
|
|
372
|
+
setGroupData({
|
|
373
|
+
...group_data,
|
|
374
|
+
action_loading: data.item.group_player_id
|
|
375
|
+
});
|
|
376
|
+
const new_pl = await GroupApi.uninvitePlayer(data.item.group_player_id);
|
|
377
|
+
if (!new_pl) {
|
|
378
|
+
setGroupData({
|
|
379
|
+
...group_data,
|
|
380
|
+
action_loading: undefined
|
|
381
|
+
});
|
|
382
|
+
return alert('Unable to uninvite player. Please try again');
|
|
383
|
+
}
|
|
384
|
+
setGroupData({
|
|
385
|
+
...group_data,
|
|
386
|
+
action_loading: undefined,
|
|
387
|
+
group_players: group_players.filter(gp => gp.group_player_id != new_pl.group_player_id).concat(new_pl)
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
256
391
|
};
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
392
|
+
const renderEngagements = data => {
|
|
393
|
+
switch (data.item.type) {
|
|
394
|
+
case 'competition':
|
|
395
|
+
const competition = comp_data.active_competitions.find(c => c.competition_id == data.item.id);
|
|
396
|
+
if (!competition) {
|
|
397
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
398
|
+
}
|
|
399
|
+
const type = comp_data.competition_types.find(t => t.competition_type_id == competition.competition_type_id);
|
|
400
|
+
const result = comp_data.competition_result_types.find(r => r.competition_result_type_id == competition.competition_result_type_id);
|
|
401
|
+
if (!type || !result) {
|
|
402
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
403
|
+
}
|
|
404
|
+
const my_result = comp_data.competition_results.find(cr => cr.player_id == player?.player_id && cr.competition_id == competition.competition_id);
|
|
405
|
+
const my_record = comp_data.competition_records.find(cr => cr.player_id == player?.player_id && cr.competition_id == competition.competition_id);
|
|
406
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
407
|
+
style: {
|
|
408
|
+
padding: 5
|
|
409
|
+
}
|
|
410
|
+
}, /*#__PURE__*/React.createElement(CompetitionCard, {
|
|
411
|
+
competition: competition,
|
|
412
|
+
player: player,
|
|
413
|
+
competition_type: type,
|
|
414
|
+
competition_record: my_record,
|
|
415
|
+
competition_result: my_result,
|
|
416
|
+
competition_result_type: result,
|
|
417
|
+
onCompetitionSelect: onSelectCompetition
|
|
418
|
+
}));
|
|
419
|
+
case 'bracket':
|
|
420
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
421
|
+
case 'squares':
|
|
422
|
+
const squares_comp = comp_data.squares_competitions.find(sc => sc.sq_comp_id == data.item.id);
|
|
423
|
+
if (!squares_comp) {
|
|
424
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
425
|
+
}
|
|
426
|
+
const event = comp_data.events.find(e => e.event_id == squares_comp.event_id);
|
|
427
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
428
|
+
style: {
|
|
429
|
+
padding: 5
|
|
430
|
+
}
|
|
431
|
+
}, /*#__PURE__*/React.createElement(SquaresCompetitionCard, {
|
|
432
|
+
squares_competition: squares_comp,
|
|
433
|
+
event: event,
|
|
434
|
+
onSelectCompetition: onSelectSquaresCompetition
|
|
435
|
+
}));
|
|
436
|
+
case 'poll_campaign':
|
|
437
|
+
const poll_campaign = comp_data.poll_campaigns.find(pc => pc.poll_campaign_id == data.item.id);
|
|
438
|
+
if (!poll_campaign) {
|
|
439
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
440
|
+
}
|
|
441
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
442
|
+
style: {
|
|
443
|
+
padding: 5
|
|
444
|
+
}
|
|
445
|
+
}, /*#__PURE__*/React.createElement(PollCampaignCard, {
|
|
446
|
+
poll_campaign: poll_campaign,
|
|
447
|
+
onSelectPollCampaign: onSelectPollCampaign
|
|
448
|
+
}));
|
|
449
|
+
default:
|
|
450
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
262
451
|
}
|
|
263
|
-
const my_result = comp_data.competition_results.find(cr => cr.player_id == player?.player_id && cr.competition_id == data.item.competition_id);
|
|
264
|
-
const my_record = comp_data.competition_records.find(cr => cr.player_id == player?.player_id && cr.competition_id == data.item.competition_id);
|
|
265
|
-
return /*#__PURE__*/React.createElement(CompetitionCard, {
|
|
266
|
-
competition: data.item,
|
|
267
|
-
player: player,
|
|
268
|
-
competition_type: type,
|
|
269
|
-
competition_record: my_record,
|
|
270
|
-
competition_result: my_result,
|
|
271
|
-
competition_result_type: result,
|
|
272
|
-
onCompetitionSelect: onSelectCompetition
|
|
273
|
-
});
|
|
274
452
|
};
|
|
275
453
|
const renderPosts = data => {
|
|
276
454
|
let player = players.find(p => p.player_id == data.item.player_id);
|
|
@@ -356,13 +534,49 @@ const GroupComponent = ({
|
|
|
356
534
|
}
|
|
357
535
|
}, /*#__PURE__*/React.createElement(GroupCTAButton, {
|
|
358
536
|
group: group,
|
|
359
|
-
|
|
537
|
+
hide_from_player: true,
|
|
538
|
+
message_length: 20,
|
|
360
539
|
players: players,
|
|
361
540
|
group_messages: group_messages,
|
|
362
541
|
group_players: group_players,
|
|
363
542
|
onSelectChat: onSelectChat
|
|
364
543
|
}));
|
|
544
|
+
case 'new_competition':
|
|
545
|
+
if (active_toggle != 'competitions') {
|
|
546
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
547
|
+
}
|
|
548
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
549
|
+
type: "footer",
|
|
550
|
+
style: {
|
|
551
|
+
flexDirection: 'row',
|
|
552
|
+
alignItems: 'center',
|
|
553
|
+
padding: 10
|
|
554
|
+
}
|
|
555
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
556
|
+
transparent: true,
|
|
557
|
+
style: {
|
|
558
|
+
flex: 1,
|
|
559
|
+
marginRight: 10
|
|
560
|
+
}
|
|
561
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
562
|
+
theme: "h2"
|
|
563
|
+
}, "CREATE A NEW COMPETITION"), /*#__PURE__*/React.createElement(Text, {
|
|
564
|
+
theme: "description",
|
|
565
|
+
style: {
|
|
566
|
+
marginTop: 3
|
|
567
|
+
}
|
|
568
|
+
}, "Create a new pick-em or other engagement for this group!")), /*#__PURE__*/React.createElement(Button, {
|
|
569
|
+
type: "success",
|
|
570
|
+
style: {
|
|
571
|
+
padding: 10
|
|
572
|
+
},
|
|
573
|
+
title: "CREATE",
|
|
574
|
+
onPress: () => console.log('New competition!')
|
|
575
|
+
}));
|
|
365
576
|
case 'me':
|
|
577
|
+
if (active_toggle != 'members') {
|
|
578
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
579
|
+
}
|
|
366
580
|
return /*#__PURE__*/React.createElement(View, {
|
|
367
581
|
type: "row",
|
|
368
582
|
style: {
|
|
@@ -413,7 +627,7 @@ const GroupComponent = ({
|
|
|
413
627
|
...group_data,
|
|
414
628
|
show_player_status: true
|
|
415
629
|
})
|
|
416
|
-
}) : /*#__PURE__*/React.createElement(React.Fragment, null), !my_group_player || my_group_player.status == 'inactive' ? /*#__PURE__*/React.createElement(Button, {
|
|
630
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null), !group?.invite_only && (!my_group_player || my_group_player.status == 'inactive') ? /*#__PURE__*/React.createElement(Button, {
|
|
417
631
|
type: "success",
|
|
418
632
|
title: "JOIN",
|
|
419
633
|
style: {
|
|
@@ -423,7 +637,7 @@ const GroupComponent = ({
|
|
|
423
637
|
...group_data,
|
|
424
638
|
show_player_status: true
|
|
425
639
|
})
|
|
426
|
-
}) : my_group_player?.status != 'invited' ? /*#__PURE__*/React.createElement(Button, {
|
|
640
|
+
}) : my_group_player?.status != 'invited' && !admin ? /*#__PURE__*/React.createElement(Button, {
|
|
427
641
|
type: "error",
|
|
428
642
|
title: "LEAVE",
|
|
429
643
|
style: {
|
|
@@ -433,7 +647,10 @@ const GroupComponent = ({
|
|
|
433
647
|
...group_data,
|
|
434
648
|
show_player_status: true
|
|
435
649
|
})
|
|
436
|
-
}) :
|
|
650
|
+
}) : my_group_player?.status != 'invited' && admin ? /*#__PURE__*/React.createElement(Text, {
|
|
651
|
+
theme: "h1",
|
|
652
|
+
color: Colors.text.gold
|
|
653
|
+
}, "ADMIN") : /*#__PURE__*/React.createElement(React.Fragment, null)) : /*#__PURE__*/React.createElement(React.Fragment, null));
|
|
437
654
|
case 'toggle':
|
|
438
655
|
return /*#__PURE__*/React.createElement(View, {
|
|
439
656
|
style: {
|
|
@@ -448,7 +665,7 @@ const GroupComponent = ({
|
|
|
448
665
|
label: 'Activity'
|
|
449
666
|
}, {
|
|
450
667
|
key: 'competitions',
|
|
451
|
-
label: '
|
|
668
|
+
label: 'Engagements'
|
|
452
669
|
}],
|
|
453
670
|
selected_option: active_toggle,
|
|
454
671
|
onSelectOption: option => setGroupData({
|
|
@@ -471,12 +688,15 @@ const GroupComponent = ({
|
|
|
471
688
|
style: {
|
|
472
689
|
padding: 10
|
|
473
690
|
}
|
|
474
|
-
}, /*#__PURE__*/React.createElement(
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
691
|
+
}, activity_data.loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
692
|
+
style: {
|
|
693
|
+
padding: 20,
|
|
694
|
+
alignSelf: 'center'
|
|
695
|
+
},
|
|
696
|
+
size: 'large',
|
|
697
|
+
color: Colors.text.h1
|
|
698
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(FlatList, {
|
|
699
|
+
data: activity_data.posts.sort((a, b) => moment(b.create_datetime).unix() - moment(a.create_datetime).unix()),
|
|
480
700
|
key: 'post_list',
|
|
481
701
|
keyExtractor: item => item.memo_post_id.toString(),
|
|
482
702
|
renderItem: renderPosts
|
|
@@ -485,7 +705,91 @@ const GroupComponent = ({
|
|
|
485
705
|
if (active_toggle != 'members') {
|
|
486
706
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
487
707
|
}
|
|
488
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
708
|
+
return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(View, {
|
|
709
|
+
type: "header",
|
|
710
|
+
style: {
|
|
711
|
+
flexDirection: 'row',
|
|
712
|
+
alignItems: 'center',
|
|
713
|
+
padding: 10,
|
|
714
|
+
zIndex: 10
|
|
715
|
+
}
|
|
716
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
717
|
+
transparent: true,
|
|
718
|
+
style: {
|
|
719
|
+
flex: 1,
|
|
720
|
+
marginRight: 10
|
|
721
|
+
}
|
|
722
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
723
|
+
theme: "h1"
|
|
724
|
+
}, "Group Members"), /*#__PURE__*/React.createElement(Text, {
|
|
725
|
+
theme: "description"
|
|
726
|
+
}, "Active and invited members are show below. You can sort the members by different leaderboards using the dropdown on the right.")), /*#__PURE__*/React.createElement(View, {
|
|
727
|
+
float: true
|
|
728
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
729
|
+
transparent: true,
|
|
730
|
+
style: {
|
|
731
|
+
flexDirection: 'row',
|
|
732
|
+
alignItems: 'center',
|
|
733
|
+
padding: 10
|
|
734
|
+
},
|
|
735
|
+
onPress: () => setGroupData({
|
|
736
|
+
...group_data,
|
|
737
|
+
stats_expanded: !stats_expanded
|
|
738
|
+
})
|
|
739
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
740
|
+
style: {
|
|
741
|
+
marginRight: 5
|
|
742
|
+
},
|
|
743
|
+
theme: "h2"
|
|
744
|
+
}, active_stat?.label ?? 'Select'), /*#__PURE__*/React.createElement(Icons.ChevronIcon, {
|
|
745
|
+
direction: stats_expanded ? 'up' : 'down',
|
|
746
|
+
color: Colors.text.h1,
|
|
747
|
+
size: 8
|
|
748
|
+
})), stats_expanded ? /*#__PURE__*/React.createElement(View, {
|
|
749
|
+
float: true,
|
|
750
|
+
style: {
|
|
751
|
+
position: 'absolute',
|
|
752
|
+
top: 0,
|
|
753
|
+
right: 0,
|
|
754
|
+
width: 200
|
|
755
|
+
}
|
|
756
|
+
}, member_stat_options.map(so => {
|
|
757
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
758
|
+
transparent: true,
|
|
759
|
+
style: {
|
|
760
|
+
padding: 10,
|
|
761
|
+
borderRadius: 0,
|
|
762
|
+
borderBottomWidth: 1,
|
|
763
|
+
borderColor: Colors.borders.light
|
|
764
|
+
},
|
|
765
|
+
onPress: () => setGroupData({
|
|
766
|
+
...group_data,
|
|
767
|
+
active_stat: so,
|
|
768
|
+
stats_expanded: false
|
|
769
|
+
})
|
|
770
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
771
|
+
theme: "h1"
|
|
772
|
+
}, so.label));
|
|
773
|
+
})) : /*#__PURE__*/React.createElement(React.Fragment, null))), /*#__PURE__*/React.createElement(View, {
|
|
774
|
+
style: {
|
|
775
|
+
padding: 10
|
|
776
|
+
}
|
|
777
|
+
}, /*#__PURE__*/React.createElement(Toggle, {
|
|
778
|
+
options: leader_options.map(o => {
|
|
779
|
+
return {
|
|
780
|
+
key: o.option,
|
|
781
|
+
label: o.label
|
|
782
|
+
};
|
|
783
|
+
}),
|
|
784
|
+
selected_option: time_option?.option,
|
|
785
|
+
onSelectOption: option => {
|
|
786
|
+
const selected = leader_options.find(o => o.option == option);
|
|
787
|
+
if (!selected) {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
getGroupAnalytics(group_id, selected);
|
|
791
|
+
}
|
|
792
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
489
793
|
style: {
|
|
490
794
|
padding: 10
|
|
491
795
|
}
|
|
@@ -493,8 +797,10 @@ const GroupComponent = ({
|
|
|
493
797
|
data: sorted_players,
|
|
494
798
|
keyExtractor: item => item.group_player_id.toString(),
|
|
495
799
|
renderItem: renderPlayers,
|
|
800
|
+
initialNumToRender: 10,
|
|
801
|
+
windowSize: 4,
|
|
496
802
|
key: 'group_members'
|
|
497
|
-
}));
|
|
803
|
+
})));
|
|
498
804
|
case 'competition_toggle':
|
|
499
805
|
if (active_toggle != 'competitions') {
|
|
500
806
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
@@ -523,11 +829,18 @@ const GroupComponent = ({
|
|
|
523
829
|
style: {
|
|
524
830
|
padding: 10
|
|
525
831
|
}
|
|
526
|
-
}, /*#__PURE__*/React.createElement(
|
|
832
|
+
}, comp_data.loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
833
|
+
style: {
|
|
834
|
+
padding: 20,
|
|
835
|
+
alignSelf: 'center'
|
|
836
|
+
},
|
|
837
|
+
size: 'large',
|
|
838
|
+
color: Colors.text.h1
|
|
839
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null), /*#__PURE__*/React.createElement(FlatList, {
|
|
527
840
|
key: 'competition_list',
|
|
528
|
-
keyExtractor: item => item.
|
|
529
|
-
data:
|
|
530
|
-
renderItem:
|
|
841
|
+
keyExtractor: item => item.id.toString(),
|
|
842
|
+
data: sorted_engagements.sort((a, b) => moment(a.scheduled_datetime).unix() - moment(b.scheduled_datetime).unix()),
|
|
843
|
+
renderItem: renderEngagements
|
|
531
844
|
}));
|
|
532
845
|
default:
|
|
533
846
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
@@ -546,49 +859,11 @@ const GroupComponent = ({
|
|
|
546
859
|
key: 'group_list',
|
|
547
860
|
keyExtractor: item => item,
|
|
548
861
|
renderItem: renderSections
|
|
549
|
-
}), active_toggle == 'members' ? /*#__PURE__*/React.createElement(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
};
|
|
555
|
-
}),
|
|
556
|
-
selected_option: time_option?.option,
|
|
557
|
-
onSelectOption: option => {
|
|
558
|
-
const selected = leader_options.find(o => o.option == option);
|
|
559
|
-
if (!selected) {
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
getGroupAnalytics(group_id, selected);
|
|
563
|
-
}
|
|
564
|
-
}) : active_toggle == 'competitions' ? /*#__PURE__*/React.createElement(View, {
|
|
565
|
-
type: "footer",
|
|
566
|
-
style: {
|
|
567
|
-
flexDirection: 'row',
|
|
568
|
-
alignItems: 'center',
|
|
569
|
-
padding: 10
|
|
570
|
-
}
|
|
571
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
572
|
-
transparent: true,
|
|
573
|
-
style: {
|
|
574
|
-
flex: 1,
|
|
575
|
-
marginRight: 10
|
|
576
|
-
}
|
|
577
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
578
|
-
theme: "h2"
|
|
579
|
-
}, "CREATE A NEW COMPETITION"), /*#__PURE__*/React.createElement(Text, {
|
|
580
|
-
theme: "description",
|
|
581
|
-
style: {
|
|
582
|
-
marginTop: 3
|
|
583
|
-
}
|
|
584
|
-
}, "Create a new pick-em or other engagement for this group!")), /*#__PURE__*/React.createElement(Button, {
|
|
585
|
-
type: "success",
|
|
586
|
-
style: {
|
|
587
|
-
padding: 10
|
|
588
|
-
},
|
|
589
|
-
title: "CREATE",
|
|
590
|
-
onPress: () => console.log('New competition!')
|
|
591
|
-
})) : /*#__PURE__*/React.createElement(React.Fragment, null)), editing && group ? /*#__PURE__*/React.createElement(View, {
|
|
862
|
+
}), active_toggle == 'members' ? /*#__PURE__*/React.createElement(React.Fragment, null) : active_toggle == 'activity' ? /*#__PURE__*/React.createElement(Pagination, {
|
|
863
|
+
offset: activity_data.offset,
|
|
864
|
+
onNext: () => getActitiyData(activity_data.offset + 1),
|
|
865
|
+
onPrevious: () => getActitiyData(activity_data.offset - 1)
|
|
866
|
+
}) : /*#__PURE__*/React.createElement(React.Fragment, null)), editing && group ? /*#__PURE__*/React.createElement(View, {
|
|
592
867
|
type: "blur",
|
|
593
868
|
style: {
|
|
594
869
|
position: 'absolute',
|
|
@@ -611,7 +886,13 @@ const GroupComponent = ({
|
|
|
611
886
|
}
|
|
612
887
|
}, /*#__PURE__*/React.createElement(ManageGroupForm, {
|
|
613
888
|
group: group,
|
|
614
|
-
onInvitePlayer:
|
|
889
|
+
onInvitePlayer: () => {
|
|
890
|
+
setGroupData({
|
|
891
|
+
...group_data,
|
|
892
|
+
editing: false
|
|
893
|
+
});
|
|
894
|
+
onInvitePlayer();
|
|
895
|
+
},
|
|
615
896
|
onClose: () => setGroupData({
|
|
616
897
|
...group_data,
|
|
617
898
|
editing: false
|