be-components 7.3.1 → 7.3.2
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/Bracket/components/ManageBracketCompetitionForm.js +70 -2
- package/lib/commonjs/Bracket/components/ManageBracketCompetitionForm.js.map +1 -1
- package/lib/commonjs/CreateEngagement/api/index.js +78 -1
- package/lib/commonjs/CreateEngagement/api/index.js.map +1 -1
- package/lib/commonjs/CreateEngagement/index.js +351 -14
- package/lib/commonjs/CreateEngagement/index.js.map +1 -1
- package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js +140 -18
- package/lib/commonjs/FlashMarket/components/ManageFlashMarket.js.map +1 -1
- package/lib/commonjs/PartnerPortal/components/CompetitionSelector.js +1 -1
- package/lib/commonjs/types.d.js.map +1 -1
- package/lib/module/Bracket/components/ManageBracketCompetitionForm.js +70 -2
- package/lib/module/Bracket/components/ManageBracketCompetitionForm.js.map +1 -1
- package/lib/module/CreateEngagement/api/index.js +78 -1
- package/lib/module/CreateEngagement/api/index.js.map +1 -1
- package/lib/module/CreateEngagement/index.js +350 -15
- package/lib/module/CreateEngagement/index.js.map +1 -1
- package/lib/module/FlashMarket/components/ManageFlashMarket.js +140 -18
- package/lib/module/FlashMarket/components/ManageFlashMarket.js.map +1 -1
- package/lib/module/PartnerPortal/components/CompetitionSelector.js +1 -1
- package/lib/module/types.d.js.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/ManageBracketCompetitionForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CreateEngagement/api/index.d.ts +29 -1
- package/lib/typescript/lib/commonjs/CreateEngagement/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts +12 -1
- package/lib/typescript/lib/commonjs/CreateEngagement/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/ManageBracketCompetitionForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/CreateEngagement/api/index.d.ts +29 -1
- package/lib/typescript/lib/module/CreateEngagement/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/CreateEngagement/index.d.ts +12 -1
- package/lib/typescript/lib/module/CreateEngagement/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/ManageBracketCompetitionForm.d.ts.map +1 -1
- package/lib/typescript/src/CreateEngagement/api/index.d.ts +14 -2
- package/lib/typescript/src/CreateEngagement/api/index.d.ts.map +1 -1
- package/lib/typescript/src/CreateEngagement/index.d.ts +15 -2
- package/lib/typescript/src/CreateEngagement/index.d.ts.map +1 -1
- package/lib/typescript/src/FlashMarket/components/ManageFlashMarket.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/Bracket/components/ManageBracketCompetitionForm.tsx +55 -2
- package/src/CreateEngagement/api/index.ts +60 -2
- package/src/CreateEngagement/index.tsx +207 -9
- package/src/FlashMarket/components/ManageFlashMarket.tsx +74 -10
- package/src/PartnerPortal/components/CompetitionSelector.tsx +1 -1
- package/src/types.d.ts +1 -0
|
@@ -22,7 +22,7 @@ type ManageFlashMarketProps = {
|
|
|
22
22
|
onFocusPosition?:(pos:FocusPositionProps) => void
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
const sections = ['header','activate','pause_resume','closed','resolve','toggle','image','question','options','settings','results']
|
|
25
|
+
const sections = ['header','activate','pause_resume','closed','resolve','toggle', 'image','question','options','settings','results', 'danger']
|
|
26
26
|
const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFocusPosition }:ManageFlashMarketProps) => {
|
|
27
27
|
const Colors = useColors();
|
|
28
28
|
const [ labels, setLabels ] = useState({
|
|
@@ -105,6 +105,19 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
const deletePoll = async(dp:PollProps) => {
|
|
109
|
+
if(action_loading){ return }
|
|
110
|
+
setFlashState({ ...flash_state, action_loading: true });
|
|
111
|
+
const deleted_poll = await PollApi.deletePoll(dp.poll_id);
|
|
112
|
+
if(!deleted_poll){ return alert('Unable to update') }
|
|
113
|
+
setFlashState({
|
|
114
|
+
...flash_state,
|
|
115
|
+
action_loading: false,
|
|
116
|
+
poll: deleted_poll,
|
|
117
|
+
draft_poll: deleted_poll
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
108
121
|
const handleSelectWinningOption = (checked:boolean, option:PollOptionProps) => {
|
|
109
122
|
if(!poll){ return alert('Unable to process') }
|
|
110
123
|
if(checked){
|
|
@@ -381,6 +394,31 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
381
394
|
</View>
|
|
382
395
|
</View>
|
|
383
396
|
)
|
|
397
|
+
case 'danger':
|
|
398
|
+
if(active_step != 'settings'){ return <></> }
|
|
399
|
+
if(!poll){ return <></> }
|
|
400
|
+
if(total_responses > 0){ return <></> }
|
|
401
|
+
return (
|
|
402
|
+
<View float style={{ margin:10, padding:10 }}>
|
|
403
|
+
<View transparent>
|
|
404
|
+
<Text theme='h1'>Delete Flash Market</Text>
|
|
405
|
+
<Text theme='description' style={{ marginTop:3 }}>DANGER: Once deleted you can no longer edit it</Text>
|
|
406
|
+
</View>
|
|
407
|
+
<Button
|
|
408
|
+
type='error'
|
|
409
|
+
title='Delete'
|
|
410
|
+
loading={action_loading}
|
|
411
|
+
disabled={action_loading ? true : false}
|
|
412
|
+
style={{ opacity: action_loading? 0.5:1, marginTop:8}}
|
|
413
|
+
onPress={() => {
|
|
414
|
+
showConfirmAlert('Are you sure?', 'Once deleted you can not longer edit it',
|
|
415
|
+
() => deletePoll(poll),
|
|
416
|
+
() => console.log('')
|
|
417
|
+
)
|
|
418
|
+
}}
|
|
419
|
+
/>
|
|
420
|
+
</View>
|
|
421
|
+
)
|
|
384
422
|
case 'pause_resume':
|
|
385
423
|
if(!poll){ return <></> }
|
|
386
424
|
if(!['active','paused',''].includes(poll.status)){ return <></> }
|
|
@@ -438,15 +476,16 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
438
476
|
</View>
|
|
439
477
|
)
|
|
440
478
|
case 'toggle':
|
|
479
|
+
let options = [
|
|
480
|
+
{ key: 'question', label: 'Question' },
|
|
481
|
+
{ key: 'options', label: 'Options' },
|
|
482
|
+
{ key: 'settings', label: 'Settings' },
|
|
483
|
+
{ key: 'results', label: 'Results' }
|
|
484
|
+
]
|
|
441
485
|
return (
|
|
442
486
|
<View style={{ padding:10 }}>
|
|
443
487
|
<Toggle
|
|
444
|
-
options={
|
|
445
|
-
{ key: 'question', label: 'Question' },
|
|
446
|
-
{ key: 'options', label: 'Options' },
|
|
447
|
-
{ key: 'settings', label: 'Settings' },
|
|
448
|
-
{ key: 'results', label: 'Results' }
|
|
449
|
-
]}
|
|
488
|
+
options={options}
|
|
450
489
|
selected_option={active_step}
|
|
451
490
|
onSelectOption={(key) => setFlashState({ ...flash_state, active_step: key })}
|
|
452
491
|
/>
|
|
@@ -514,13 +553,13 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
514
553
|
case 'results':
|
|
515
554
|
if(!poll){ return <></> }
|
|
516
555
|
if(active_step != 'results'){ return <></> }
|
|
517
|
-
let staked = poll_summaries.reduce((a,b) => a + b.stake, 0)
|
|
556
|
+
let staked = poll_summaries.reduce((a,b) => a + b.stake, 0)
|
|
557
|
+
if(poll.status != 'pending'){ staked -= - (poll.base_stake ?? 0) }
|
|
518
558
|
let responses = poll_summaries.reduce((a,b) => a + b.count, 0) - poll_summaries.length;
|
|
519
559
|
if(responses < 0){ responses = 0 }
|
|
520
560
|
let participants = players.length
|
|
521
|
-
let total_stake = poll_summaries.reduce((a,b) => a + b.stake, 0);
|
|
522
561
|
let winnings = poll_summaries.reduce((a,b) => a + b.winnings, 0);
|
|
523
|
-
let revenue =
|
|
562
|
+
let revenue = staked - winnings
|
|
524
563
|
return (
|
|
525
564
|
<View transparent>
|
|
526
565
|
<View transparent type='row' style={{ padding:20, borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
@@ -762,6 +801,31 @@ const ManageFlashMarket = ({ float, header_style, player, onClose, poll_id, onFo
|
|
|
762
801
|
renderItem={renderSections}
|
|
763
802
|
/>
|
|
764
803
|
</View>
|
|
804
|
+
{poll && poll.status == 'inactive' ?
|
|
805
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, justifyContent:'center', alignItems:'center' }}>
|
|
806
|
+
<View float style={{ width: '70%' }}>
|
|
807
|
+
<View type='header' style={{ justifyContent:'center', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
808
|
+
<Text theme='h1'>Flash Market Has Been Deleted</Text>
|
|
809
|
+
</View>
|
|
810
|
+
<View type='body' style={{ justifyContent:'center', alignItems:'center', padding:10 }}>
|
|
811
|
+
<Image
|
|
812
|
+
source={{ uri: poll.poll_image?.url }}
|
|
813
|
+
style={{ height:75, width: 75 }}
|
|
814
|
+
resizeMode='cover'
|
|
815
|
+
/>
|
|
816
|
+
<Text theme='h2' textAlign='center'>{poll.poll_question ?? 'Pending Question'}</Text>
|
|
817
|
+
</View>
|
|
818
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
819
|
+
<Button
|
|
820
|
+
title='CLOSE'
|
|
821
|
+
style={{ flex:1 }}
|
|
822
|
+
type='error'
|
|
823
|
+
onPress={() => onClose()}
|
|
824
|
+
/>
|
|
825
|
+
</View>
|
|
826
|
+
</View>
|
|
827
|
+
</View>
|
|
828
|
+
:<></>}
|
|
765
829
|
</View>
|
|
766
830
|
)
|
|
767
831
|
}
|
|
@@ -64,7 +64,7 @@ const CompetitionSelector = ({ company_id, active_competitions, onSelectCompetit
|
|
|
64
64
|
return (
|
|
65
65
|
<View float style={{ padding:15 }}>
|
|
66
66
|
<Button transparent style={{ padding:0, flexDirection:'row', alignItems:'center' }} onPress={() => setVisible(!visible)}>
|
|
67
|
-
<Text style={{ flex:1, marginRight:10 }} theme='h1'>{active_competitions.length}
|
|
67
|
+
<Text style={{ flex:1, marginRight:10 }} theme='h1'>{active_competitions.length} Competitions</Text>
|
|
68
68
|
<Icons.ChevronIcon direction={visible?'up':'down'} color={Colors.text.h1} size={8} />
|
|
69
69
|
</Button>
|
|
70
70
|
{visible ?
|
package/src/types.d.ts
CHANGED