be-components 6.6.2 → 6.6.4
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 -8
- 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 +365 -89
- package/lib/commonjs/Group/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/Contacts/useContacts.js +4 -1
- package/lib/commonjs/SocialComponents/Contacts/useContacts.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 -8
- 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 +365 -89
- package/lib/module/Group/index.js.map +1 -1
- package/lib/module/SocialComponents/Contacts/useContacts.js +4 -1
- package/lib/module/SocialComponents/Contacts/useContacts.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/commonjs/SocialComponents/Contacts/useContacts.d.ts +1 -0
- package/lib/typescript/lib/commonjs/SocialComponents/Contacts/useContacts.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/index.d.ts +1 -0
- 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/lib/module/SocialComponents/Contacts/useContacts.d.ts +1 -0
- package/lib/typescript/lib/module/SocialComponents/Contacts/useContacts.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/lib/typescript/src/SocialComponents/Contacts/useContacts.d.ts +1 -0
- package/lib/typescript/src/SocialComponents/Contacts/useContacts.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Components/ConfirmAlert.tsx +39 -0
- package/src/Group/api/index.ts +81 -10
- package/src/Group/components/GroupCTAButton.tsx +12 -10
- package/src/Group/index.tsx +258 -75
- package/src/SocialComponents/Contacts/useContacts.tsx +4 -2
|
@@ -17,17 +17,50 @@ var _CompetitionCard = _interopRequireDefault(require("../Engage/components/Comp
|
|
|
17
17
|
var _SocialComponents = require("../SocialComponents");
|
|
18
18
|
var _Pagination = _interopRequireDefault(require("../Components/Pagination"));
|
|
19
19
|
var _GroupCTAButton = _interopRequireDefault(require("./components/GroupCTAButton"));
|
|
20
|
+
var _PollCampaignCard = _interopRequireDefault(require("../Engage/components/PollCampaignCard"));
|
|
21
|
+
var _SquaresCompetitionCard = _interopRequireDefault(require("../Engage/components/SquaresCompetitionCard"));
|
|
22
|
+
var _ConfirmAlert = require("../Components/ConfirmAlert");
|
|
20
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
24
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
22
|
-
const sections = ['header', 'chat', '
|
|
25
|
+
const sections = ['header', 'chat', 'toggle', 'me', 'competition_toggle', 'new_competition', 'members', 'competitions', 'activity'];
|
|
26
|
+
const member_stat_options = [{
|
|
27
|
+
stat_key: 'roi_pct',
|
|
28
|
+
label: 'ROI Percent',
|
|
29
|
+
multiplier: 100,
|
|
30
|
+
suffix: '%'
|
|
31
|
+
}, {
|
|
32
|
+
stat_key: 'winnings',
|
|
33
|
+
label: 'Winnings',
|
|
34
|
+
multiplier: 1,
|
|
35
|
+
prefix: '$'
|
|
36
|
+
}, {
|
|
37
|
+
stat_key: 'win_pct',
|
|
38
|
+
label: 'Win Percent',
|
|
39
|
+
multiplier: 100,
|
|
40
|
+
suffix: '%'
|
|
41
|
+
}, {
|
|
42
|
+
stat_key: 'fulfilled_positions',
|
|
43
|
+
label: 'Matched Bets',
|
|
44
|
+
multiplier: 1,
|
|
45
|
+
suffix: ' Bets'
|
|
46
|
+
}, {
|
|
47
|
+
stat_key: 'original_stake',
|
|
48
|
+
label: 'Betting Volume',
|
|
49
|
+
multiplier: 1,
|
|
50
|
+
prefix: '$'
|
|
51
|
+
}];
|
|
23
52
|
const GroupComponent = ({
|
|
53
|
+
refresh_key,
|
|
24
54
|
group_id,
|
|
25
55
|
player,
|
|
26
56
|
mode,
|
|
27
57
|
onInvitePlayer,
|
|
28
58
|
onSelectCompetition,
|
|
29
59
|
onSelectChat,
|
|
30
|
-
onSelectPlayer
|
|
60
|
+
onSelectPlayer,
|
|
61
|
+
onNudgePlayer,
|
|
62
|
+
onSelectPollCampaign,
|
|
63
|
+
onSelectSquaresCompetition
|
|
31
64
|
}) => {
|
|
32
65
|
const Colors = (0, _useColors.useColors)();
|
|
33
66
|
const leader_options = [{
|
|
@@ -62,6 +95,9 @@ const GroupComponent = ({
|
|
|
62
95
|
toggle: 'upcoming',
|
|
63
96
|
competition_payout_types: [],
|
|
64
97
|
competition_result_types: [],
|
|
98
|
+
events: [],
|
|
99
|
+
squares_competitions: [],
|
|
100
|
+
poll_campaigns: [],
|
|
65
101
|
competition_types: [],
|
|
66
102
|
active_competitions: [],
|
|
67
103
|
competition_players: [],
|
|
@@ -83,28 +119,35 @@ const GroupComponent = ({
|
|
|
83
119
|
group_messages: [],
|
|
84
120
|
editing: false,
|
|
85
121
|
show_player_status: false,
|
|
122
|
+
stats_expanded: false,
|
|
86
123
|
active_toggle: 'members',
|
|
124
|
+
active_stat: member_stat_options[0],
|
|
87
125
|
group_players: [],
|
|
88
126
|
players: []
|
|
89
127
|
});
|
|
90
128
|
const {
|
|
91
129
|
loading,
|
|
92
130
|
group,
|
|
131
|
+
action_loading,
|
|
132
|
+
stats_expanded,
|
|
93
133
|
active_toggle,
|
|
94
134
|
editing,
|
|
95
135
|
show_player_status,
|
|
136
|
+
active_stat,
|
|
96
137
|
group_messages,
|
|
97
138
|
group_players,
|
|
98
139
|
my_group_player,
|
|
99
140
|
players
|
|
100
141
|
} = group_data;
|
|
142
|
+
const admin = player?.player_id == group?.group_admin ? true : false;
|
|
101
143
|
const {
|
|
102
144
|
sorted_players,
|
|
103
145
|
player_analytics
|
|
104
|
-
} = _api.GroupHelpers.sortMembers(group_players, order_analytics);
|
|
146
|
+
} = _api.GroupHelpers.sortMembers(group_players, order_analytics, active_stat?.stat_key);
|
|
147
|
+
const sorted_engagements = _api.GroupHelpers.sortCompetitionAction([], comp_data.active_competitions, [], comp_data.squares_competitions, comp_data.poll_campaigns);
|
|
105
148
|
(0, _react.useEffect)(() => {
|
|
106
149
|
getGroupData(group_id);
|
|
107
|
-
}, [group_id]);
|
|
150
|
+
}, [group_id, refresh_key]);
|
|
108
151
|
(0, _react.useEffect)(() => {
|
|
109
152
|
getToggleData(active_toggle);
|
|
110
153
|
}, [active_toggle]);
|
|
@@ -126,7 +169,7 @@ const GroupComponent = ({
|
|
|
126
169
|
const getActitiyData = async page => {
|
|
127
170
|
setActivityData({
|
|
128
171
|
...activity_data,
|
|
129
|
-
loading:
|
|
172
|
+
loading: true
|
|
130
173
|
});
|
|
131
174
|
const activity = await _api.GroupApi.getPostsByGroupId(group_id, page);
|
|
132
175
|
let order_ids = [];
|
|
@@ -151,16 +194,30 @@ const GroupComponent = ({
|
|
|
151
194
|
competition_records: [],
|
|
152
195
|
competition_results: []
|
|
153
196
|
};
|
|
197
|
+
let server_polls = [];
|
|
198
|
+
let server_sq = [];
|
|
199
|
+
let server_events = [];
|
|
154
200
|
if (type == 'upcoming') {
|
|
155
201
|
resp = await _api.GroupApi.getActiveCompetitions(group_id);
|
|
202
|
+
server_polls = await _api.GroupApi.getActivePolls(group_id);
|
|
203
|
+
server_sq = await _api.GroupApi.getActiveSquares(group_id);
|
|
204
|
+
let event_ids = server_sq.map(sq => sq.event_id);
|
|
205
|
+
server_events = await _api.GroupApi.getEventsByIds(event_ids);
|
|
156
206
|
} else {
|
|
157
207
|
resp = await _api.GroupApi.getHistoryCompetitions(group_id, page);
|
|
208
|
+
server_polls = await _api.GroupApi.getHistoryPolls(group_id, page);
|
|
209
|
+
server_sq = await _api.GroupApi.getHistorySquares(group_id, page);
|
|
210
|
+
let event_ids = server_sq.map(sq => sq.event_id);
|
|
211
|
+
server_events = await _api.GroupApi.getEventsByIds(event_ids);
|
|
158
212
|
}
|
|
159
213
|
const opts = await _api.GroupApi.getCompetitionOptions();
|
|
160
214
|
setCompData({
|
|
161
215
|
...comp_data,
|
|
162
216
|
loading: false,
|
|
163
217
|
toggle: type,
|
|
218
|
+
poll_campaigns: server_polls,
|
|
219
|
+
squares_competitions: server_sq,
|
|
220
|
+
events: server_events,
|
|
164
221
|
competition_players: resp.competition_players,
|
|
165
222
|
competition_records: resp.competition_records,
|
|
166
223
|
competition_results: resp.competition_results,
|
|
@@ -213,11 +270,13 @@ const GroupComponent = ({
|
|
|
213
270
|
});
|
|
214
271
|
};
|
|
215
272
|
const renderPlayers = data => {
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
273
|
+
const pl = players.find(p => p.player_id == data.item.player_id);
|
|
274
|
+
if (!pl) {
|
|
218
275
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
219
276
|
}
|
|
220
277
|
const player_analytic = player_analytics[data.item.player_id];
|
|
278
|
+
const analytic = player_analytic ? player_analytic[active_stat?.stat_key] : 0;
|
|
279
|
+
const is_loading = action_loading == data.item.group_player_id ? true : false;
|
|
221
280
|
return /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
222
281
|
transparent: true,
|
|
223
282
|
style: {
|
|
@@ -228,8 +287,36 @@ const GroupComponent = ({
|
|
|
228
287
|
borderColor: Colors.borders.light,
|
|
229
288
|
borderRadius: 0
|
|
230
289
|
},
|
|
231
|
-
onPress: () => onSelectPlayer(
|
|
232
|
-
}, /*#__PURE__*/_react.default.createElement(_Themed.
|
|
290
|
+
onPress: () => onSelectPlayer(pl)
|
|
291
|
+
}, admin && data.item.player_id != player?.player_id ? /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
292
|
+
title: "X",
|
|
293
|
+
title_color: Colors.text.error,
|
|
294
|
+
loading: is_loading,
|
|
295
|
+
style: {
|
|
296
|
+
padding: 10,
|
|
297
|
+
opacity: is_loading ? 0.5 : 1
|
|
298
|
+
},
|
|
299
|
+
onPress: () => {
|
|
300
|
+
(0, _ConfirmAlert.showConfirmAlert)('Are you sure?', 'This will boot and ban this player from the group. You can unban the player later', async () => {
|
|
301
|
+
//Ok we have confirmed it!
|
|
302
|
+
let new_pl = await _api.GroupApi.bootPlayer(data.item.group_player_id);
|
|
303
|
+
if (!new_pl) {
|
|
304
|
+
setGroupData({
|
|
305
|
+
...group_data,
|
|
306
|
+
action_loading: undefined
|
|
307
|
+
});
|
|
308
|
+
return alert('Unable to boot player at this time. Please try again');
|
|
309
|
+
}
|
|
310
|
+
setGroupData({
|
|
311
|
+
...group_data,
|
|
312
|
+
action_loading: undefined,
|
|
313
|
+
group_players: group_players.filter(gp => gp.group_player_id != new_pl.group_player_id).concat(new_pl)
|
|
314
|
+
});
|
|
315
|
+
}), () => {
|
|
316
|
+
console.log('cancelled');
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
233
320
|
float: true,
|
|
234
321
|
style: {
|
|
235
322
|
borderRadius: 100,
|
|
@@ -237,7 +324,7 @@ const GroupComponent = ({
|
|
|
237
324
|
}
|
|
238
325
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
239
326
|
source: {
|
|
240
|
-
uri:
|
|
327
|
+
uri: pl.profile_pic
|
|
241
328
|
},
|
|
242
329
|
style: {
|
|
243
330
|
height: 45,
|
|
@@ -253,32 +340,123 @@ const GroupComponent = ({
|
|
|
253
340
|
}
|
|
254
341
|
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
255
342
|
theme: "h1"
|
|
256
|
-
}, "@",
|
|
343
|
+
}, "@", pl.username), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
257
344
|
theme: "description",
|
|
258
345
|
style: {
|
|
259
346
|
marginTop: 3
|
|
260
347
|
}
|
|
261
|
-
},
|
|
262
|
-
|
|
263
|
-
|
|
348
|
+
}, data.item.status == 'active' ? 'Joined' : 'Invited', " ", (0, _momentMini.default)(data.item.last_update_datetime).fromNow())), active_stat && player_analytic && data.item.status == 'active' ? /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
349
|
+
style: {
|
|
350
|
+
alignItems: 'flex-end'
|
|
351
|
+
}
|
|
352
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
353
|
+
theme: "h1"
|
|
354
|
+
}, active_stat.prefix, (parseFloat(analytic) * active_stat.multiplier).toFixed(2), active_stat.suffix), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
355
|
+
theme: "light",
|
|
356
|
+
style: {
|
|
357
|
+
marginTop: 3
|
|
358
|
+
}
|
|
359
|
+
}, active_stat.label)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), data.item.status == 'invited' ? /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
360
|
+
disabled: !admin,
|
|
361
|
+
type: "text",
|
|
362
|
+
style: {
|
|
363
|
+
padding: 10,
|
|
364
|
+
opacity: is_loading ? 0.5 : 1
|
|
365
|
+
},
|
|
366
|
+
loading: is_loading,
|
|
367
|
+
title_color: Colors.text.action,
|
|
368
|
+
title: admin ? 'Nudge' : 'Invited',
|
|
369
|
+
onPress: () => onNudgePlayer(pl, data.item)
|
|
370
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), admin && data.item.status == 'invited' ? /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
371
|
+
transparent: true,
|
|
372
|
+
style: {
|
|
373
|
+
padding: 10,
|
|
374
|
+
opacity: is_loading ? 0.5 : 1
|
|
375
|
+
},
|
|
376
|
+
title_color: Colors.text.error,
|
|
377
|
+
loading: is_loading,
|
|
378
|
+
title: "Uninvite",
|
|
379
|
+
onPress: async () => {
|
|
380
|
+
setGroupData({
|
|
381
|
+
...group_data,
|
|
382
|
+
action_loading: data.item.group_player_id
|
|
383
|
+
});
|
|
384
|
+
const new_pl = await _api.GroupApi.uninvitePlayer(data.item.group_player_id);
|
|
385
|
+
if (!new_pl) {
|
|
386
|
+
setGroupData({
|
|
387
|
+
...group_data,
|
|
388
|
+
action_loading: undefined
|
|
389
|
+
});
|
|
390
|
+
return alert('Unable to uninvite player. Please try again');
|
|
391
|
+
}
|
|
392
|
+
setGroupData({
|
|
393
|
+
...group_data,
|
|
394
|
+
action_loading: undefined,
|
|
395
|
+
group_players: group_players.filter(gp => gp.group_player_id != new_pl.group_player_id).concat(new_pl)
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null));
|
|
264
399
|
};
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
400
|
+
const renderEngagements = data => {
|
|
401
|
+
switch (data.item.type) {
|
|
402
|
+
case 'competition':
|
|
403
|
+
const competition = comp_data.active_competitions.find(c => c.competition_id == data.item.id);
|
|
404
|
+
if (!competition) {
|
|
405
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
406
|
+
}
|
|
407
|
+
const type = comp_data.competition_types.find(t => t.competition_type_id == competition.competition_type_id);
|
|
408
|
+
const result = comp_data.competition_result_types.find(r => r.competition_result_type_id == competition.competition_result_type_id);
|
|
409
|
+
if (!type || !result) {
|
|
410
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
411
|
+
}
|
|
412
|
+
const my_result = comp_data.competition_results.find(cr => cr.player_id == player?.player_id && cr.competition_id == competition.competition_id);
|
|
413
|
+
const my_record = comp_data.competition_records.find(cr => cr.player_id == player?.player_id && cr.competition_id == competition.competition_id);
|
|
414
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
415
|
+
style: {
|
|
416
|
+
padding: 5
|
|
417
|
+
}
|
|
418
|
+
}, /*#__PURE__*/_react.default.createElement(_CompetitionCard.default, {
|
|
419
|
+
competition: competition,
|
|
420
|
+
player: player,
|
|
421
|
+
competition_type: type,
|
|
422
|
+
competition_record: my_record,
|
|
423
|
+
competition_result: my_result,
|
|
424
|
+
competition_result_type: result,
|
|
425
|
+
onCompetitionSelect: onSelectCompetition
|
|
426
|
+
}));
|
|
427
|
+
case 'bracket':
|
|
428
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
429
|
+
case 'squares':
|
|
430
|
+
const squares_comp = comp_data.squares_competitions.find(sc => sc.sq_comp_id == data.item.id);
|
|
431
|
+
if (!squares_comp) {
|
|
432
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
433
|
+
}
|
|
434
|
+
const event = comp_data.events.find(e => e.event_id == squares_comp.event_id);
|
|
435
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
436
|
+
style: {
|
|
437
|
+
padding: 5
|
|
438
|
+
}
|
|
439
|
+
}, /*#__PURE__*/_react.default.createElement(_SquaresCompetitionCard.default, {
|
|
440
|
+
squares_competition: squares_comp,
|
|
441
|
+
event: event,
|
|
442
|
+
onSelectCompetition: onSelectSquaresCompetition
|
|
443
|
+
}));
|
|
444
|
+
case 'poll_campaign':
|
|
445
|
+
const poll_campaign = comp_data.poll_campaigns.find(pc => pc.poll_campaign_id == data.item.id);
|
|
446
|
+
if (!poll_campaign) {
|
|
447
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
448
|
+
}
|
|
449
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
450
|
+
style: {
|
|
451
|
+
padding: 5
|
|
452
|
+
}
|
|
453
|
+
}, /*#__PURE__*/_react.default.createElement(_PollCampaignCard.default, {
|
|
454
|
+
poll_campaign: poll_campaign,
|
|
455
|
+
onSelectPollCampaign: onSelectPollCampaign
|
|
456
|
+
}));
|
|
457
|
+
default:
|
|
458
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
270
459
|
}
|
|
271
|
-
const my_result = comp_data.competition_results.find(cr => cr.player_id == player?.player_id && cr.competition_id == data.item.competition_id);
|
|
272
|
-
const my_record = comp_data.competition_records.find(cr => cr.player_id == player?.player_id && cr.competition_id == data.item.competition_id);
|
|
273
|
-
return /*#__PURE__*/_react.default.createElement(_CompetitionCard.default, {
|
|
274
|
-
competition: data.item,
|
|
275
|
-
player: player,
|
|
276
|
-
competition_type: type,
|
|
277
|
-
competition_record: my_record,
|
|
278
|
-
competition_result: my_result,
|
|
279
|
-
competition_result_type: result,
|
|
280
|
-
onCompetitionSelect: onSelectCompetition
|
|
281
|
-
});
|
|
282
460
|
};
|
|
283
461
|
const renderPosts = data => {
|
|
284
462
|
let player = players.find(p => p.player_id == data.item.player_id);
|
|
@@ -364,13 +542,49 @@ const GroupComponent = ({
|
|
|
364
542
|
}
|
|
365
543
|
}, /*#__PURE__*/_react.default.createElement(_GroupCTAButton.default, {
|
|
366
544
|
group: group,
|
|
367
|
-
|
|
545
|
+
hide_from_player: true,
|
|
546
|
+
message_length: 20,
|
|
368
547
|
players: players,
|
|
369
548
|
group_messages: group_messages,
|
|
370
549
|
group_players: group_players,
|
|
371
550
|
onSelectChat: onSelectChat
|
|
372
551
|
}));
|
|
552
|
+
case 'new_competition':
|
|
553
|
+
if (active_toggle != 'competitions') {
|
|
554
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
555
|
+
}
|
|
556
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
557
|
+
type: "footer",
|
|
558
|
+
style: {
|
|
559
|
+
flexDirection: 'row',
|
|
560
|
+
alignItems: 'center',
|
|
561
|
+
padding: 10
|
|
562
|
+
}
|
|
563
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
564
|
+
transparent: true,
|
|
565
|
+
style: {
|
|
566
|
+
flex: 1,
|
|
567
|
+
marginRight: 10
|
|
568
|
+
}
|
|
569
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
570
|
+
theme: "h2"
|
|
571
|
+
}, "CREATE A NEW COMPETITION"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
572
|
+
theme: "description",
|
|
573
|
+
style: {
|
|
574
|
+
marginTop: 3
|
|
575
|
+
}
|
|
576
|
+
}, "Create a new pick-em or other engagement for this group!")), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
577
|
+
type: "success",
|
|
578
|
+
style: {
|
|
579
|
+
padding: 10
|
|
580
|
+
},
|
|
581
|
+
title: "CREATE",
|
|
582
|
+
onPress: () => console.log('New competition!')
|
|
583
|
+
}));
|
|
373
584
|
case 'me':
|
|
585
|
+
if (active_toggle != 'members') {
|
|
586
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
587
|
+
}
|
|
374
588
|
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
375
589
|
type: "row",
|
|
376
590
|
style: {
|
|
@@ -431,7 +645,7 @@ const GroupComponent = ({
|
|
|
431
645
|
...group_data,
|
|
432
646
|
show_player_status: true
|
|
433
647
|
})
|
|
434
|
-
}) : my_group_player?.status != 'invited' ? /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
648
|
+
}) : my_group_player?.status != 'invited' && !admin ? /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
435
649
|
type: "error",
|
|
436
650
|
title: "LEAVE",
|
|
437
651
|
style: {
|
|
@@ -441,7 +655,10 @@ const GroupComponent = ({
|
|
|
441
655
|
...group_data,
|
|
442
656
|
show_player_status: true
|
|
443
657
|
})
|
|
444
|
-
}) :
|
|
658
|
+
}) : my_group_player?.status != 'invited' && admin ? /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
659
|
+
theme: "h1",
|
|
660
|
+
color: Colors.text.gold
|
|
661
|
+
}, "ADMIN") : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null)) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null));
|
|
445
662
|
case 'toggle':
|
|
446
663
|
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
447
664
|
style: {
|
|
@@ -456,7 +673,7 @@ const GroupComponent = ({
|
|
|
456
673
|
label: 'Activity'
|
|
457
674
|
}, {
|
|
458
675
|
key: 'competitions',
|
|
459
|
-
label: '
|
|
676
|
+
label: 'Engagements'
|
|
460
677
|
}],
|
|
461
678
|
selected_option: active_toggle,
|
|
462
679
|
onSelectOption: option => setGroupData({
|
|
@@ -479,12 +696,15 @@ const GroupComponent = ({
|
|
|
479
696
|
style: {
|
|
480
697
|
padding: 10
|
|
481
698
|
}
|
|
482
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
699
|
+
}, activity_data.loading ? /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
|
|
700
|
+
style: {
|
|
701
|
+
padding: 20,
|
|
702
|
+
alignSelf: 'center'
|
|
703
|
+
},
|
|
704
|
+
size: 'large',
|
|
705
|
+
color: Colors.text.h1
|
|
706
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
|
|
707
|
+
data: activity_data.posts.sort((a, b) => (0, _momentMini.default)(b.create_datetime).unix() - (0, _momentMini.default)(a.create_datetime).unix()),
|
|
488
708
|
key: 'post_list',
|
|
489
709
|
keyExtractor: item => item.memo_post_id.toString(),
|
|
490
710
|
renderItem: renderPosts
|
|
@@ -493,16 +713,103 @@ const GroupComponent = ({
|
|
|
493
713
|
if (active_toggle != 'members') {
|
|
494
714
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
495
715
|
}
|
|
496
|
-
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
716
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, null, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
717
|
+
type: "header",
|
|
718
|
+
style: {
|
|
719
|
+
flexDirection: 'row',
|
|
720
|
+
alignItems: 'center',
|
|
721
|
+
padding: 10,
|
|
722
|
+
zIndex: 10
|
|
723
|
+
}
|
|
724
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
725
|
+
transparent: true,
|
|
726
|
+
style: {
|
|
727
|
+
flex: 1,
|
|
728
|
+
marginRight: 10
|
|
729
|
+
}
|
|
730
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
731
|
+
theme: "h1"
|
|
732
|
+
}, "Group Members"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
733
|
+
theme: "description"
|
|
734
|
+
}, "Active and invited members are show below. You can sort the members by different leaderboards using the dropdown on the right.")), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
735
|
+
float: true
|
|
736
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
737
|
+
transparent: true,
|
|
738
|
+
style: {
|
|
739
|
+
flexDirection: 'row',
|
|
740
|
+
alignItems: 'center',
|
|
741
|
+
padding: 10
|
|
742
|
+
},
|
|
743
|
+
onPress: () => setGroupData({
|
|
744
|
+
...group_data,
|
|
745
|
+
stats_expanded: !stats_expanded
|
|
746
|
+
})
|
|
747
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
748
|
+
style: {
|
|
749
|
+
marginRight: 5
|
|
750
|
+
},
|
|
751
|
+
theme: "h2"
|
|
752
|
+
}, active_stat?.label ?? 'Select'), /*#__PURE__*/_react.default.createElement(_Components.Icons.ChevronIcon, {
|
|
753
|
+
direction: stats_expanded ? 'up' : 'down',
|
|
754
|
+
color: Colors.text.h1,
|
|
755
|
+
size: 8
|
|
756
|
+
})), stats_expanded ? /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
757
|
+
float: true,
|
|
758
|
+
style: {
|
|
759
|
+
position: 'absolute',
|
|
760
|
+
top: 0,
|
|
761
|
+
right: 0,
|
|
762
|
+
width: 200
|
|
763
|
+
}
|
|
764
|
+
}, member_stat_options.map(so => {
|
|
765
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
766
|
+
transparent: true,
|
|
767
|
+
style: {
|
|
768
|
+
padding: 10,
|
|
769
|
+
borderRadius: 0,
|
|
770
|
+
borderBottomWidth: 1,
|
|
771
|
+
borderColor: Colors.borders.light
|
|
772
|
+
},
|
|
773
|
+
onPress: () => setGroupData({
|
|
774
|
+
...group_data,
|
|
775
|
+
active_stat: so,
|
|
776
|
+
stats_expanded: false
|
|
777
|
+
})
|
|
778
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
779
|
+
theme: "h1"
|
|
780
|
+
}, so.label));
|
|
781
|
+
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null))), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
497
782
|
style: {
|
|
498
783
|
padding: 10
|
|
499
784
|
}
|
|
785
|
+
}, /*#__PURE__*/_react.default.createElement(_Components.Toggle, {
|
|
786
|
+
options: leader_options.map(o => {
|
|
787
|
+
return {
|
|
788
|
+
key: o.option,
|
|
789
|
+
label: o.label
|
|
790
|
+
};
|
|
791
|
+
}),
|
|
792
|
+
selected_option: time_option?.option,
|
|
793
|
+
onSelectOption: option => {
|
|
794
|
+
const selected = leader_options.find(o => o.option == option);
|
|
795
|
+
if (!selected) {
|
|
796
|
+
return;
|
|
797
|
+
}
|
|
798
|
+
getGroupAnalytics(group_id, selected);
|
|
799
|
+
}
|
|
800
|
+
})), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
801
|
+
style: {
|
|
802
|
+
padding: 10,
|
|
803
|
+
zIndex: -10
|
|
804
|
+
}
|
|
500
805
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
|
|
501
806
|
data: sorted_players,
|
|
502
807
|
keyExtractor: item => item.group_player_id.toString(),
|
|
503
808
|
renderItem: renderPlayers,
|
|
809
|
+
initialNumToRender: 10,
|
|
810
|
+
windowSize: 4,
|
|
504
811
|
key: 'group_members'
|
|
505
|
-
}));
|
|
812
|
+
})));
|
|
506
813
|
case 'competition_toggle':
|
|
507
814
|
if (active_toggle != 'competitions') {
|
|
508
815
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
@@ -531,11 +838,18 @@ const GroupComponent = ({
|
|
|
531
838
|
style: {
|
|
532
839
|
padding: 10
|
|
533
840
|
}
|
|
534
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.
|
|
841
|
+
}, comp_data.loading ? /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
|
|
842
|
+
style: {
|
|
843
|
+
padding: 20,
|
|
844
|
+
alignSelf: 'center'
|
|
845
|
+
},
|
|
846
|
+
size: 'large',
|
|
847
|
+
color: Colors.text.h1
|
|
848
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null), /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
|
|
535
849
|
key: 'competition_list',
|
|
536
|
-
keyExtractor: item => item.
|
|
537
|
-
data:
|
|
538
|
-
renderItem:
|
|
850
|
+
keyExtractor: item => item.id.toString(),
|
|
851
|
+
data: sorted_engagements.sort((a, b) => (0, _momentMini.default)(a.scheduled_datetime).unix() - (0, _momentMini.default)(b.scheduled_datetime).unix()),
|
|
852
|
+
renderItem: renderEngagements
|
|
539
853
|
}));
|
|
540
854
|
default:
|
|
541
855
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
@@ -554,49 +868,11 @@ const GroupComponent = ({
|
|
|
554
868
|
key: 'group_list',
|
|
555
869
|
keyExtractor: item => item,
|
|
556
870
|
renderItem: renderSections
|
|
557
|
-
}), active_toggle == 'members' ? /*#__PURE__*/_react.default.createElement(
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
};
|
|
563
|
-
}),
|
|
564
|
-
selected_option: time_option?.option,
|
|
565
|
-
onSelectOption: option => {
|
|
566
|
-
const selected = leader_options.find(o => o.option == option);
|
|
567
|
-
if (!selected) {
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
getGroupAnalytics(group_id, selected);
|
|
571
|
-
}
|
|
572
|
-
}) : active_toggle == 'competitions' ? /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
573
|
-
type: "footer",
|
|
574
|
-
style: {
|
|
575
|
-
flexDirection: 'row',
|
|
576
|
-
alignItems: 'center',
|
|
577
|
-
padding: 10
|
|
578
|
-
}
|
|
579
|
-
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
580
|
-
transparent: true,
|
|
581
|
-
style: {
|
|
582
|
-
flex: 1,
|
|
583
|
-
marginRight: 10
|
|
584
|
-
}
|
|
585
|
-
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
586
|
-
theme: "h2"
|
|
587
|
-
}, "CREATE A NEW COMPETITION"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
588
|
-
theme: "description",
|
|
589
|
-
style: {
|
|
590
|
-
marginTop: 3
|
|
591
|
-
}
|
|
592
|
-
}, "Create a new pick-em or other engagement for this group!")), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
593
|
-
type: "success",
|
|
594
|
-
style: {
|
|
595
|
-
padding: 10
|
|
596
|
-
},
|
|
597
|
-
title: "CREATE",
|
|
598
|
-
onPress: () => console.log('New competition!')
|
|
599
|
-
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null)), editing && group ? /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
871
|
+
}), active_toggle == 'members' ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null) : active_toggle == 'activity' ? /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
872
|
+
offset: activity_data.offset,
|
|
873
|
+
onNext: () => getActitiyData(activity_data.offset + 1),
|
|
874
|
+
onPrevious: () => getActitiyData(activity_data.offset - 1)
|
|
875
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null)), editing && group ? /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
600
876
|
type: "blur",
|
|
601
877
|
style: {
|
|
602
878
|
position: 'absolute',
|