be-components 5.0.8 → 5.0.9
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/BracketPlay/index.js +9 -2
- package/lib/commonjs/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/commonjs/Bracket/index.js +10 -0
- package/lib/commonjs/Bracket/index.js.map +1 -1
- package/lib/commonjs/Campaign/api/index.js +105 -0
- package/lib/commonjs/Campaign/api/index.js.map +1 -0
- package/lib/commonjs/Campaign/components/ActionList.js +96 -0
- package/lib/commonjs/Campaign/components/ActionList.js.map +1 -0
- package/lib/commonjs/Campaign/components/AnalyticsCard.js +42 -0
- package/lib/commonjs/Campaign/components/AnalyticsCard.js.map +1 -0
- package/lib/commonjs/Campaign/components/AutoManager.js +101 -0
- package/lib/commonjs/Campaign/components/AutoManager.js.map +1 -0
- package/lib/commonjs/Campaign/components/BetAlert.js +176 -0
- package/lib/commonjs/Campaign/components/BetAlert.js.map +1 -0
- package/lib/commonjs/Campaign/components/CampaignAnalytics.js +51 -0
- package/lib/commonjs/Campaign/components/CampaignAnalytics.js.map +1 -0
- package/lib/commonjs/Campaign/components/ParticipantCard.js +135 -0
- package/lib/commonjs/Campaign/components/ParticipantCard.js.map +1 -0
- package/lib/commonjs/Campaign/components/ParticipantsList.js +117 -0
- package/lib/commonjs/Campaign/components/ParticipantsList.js.map +1 -0
- package/lib/commonjs/Campaign/components/ProgressTimer.js +50 -0
- package/lib/commonjs/Campaign/components/ProgressTimer.js.map +1 -0
- package/lib/commonjs/Campaign/index.js +440 -0
- package/lib/commonjs/Campaign/index.js.map +1 -0
- package/lib/commonjs/Components/ConfirmationModal.js +32 -3
- package/lib/commonjs/Components/ConfirmationModal.js.map +1 -1
- package/lib/commonjs/Components/Icons.js +49 -0
- package/lib/commonjs/Components/Icons.js.map +1 -1
- package/lib/commonjs/Components/ProgressBar.js +94 -0
- package/lib/commonjs/Components/ProgressBar.js.map +1 -0
- package/lib/commonjs/Components/index.js +7 -0
- package/lib/commonjs/Components/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/api/index.js +17 -0
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/commonjs/SocialComponents/api/index.js +3 -0
- package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
- package/lib/commonjs/Ticker/components/TradeText.js +82 -0
- package/lib/commonjs/Ticker/components/TradeText.js.map +1 -0
- package/lib/commonjs/Ticker/index.js +254 -0
- package/lib/commonjs/Ticker/index.js.map +1 -0
- package/lib/commonjs/constants/useColors.js +2 -2
- package/lib/commonjs/constants/useColors.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/Bracket/components/BracketPlay/index.js +9 -2
- package/lib/module/Bracket/components/BracketPlay/index.js.map +1 -1
- package/lib/module/Bracket/index.js +10 -0
- package/lib/module/Bracket/index.js.map +1 -1
- package/lib/module/Campaign/api/index.js +99 -0
- package/lib/module/Campaign/api/index.js.map +1 -0
- package/lib/module/Campaign/components/ActionList.js +89 -0
- package/lib/module/Campaign/components/ActionList.js.map +1 -0
- package/lib/module/Campaign/components/AnalyticsCard.js +35 -0
- package/lib/module/Campaign/components/AnalyticsCard.js.map +1 -0
- package/lib/module/Campaign/components/AutoManager.js +92 -0
- package/lib/module/Campaign/components/AutoManager.js.map +1 -0
- package/lib/module/Campaign/components/BetAlert.js +169 -0
- package/lib/module/Campaign/components/BetAlert.js.map +1 -0
- package/lib/module/Campaign/components/CampaignAnalytics.js +42 -0
- package/lib/module/Campaign/components/CampaignAnalytics.js.map +1 -0
- package/lib/module/Campaign/components/ParticipantCard.js +128 -0
- package/lib/module/Campaign/components/ParticipantCard.js.map +1 -0
- package/lib/module/Campaign/components/ParticipantsList.js +108 -0
- package/lib/module/Campaign/components/ParticipantsList.js.map +1 -0
- package/lib/module/Campaign/components/ProgressTimer.js +43 -0
- package/lib/module/Campaign/components/ProgressTimer.js.map +1 -0
- package/lib/module/Campaign/index.js +431 -0
- package/lib/module/Campaign/index.js.map +1 -0
- package/lib/module/Components/ConfirmationModal.js +31 -4
- package/lib/module/Components/ConfirmationModal.js.map +1 -1
- package/lib/module/Components/Icons.js +49 -0
- package/lib/module/Components/Icons.js.map +1 -1
- package/lib/module/Components/ProgressBar.js +86 -0
- package/lib/module/Components/ProgressBar.js.map +1 -0
- package/lib/module/Components/index.js +2 -1
- package/lib/module/Components/index.js.map +1 -1
- package/lib/module/MarketComponents/api/index.js +17 -0
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/module/SocialComponents/api/index.js +2 -0
- package/lib/module/SocialComponents/api/index.js.map +1 -1
- package/lib/module/Ticker/components/TradeText.js +74 -0
- package/lib/module/Ticker/components/TradeText.js.map +1 -0
- package/lib/module/Ticker/index.js +245 -0
- package/lib/module/Ticker/index.js.map +1 -0
- package/lib/module/constants/useColors.js +2 -2
- package/lib/module/constants/useColors.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Campaign/api/index.d.ts +30 -0
- package/lib/typescript/lib/commonjs/Campaign/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ActionList.d.ts +8 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ActionList.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/AnalyticsCard.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Campaign/components/AnalyticsCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/AutoManager.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Campaign/components/AutoManager.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/BetAlert.d.ts +12 -0
- package/lib/typescript/lib/commonjs/Campaign/components/BetAlert.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/CampaignAnalytics.d.ts +6 -0
- package/lib/typescript/lib/commonjs/Campaign/components/CampaignAnalytics.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantCard.d.ts +10 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantsList.d.ts +11 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ParticipantsList.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ProgressTimer.d.ts +8 -0
- package/lib/typescript/lib/commonjs/Campaign/components/ProgressTimer.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Campaign/index.d.ts +14 -0
- package/lib/typescript/lib/commonjs/Campaign/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/ConfirmationModal.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Components/ConfirmationModal.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/ProgressBar.d.ts +15 -0
- package/lib/typescript/lib/commonjs/Components/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/index.d.ts +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Ticker/components/TradeText.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Ticker/components/TradeText.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Ticker/index.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Ticker/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/constants/useColors.d.ts +1 -1
- package/lib/typescript/lib/commonjs/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts +2 -1
- package/lib/typescript/lib/module/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Campaign/api/index.d.ts +29 -0
- package/lib/typescript/lib/module/Campaign/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ActionList.d.ts +8 -0
- package/lib/typescript/lib/module/Campaign/components/ActionList.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/AnalyticsCard.d.ts +9 -0
- package/lib/typescript/lib/module/Campaign/components/AnalyticsCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/AutoManager.d.ts +12 -0
- package/lib/typescript/lib/module/Campaign/components/AutoManager.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/BetAlert.d.ts +22 -0
- package/lib/typescript/lib/module/Campaign/components/BetAlert.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/CampaignAnalytics.d.ts +6 -0
- package/lib/typescript/lib/module/Campaign/components/CampaignAnalytics.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantCard.d.ts +10 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantsList.d.ts +11 -0
- package/lib/typescript/lib/module/Campaign/components/ParticipantsList.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/components/ProgressTimer.d.ts +10 -0
- package/lib/typescript/lib/module/Campaign/components/ProgressTimer.d.ts.map +1 -0
- package/lib/typescript/lib/module/Campaign/index.d.ts +14 -0
- package/lib/typescript/lib/module/Campaign/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/ConfirmationModal.d.ts +2 -1
- package/lib/typescript/lib/module/Components/ConfirmationModal.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Icons.d.ts +5 -0
- package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/ProgressBar.d.ts +16 -0
- package/lib/typescript/lib/module/Components/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/index.d.ts +2 -1
- package/lib/typescript/lib/module/Components/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/LocationTracker/api/index.d.ts +2 -2
- package/lib/typescript/lib/module/LocationTracker/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts +2 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Ticker/components/TradeText.d.ts +10 -0
- package/lib/typescript/lib/module/Ticker/components/TradeText.d.ts.map +1 -0
- package/lib/typescript/lib/module/Ticker/index.d.ts +9 -0
- package/lib/typescript/lib/module/Ticker/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/constants/useColors.d.ts +1 -1
- package/lib/typescript/lib/module/index.d.ts +3 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/components/BracketPlay/index.d.ts.map +1 -1
- package/lib/typescript/src/Bracket/index.d.ts +3 -2
- package/lib/typescript/src/Bracket/index.d.ts.map +1 -1
- package/lib/typescript/src/Campaign/api/index.d.ts +24 -0
- package/lib/typescript/src/Campaign/api/index.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ActionList.d.ts +10 -0
- package/lib/typescript/src/Campaign/components/ActionList.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/AnalyticsCard.d.ts +10 -0
- package/lib/typescript/src/Campaign/components/AnalyticsCard.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/AutoManager.d.ts +16 -0
- package/lib/typescript/src/Campaign/components/AutoManager.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/BetAlert.d.ts +14 -0
- package/lib/typescript/src/Campaign/components/BetAlert.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/CampaignAnalytics.d.ts +7 -0
- package/lib/typescript/src/Campaign/components/CampaignAnalytics.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ParticipantCard.d.ts +12 -0
- package/lib/typescript/src/Campaign/components/ParticipantCard.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ParticipantsList.d.ts +13 -0
- package/lib/typescript/src/Campaign/components/ParticipantsList.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/components/ProgressTimer.d.ts +10 -0
- package/lib/typescript/src/Campaign/components/ProgressTimer.d.ts.map +1 -0
- package/lib/typescript/src/Campaign/index.d.ts +24 -0
- package/lib/typescript/src/Campaign/index.d.ts.map +1 -0
- package/lib/typescript/src/Components/ConfirmationModal.d.ts +2 -1
- package/lib/typescript/src/Components/ConfirmationModal.d.ts.map +1 -1
- package/lib/typescript/src/Components/Icons.d.ts +1 -0
- package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
- package/lib/typescript/src/Components/ProgressBar.d.ts +19 -0
- package/lib/typescript/src/Components/ProgressBar.d.ts.map +1 -0
- package/lib/typescript/src/Components/index.d.ts +2 -1
- package/lib/typescript/src/Components/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts +2 -0
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/Ticker/components/TradeText.d.ts +11 -0
- package/lib/typescript/src/Ticker/components/TradeText.d.ts.map +1 -0
- package/lib/typescript/src/Ticker/index.d.ts +11 -0
- package/lib/typescript/src/Ticker/index.d.ts.map +1 -0
- package/lib/typescript/src/constants/useColors.d.ts +5 -1
- package/lib/typescript/src/constants/useColors.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/Bracket/components/BracketPlay/index.tsx +10 -1
- package/src/Bracket/index.tsx +12 -3
- package/src/Campaign/api/index.ts +92 -0
- package/src/Campaign/components/ActionList.tsx +64 -0
- package/src/Campaign/components/AnalyticsCard.tsx +29 -0
- package/src/Campaign/components/AutoManager.tsx +88 -0
- package/src/Campaign/components/BetAlert.tsx +111 -0
- package/src/Campaign/components/CampaignAnalytics.tsx +54 -0
- package/src/Campaign/components/ParticipantCard.tsx +78 -0
- package/src/Campaign/components/ParticipantsList.tsx +69 -0
- package/src/Campaign/components/ProgressTimer.tsx +47 -0
- package/src/Campaign/index.tsx +377 -0
- package/src/Components/ConfirmationModal.tsx +22 -5
- package/src/Components/Icons.tsx +19 -0
- package/src/Components/ProgressBar.tsx +54 -0
- package/src/Components/index.tsx +2 -1
- package/src/MarketComponents/api/index.ts +17 -0
- package/src/SocialComponents/api/index.ts +2 -1
- package/src/Ticker/components/TradeText.tsx +55 -0
- package/src/Ticker/index.tsx +202 -0
- package/src/constants/useColors.tsx +5 -3
- package/src/index.tsx +5 -0
- package/src/types.d.ts +60 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Button, Text, View } from "../../Components/Themed"
|
|
3
|
+
import type { CampaignParticipantProps, PublicPlayerProps } from "../../types"
|
|
4
|
+
import { FlatList, Image } from 'react-native';
|
|
5
|
+
import { useColors } from '../../constants/useColors';
|
|
6
|
+
import moment from 'moment-mini';
|
|
7
|
+
|
|
8
|
+
type CampaignParticipantListProps = {
|
|
9
|
+
campaign_participants:CampaignParticipantProps[],
|
|
10
|
+
players:PublicPlayerProps[],
|
|
11
|
+
selected_participant?:string,
|
|
12
|
+
horizontal?:boolean,
|
|
13
|
+
onSelect:(cp:CampaignParticipantProps) => void,
|
|
14
|
+
onDeselect: (cp:CampaignParticipantProps) => void
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const ParticipantsList = ({ campaign_participants, players, selected_participant, horizontal, onSelect, onDeselect }:CampaignParticipantListProps) => {
|
|
19
|
+
const [ participant_page ] = useState(1);
|
|
20
|
+
const Colors = useColors();
|
|
21
|
+
const visible_participants = campaign_participants.sort((a,b) => a.status.localeCompare(b.status) || moment(b.create_datetime).unix() - moment(a.create_datetime).unix()).slice((participant_page-1) * 5, ((participant_page-1) * 5) + 5)
|
|
22
|
+
|
|
23
|
+
const renderParticipants = (data:{ item:CampaignParticipantProps, index:number }) => {
|
|
24
|
+
const player = players.find(p => p.player_id == data.item.player_id);
|
|
25
|
+
const active = data.item.status == 'active' ? true : false
|
|
26
|
+
if(!player){ return <></> }
|
|
27
|
+
const selected = data.item.campaign_participant_id == selected_participant ? true : false
|
|
28
|
+
return (
|
|
29
|
+
<Button float
|
|
30
|
+
style={{ flexDirection:horizontal?'column':'row', alignItems:'center', borderRadius:100, margin:8, padding:2, borderWidth:selected || active?2:0, borderColor:selected?Colors.text.action:active?Colors.text.success:'transparent' }}
|
|
31
|
+
onPress={() => selected ? onDeselect(data.item) : onSelect(data.item)}>
|
|
32
|
+
<Image
|
|
33
|
+
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
34
|
+
style={{ height:50, width:50, borderRadius:100 }}
|
|
35
|
+
/>
|
|
36
|
+
{!horizontal ?
|
|
37
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
38
|
+
<Text theme='h2'>@{player.username}</Text>
|
|
39
|
+
<Text style={{ marginTop:3 }} theme='description'>Visited {moment(data.item.last_update_datetime).fromNow()}</Text>
|
|
40
|
+
</View>
|
|
41
|
+
:<></>}
|
|
42
|
+
</Button>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<View type='header' style={{ flex:1 }}>
|
|
48
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
49
|
+
<View transparent style={{ flex:1, marginRight:10 }}>
|
|
50
|
+
<Text theme='h1'>Participants</Text>
|
|
51
|
+
<Text theme='description' style={{ marginTop:4 }}>Check out who is participating here!</Text>
|
|
52
|
+
</View>
|
|
53
|
+
<View transparent style={{ justifyContent:'center', alignItems:'center' }}>
|
|
54
|
+
<Text theme='h1' color={Colors.text.action}>{campaign_participants.length}</Text>
|
|
55
|
+
<Text theme='description' style={{ marginTop:3 }}>Participants</Text>
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
<FlatList
|
|
59
|
+
data={visible_participants}
|
|
60
|
+
renderItem={renderParticipants}
|
|
61
|
+
horizontal={horizontal}
|
|
62
|
+
key={'campaign_particpant_list'}
|
|
63
|
+
keyExtractor={(item) => item.campaign_participant_id.toString()}
|
|
64
|
+
/>
|
|
65
|
+
</View>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default ParticipantsList
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { ProgressBar } from "../../Components";
|
|
4
|
+
import { useColors } from "../../constants/useColors";
|
|
5
|
+
|
|
6
|
+
type ProgressTimerProps = {
|
|
7
|
+
total_time:number,
|
|
8
|
+
time_id:string,
|
|
9
|
+
update_multiplier?: number
|
|
10
|
+
onTimesUp:() => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const ProgressTimer = ({total_time, time_id, onTimesUp}:ProgressTimerProps) => {
|
|
14
|
+
const Colors = useColors();
|
|
15
|
+
const [ started, setStarted ] = useState(false);
|
|
16
|
+
const [ seconds_remaining, setSecondsRemaining ] = useState(0);
|
|
17
|
+
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if(!time_id){ return }
|
|
20
|
+
setSecondsRemaining(total_time);
|
|
21
|
+
setStarted(true);
|
|
22
|
+
},[time_id])
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if(!started){ return }
|
|
26
|
+
if(seconds_remaining > 0){
|
|
27
|
+
setTimeout(() => setSecondsRemaining(seconds_remaining - 1), 1000);
|
|
28
|
+
} else {
|
|
29
|
+
onTimesUp();
|
|
30
|
+
setStarted(false);
|
|
31
|
+
}
|
|
32
|
+
},[seconds_remaining])
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
if(seconds_remaining == 0){ return <></> }
|
|
36
|
+
return (
|
|
37
|
+
<ProgressBar
|
|
38
|
+
max_value={total_time}
|
|
39
|
+
hide_labels
|
|
40
|
+
current_value={seconds_remaining}
|
|
41
|
+
background_color={Colors.views.background}
|
|
42
|
+
fill_color={Colors.text.action}
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default ProgressTimer
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { FlatList, Image, useWindowDimensions } from "react-native"
|
|
3
|
+
import { Button, Text, View } from '../../src/Components/Themed';
|
|
4
|
+
import type { AthleteProps, CampaignParticipantProps, CampaignProps, EventProps, MarketProps, OrderAnalyticsProps, OrderProps, PublicPlayerProps, TeamProps } from '../../src/types';
|
|
5
|
+
import { CampaignApi, CampaignHelpers } from '../../src/Campaign/api';
|
|
6
|
+
|
|
7
|
+
import { MarketComponentApi } from '../../src/MarketComponents/api';
|
|
8
|
+
import { useColors } from '../../src/constants/useColors';
|
|
9
|
+
import moment from 'moment-mini';
|
|
10
|
+
import QRCode from 'react-qr-code';
|
|
11
|
+
import TickerApp from '../Ticker';
|
|
12
|
+
import BetAlert from './components/BetAlert';
|
|
13
|
+
import ParticipantsList from './components/ParticipantsList';
|
|
14
|
+
import ParticipantCard from './components/ParticipantCard';
|
|
15
|
+
import CampaignAnalytics from './components/CampaignAnalytics';
|
|
16
|
+
import AutoManager from './components/AutoManager';
|
|
17
|
+
|
|
18
|
+
type CampaignAppProps = {
|
|
19
|
+
player_id?:string,
|
|
20
|
+
campaign_id:string,
|
|
21
|
+
distinct_id:string,
|
|
22
|
+
color_mode?:'light'|'dark',
|
|
23
|
+
action_loading?:boolean,
|
|
24
|
+
insets?:{ bottom:number, top:number, left:number, right:number },
|
|
25
|
+
onBetNow?:() => void,
|
|
26
|
+
onViewProfile?:(player:PublicPlayerProps) => void,
|
|
27
|
+
onH2HChallenge?:(player:PublicPlayerProps) => void,
|
|
28
|
+
onCheckIn?:() => void,
|
|
29
|
+
my_participant?:CampaignParticipantProps
|
|
30
|
+
auto?:boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const HEADER_HEIGHT = 75
|
|
34
|
+
|
|
35
|
+
const Campaign = ({ campaign_id, insets, color_mode, auto, distinct_id, my_participant, action_loading, onCheckIn, onBetNow }:CampaignAppProps) => {
|
|
36
|
+
const Colors = useColors();
|
|
37
|
+
const [ new_bet_alert, setNewBetAlert ] = useState<OrderProps | undefined>(undefined);
|
|
38
|
+
//const [ refresh, setRefresh ] = useState(0);
|
|
39
|
+
const [ cta_type, setCTAType ] = useState<'ad'|'participant'>('participant');
|
|
40
|
+
const [ selected_ad, setSelectedAd ] = useState<any>(undefined);
|
|
41
|
+
const { width, height } = useWindowDimensions();
|
|
42
|
+
const time_options = CampaignHelpers.getTimeOptions();
|
|
43
|
+
const participants_location = width > 1200 ? 'left' : 'top';
|
|
44
|
+
//const ad_location = width > 1200 ? 'right': 'bottom';
|
|
45
|
+
const ticker_visible = width > 1200 ? true : false
|
|
46
|
+
|
|
47
|
+
const [ selected_participant, setSelectedParticipant ] = useState<CampaignParticipantProps|undefined>(undefined);
|
|
48
|
+
const [ new_event, setNewEvent ] = useState<EventProps|undefined>(undefined);
|
|
49
|
+
const [ analytics, setAnalytics ] = useState<OrderAnalyticsProps[]>([]);
|
|
50
|
+
const [ embed_state, setEmbedState ] = useState<{
|
|
51
|
+
loading:boolean,
|
|
52
|
+
campaign?:CampaignProps,
|
|
53
|
+
participant_page:number,
|
|
54
|
+
action_page:number,
|
|
55
|
+
campaign_participants:CampaignParticipantProps[],
|
|
56
|
+
teams:TeamProps[],
|
|
57
|
+
athletes:AthleteProps[],
|
|
58
|
+
markets:MarketProps[],
|
|
59
|
+
orders:OrderProps[],
|
|
60
|
+
events:EventProps[],
|
|
61
|
+
players:PublicPlayerProps[]
|
|
62
|
+
}>({
|
|
63
|
+
loading:false,
|
|
64
|
+
campaign_participants:[],
|
|
65
|
+
events:[],
|
|
66
|
+
athletes:[],
|
|
67
|
+
participant_page: 0,
|
|
68
|
+
markets:[],
|
|
69
|
+
action_page:0,
|
|
70
|
+
orders:[],
|
|
71
|
+
players:[],
|
|
72
|
+
teams:[]
|
|
73
|
+
});
|
|
74
|
+
const { orders, events, athletes, campaign, participant_page, action_page, campaign_participants, players, teams, } = embed_state;
|
|
75
|
+
//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
|
+
useEffect(() => {
|
|
78
|
+
if(!campaign_id){ return }
|
|
79
|
+
startUp(campaign_id);
|
|
80
|
+
},[campaign_id]);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if(!new_event){ return }
|
|
85
|
+
setEmbedState({
|
|
86
|
+
...embed_state,
|
|
87
|
+
events: events.filter(e => e.event_id != new_event.event_id).concat(new_event)
|
|
88
|
+
})
|
|
89
|
+
setNewEvent(undefined);
|
|
90
|
+
},[new_event])
|
|
91
|
+
|
|
92
|
+
const startUp = async(campaign_id:string) => {
|
|
93
|
+
CampaignApi.setEnvironment();
|
|
94
|
+
MarketComponentApi.setEnvironment();
|
|
95
|
+
getData(campaign_id, false)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const handleLoadAnalytics = async(option?:{ label:string, to:number, from:number }) => {
|
|
99
|
+
if(!option){ return }
|
|
100
|
+
const analytics = await CampaignApi.getCampaignAnalytics(campaign_id, option.to, option.from);
|
|
101
|
+
setAnalytics(analytics);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const getData = async(campaign_id:string, check_bets?:boolean) => {
|
|
105
|
+
setEmbedState({ ...embed_state, loading:true });
|
|
106
|
+
const c_resp = await CampaignApi.getCampaignById(campaign_id);
|
|
107
|
+
const pls = await CampaignApi.getPlayersByPlayerIds(c_resp.campaign_participants.map(p => p.player_id));
|
|
108
|
+
let tm_ids = c_resp.campaign_participants.map(cp => cp.payload?.team_id)
|
|
109
|
+
let aths_ids = c_resp.campaign_participants.map(cp => cp.payload?.athlete_id);
|
|
110
|
+
const ords = await CampaignApi.getCampaignAction(campaign_id);
|
|
111
|
+
let vis_ords = [ ...ords ]
|
|
112
|
+
let ev_ids = ords.filter(o => o.event_type == 'team').map(o => o.event_id);
|
|
113
|
+
const action_pages = Math.ceil(vis_ords.length / 5);
|
|
114
|
+
const participant_pages = Math.ceil(c_resp.campaign_participants.length / 5);
|
|
115
|
+
let next_participant_page = participant_page + 1
|
|
116
|
+
if(next_participant_page > participant_pages){ next_participant_page = 1 }
|
|
117
|
+
|
|
118
|
+
let next_action_page = action_page + 1
|
|
119
|
+
if(next_action_page > action_pages){ next_action_page = 1 }
|
|
120
|
+
handleLoadAnalytics(time_options[0]);
|
|
121
|
+
if(check_bets){
|
|
122
|
+
let new_bet = vis_ords.find(o => !orders.map(old_o => old_o.order_id.toString()).includes(o.order_id.toString()))
|
|
123
|
+
if(new_bet){
|
|
124
|
+
setNewBetAlert(new_bet);
|
|
125
|
+
if(new_bet.event_type == 'team'){ ev_ids.push(new_bet.event_id) }
|
|
126
|
+
if(new_bet.side_type == 'team'){ tm_ids.push(new_bet.side_id) }
|
|
127
|
+
if(new_bet.side_type == 'athlete'){ aths_ids.push(new_bet.side_id) }
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const evs = await MarketComponentApi.getEventsByEventIds(ords.filter(o => o.event_type == 'team').map(o => o.event_id));
|
|
132
|
+
const tms = await MarketComponentApi.getTeamsByIds(tm_ids);
|
|
133
|
+
const aths = await MarketComponentApi.getAthletesByIds(aths_ids);
|
|
134
|
+
|
|
135
|
+
setEmbedState({
|
|
136
|
+
...embed_state,
|
|
137
|
+
players:pls,
|
|
138
|
+
campaign: c_resp.campaign,
|
|
139
|
+
campaign_participants: c_resp.campaign_participants,
|
|
140
|
+
teams: tms,
|
|
141
|
+
athletes: aths,
|
|
142
|
+
participant_page: next_participant_page,
|
|
143
|
+
action_page: next_action_page,
|
|
144
|
+
events: evs,
|
|
145
|
+
orders: vis_ords,
|
|
146
|
+
loading:false
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const renderSections = (data:{ item:string, index:number }) => {
|
|
152
|
+
switch(data.item){
|
|
153
|
+
case 'ticker':
|
|
154
|
+
if(!ticker_visible){ return <></> }
|
|
155
|
+
return (
|
|
156
|
+
<TickerApp
|
|
157
|
+
league_ids={campaign?.league_ids ?? []}
|
|
158
|
+
distinct_id={distinct_id}
|
|
159
|
+
color_mode={color_mode}
|
|
160
|
+
onOrders={async(orders) => {
|
|
161
|
+
//find if the orders are new!
|
|
162
|
+
let new_bet = orders.find(o => o.campaign_id && moment().diff(moment(o.create_datetime), 'milliseconds') < 5000);
|
|
163
|
+
if(new_bet){
|
|
164
|
+
let og_bet = await MarketComponentApi.getOrderById(new_bet.order_id);
|
|
165
|
+
if(!og_bet){ return }
|
|
166
|
+
let ev = events.find(e => e.event_id == og_bet.event_id);
|
|
167
|
+
if(!ev){
|
|
168
|
+
let evs = await MarketComponentApi.getEventsByEventIds([new_bet.event_id]);
|
|
169
|
+
setNewEvent(evs[0])
|
|
170
|
+
}
|
|
171
|
+
setNewBetAlert(og_bet)
|
|
172
|
+
}
|
|
173
|
+
}}
|
|
174
|
+
/>
|
|
175
|
+
)
|
|
176
|
+
case 'participant':
|
|
177
|
+
if(participants_location == 'left'){ return <></> }
|
|
178
|
+
if(!selected_participant){ return <></> }
|
|
179
|
+
const player = players.find(p => p.player_id == selected_participant.player_id)
|
|
180
|
+
if(!player){ return <></> }
|
|
181
|
+
return (
|
|
182
|
+
<ParticipantCard
|
|
183
|
+
campaign_participant={selected_participant}
|
|
184
|
+
player={player}
|
|
185
|
+
analytics={analytics.filter(a => a.player_id == player.player_id)}
|
|
186
|
+
orders={orders.filter(o => o.player_id == player.player_id)}
|
|
187
|
+
events={events}
|
|
188
|
+
/>
|
|
189
|
+
)
|
|
190
|
+
default: return <></>
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
const renderParticipants = (data: { item:CampaignParticipantProps, index:number }) => {
|
|
196
|
+
const player = players.find(p => p.player_id == data.item.player_id);
|
|
197
|
+
if(!player){ return <></> }
|
|
198
|
+
const team = teams.find(t => t.team_id == data.item.payload?.team_id);
|
|
199
|
+
return (
|
|
200
|
+
<View float style={{ margin:5, padding:5, borderRadius:100}}>
|
|
201
|
+
<View transparent style={{ flexDirection:'row' }}>
|
|
202
|
+
<Image
|
|
203
|
+
source={{ uri: player.profile_pic && player.profile_pic != '' ? player.profile_pic : 'https://res.cloudinary.com/hoabts6mc/image/upload/v1722453927/default_man_n96ofq.webp' }}
|
|
204
|
+
style={{ height:35, width:35, borderRadius:100 }}
|
|
205
|
+
resizeMode='cover'
|
|
206
|
+
/>
|
|
207
|
+
<View transparent style={{ flex:1, marginLeft:10 }}>
|
|
208
|
+
<Text theme='h2'>@{player.username}</Text>
|
|
209
|
+
<Text theme='description' style={{ marginTop:3 }}>Arrived @ {moment(data.item.create_datetime).format('MMM DD hh:mm a')}</Text>
|
|
210
|
+
</View>
|
|
211
|
+
{team ?
|
|
212
|
+
<Image
|
|
213
|
+
source={{ uri: team.image?.url }}
|
|
214
|
+
style={{ height:35, width:35, borderRadius:100 }}
|
|
215
|
+
resizeMode='cover'
|
|
216
|
+
/>
|
|
217
|
+
:<></>}
|
|
218
|
+
</View>
|
|
219
|
+
</View>
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
const new_bet_player = players.find(p => p.player_id == new_bet_alert?.player_id);
|
|
226
|
+
const new_bet_team = teams.find(t => t.team_id == new_bet_alert?.side_id);
|
|
227
|
+
const new_bet_athlete = athletes.find(a => a.athlete_id == new_bet_alert?.side_id);
|
|
228
|
+
const new_bet_event = events.find(e => e.event_id == new_bet_alert?.event_id);
|
|
229
|
+
//const new_bet_market = markets.find(m => m.market_id == new_bet_alert?.market_id);
|
|
230
|
+
|
|
231
|
+
const selected_player = players.find(p => p.player_id == selected_participant?.player_id);
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
<View style={{ flex:1 }}>
|
|
235
|
+
{campaign ?
|
|
236
|
+
<View type='header' style={{ height:HEADER_HEIGHT, padding:10, paddingLeft:20, paddingRight:20, flexDirection:'row', alignItems:'center', borderBottomWidth:1, borderColor:Colors.borders.light }}>
|
|
237
|
+
<Image
|
|
238
|
+
source={{ uri: campaign.campaign_image?.url }}
|
|
239
|
+
style={{ height:55, width:55 }}
|
|
240
|
+
resizeMode='cover'
|
|
241
|
+
/>
|
|
242
|
+
<View transparent style={{ flex:1, marginLeft:20 }}>
|
|
243
|
+
<Text theme='h1' size={18}>{campaign.campaign_name}</Text>
|
|
244
|
+
<Text theme='description' style={{ marginTop:4 }}>{campaign.description}</Text>
|
|
245
|
+
</View>
|
|
246
|
+
<View transparent style={{ width:250 }}>
|
|
247
|
+
<AutoManager
|
|
248
|
+
campaign_participants={campaign_participants}
|
|
249
|
+
orders={orders}
|
|
250
|
+
campaign={campaign}
|
|
251
|
+
active={auto ? true : false}
|
|
252
|
+
analytics={analytics}
|
|
253
|
+
onChangeAd={(ad) => {
|
|
254
|
+
setCTAType('ad');
|
|
255
|
+
setSelectedAd(ad);
|
|
256
|
+
}}
|
|
257
|
+
onChangeParticipant={(cp) => {
|
|
258
|
+
setCTAType('participant');
|
|
259
|
+
setSelectedParticipant(cp)
|
|
260
|
+
}}
|
|
261
|
+
/>
|
|
262
|
+
</View>
|
|
263
|
+
</View>
|
|
264
|
+
:<></>}
|
|
265
|
+
|
|
266
|
+
<CampaignAnalytics
|
|
267
|
+
campaign_id={campaign_id}
|
|
268
|
+
/>
|
|
269
|
+
{participants_location == 'top' ?
|
|
270
|
+
<View style={{ borderRightWidth:1, borderColor:Colors.borders.light }}>
|
|
271
|
+
<ParticipantsList
|
|
272
|
+
campaign_participants={campaign_participants}
|
|
273
|
+
players={players}
|
|
274
|
+
selected_participant={selected_participant?.campaign_participant_id}
|
|
275
|
+
horizontal
|
|
276
|
+
onDeselect={() => setSelectedParticipant(undefined)}
|
|
277
|
+
onSelect={(cp) => setSelectedParticipant(cp)}
|
|
278
|
+
/>
|
|
279
|
+
</View>
|
|
280
|
+
:<></>}
|
|
281
|
+
<View style={{ flex:1, flexDirection:'row' }}>
|
|
282
|
+
{participants_location == 'left' ?
|
|
283
|
+
<View transparent style={{ width:400 }}>
|
|
284
|
+
<ParticipantsList
|
|
285
|
+
campaign_participants={campaign_participants}
|
|
286
|
+
players={players}
|
|
287
|
+
selected_participant={selected_participant?.campaign_participant_id}
|
|
288
|
+
onSelect={(cp) => setSelectedParticipant(cp)}
|
|
289
|
+
onDeselect={() => setSelectedParticipant(undefined)}
|
|
290
|
+
/>
|
|
291
|
+
<View type='header' style={{ padding:20, justifyContent:'center', alignItems:'center' }}>
|
|
292
|
+
<Text theme='h1' style={{ marginBottom:20 }}>SCAN TO CHECK IN NOW</Text>
|
|
293
|
+
<QRCode
|
|
294
|
+
size={250}
|
|
295
|
+
value={`https://play.bettoredge.com/social/campaign/${campaign_id}`}
|
|
296
|
+
|
|
297
|
+
/>
|
|
298
|
+
</View>
|
|
299
|
+
</View>
|
|
300
|
+
:<></>}
|
|
301
|
+
<View style={{ flex:1, height:height - HEADER_HEIGHT }}>
|
|
302
|
+
<FlatList
|
|
303
|
+
data={['ticker','participant']}
|
|
304
|
+
key={'list_items'}
|
|
305
|
+
showsVerticalScrollIndicator={false}
|
|
306
|
+
keyExtractor={item => item}
|
|
307
|
+
renderItem={renderSections}
|
|
308
|
+
/>
|
|
309
|
+
</View>
|
|
310
|
+
|
|
311
|
+
{campaign && participants_location == 'left' ?
|
|
312
|
+
<View type='header' style={{ width:400, height:height - HEADER_HEIGHT }}>
|
|
313
|
+
{cta_type == 'participant' && selected_player && selected_participant ?
|
|
314
|
+
<ParticipantCard
|
|
315
|
+
campaign_participant={selected_participant}
|
|
316
|
+
player={selected_player}
|
|
317
|
+
events={events}
|
|
318
|
+
analytics={analytics.filter(a => a.player_id == selected_participant.player_id)}
|
|
319
|
+
orders={orders.filter(o => o.player_id == selected_participant.player_id)}
|
|
320
|
+
/>
|
|
321
|
+
:cta_type == 'ad' && selected_ad?.url ?
|
|
322
|
+
<View transparent>
|
|
323
|
+
<Image
|
|
324
|
+
source={{ uri: selected_ad.url }}
|
|
325
|
+
style={{ width: (height-HEADER_HEIGHT) * 0.2857, height:height - HEADER_HEIGHT, alignSelf:'center'}}
|
|
326
|
+
resizeMode='contain'
|
|
327
|
+
/>
|
|
328
|
+
</View>
|
|
329
|
+
:<></>}
|
|
330
|
+
</View>
|
|
331
|
+
:<></>}
|
|
332
|
+
</View>
|
|
333
|
+
|
|
334
|
+
<View type='footer' style={{ flexDirection:'row', padding:10, paddingBottom:(insets?.bottom ?? 0) + 10}}>
|
|
335
|
+
{onBetNow ?
|
|
336
|
+
<Button
|
|
337
|
+
type='action'
|
|
338
|
+
style={{ flex:1, justifyContent:'center', marginRight:4 }}
|
|
339
|
+
title={'Bet Now!'}
|
|
340
|
+
onPress={() => onBetNow()}
|
|
341
|
+
/>
|
|
342
|
+
:<></>}
|
|
343
|
+
{my_participant?.status == 'active' ?
|
|
344
|
+
<Button
|
|
345
|
+
type='success'
|
|
346
|
+
style={{ flex:2, opacity:0.5, alignItems:'center' }}
|
|
347
|
+
title={'Checked In!'}
|
|
348
|
+
disabled
|
|
349
|
+
/>
|
|
350
|
+
: onCheckIn ?
|
|
351
|
+
<Button
|
|
352
|
+
type='success'
|
|
353
|
+
style={{ flex:2 }}
|
|
354
|
+
loading={action_loading}
|
|
355
|
+
disabled={action_loading}
|
|
356
|
+
title="Check In Now"
|
|
357
|
+
onPress={() => onCheckIn()}
|
|
358
|
+
/>
|
|
359
|
+
:<></>}
|
|
360
|
+
</View>
|
|
361
|
+
{new_bet_alert ?
|
|
362
|
+
<View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, alignItems:'center', paddingTop:100 }}>
|
|
363
|
+
<BetAlert
|
|
364
|
+
order={new_bet_alert}
|
|
365
|
+
event={new_bet_event}
|
|
366
|
+
player={new_bet_player}
|
|
367
|
+
team={new_bet_team}
|
|
368
|
+
athlete={new_bet_athlete}
|
|
369
|
+
onClose={() => setNewBetAlert(undefined)}
|
|
370
|
+
/>
|
|
371
|
+
</View>
|
|
372
|
+
:<></>}
|
|
373
|
+
</View>
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export default Campaign
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Image, Modal } from "react-native"
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Image, Linking, Modal } from "react-native"
|
|
3
3
|
import { Button, Text, View } from './Themed';
|
|
4
|
+
import Checkbox from './Checkbox';
|
|
5
|
+
import { useColors } from '../constants/useColors';
|
|
4
6
|
|
|
5
7
|
|
|
6
8
|
type ConfirmationModalProps = {
|
|
@@ -10,13 +12,15 @@ type ConfirmationModalProps = {
|
|
|
10
12
|
description?:string,
|
|
11
13
|
confirm_title?:string,
|
|
12
14
|
padding_bottom?:number,
|
|
15
|
+
opt_in_url?:string,
|
|
13
16
|
cancel_title?:string,
|
|
14
17
|
image?:string,
|
|
15
18
|
onCancel?: () => void,
|
|
16
19
|
onConfirm: () => void
|
|
17
20
|
}
|
|
18
|
-
const ConfirmationModal = ({ visible, mode, title, padding_bottom, image, description, confirm_title, cancel_title, onCancel, onConfirm }:ConfirmationModalProps) => {
|
|
19
|
-
|
|
21
|
+
const ConfirmationModal = ({ visible, mode, title, opt_in_url, padding_bottom, image, description, confirm_title, cancel_title, onCancel, onConfirm }:ConfirmationModalProps) => {
|
|
22
|
+
const [ opted_in, setOptedIn ] = useState(true);
|
|
23
|
+
const Colors = useColors();
|
|
20
24
|
return (
|
|
21
25
|
<Modal
|
|
22
26
|
visible={visible}
|
|
@@ -38,6 +42,18 @@ const ConfirmationModal = ({ visible, mode, title, padding_bottom, image, descri
|
|
|
38
42
|
:<></>}
|
|
39
43
|
<Text size={14} theme='h2' textAlign='center' weight='semibold'>{description}</Text>
|
|
40
44
|
</View>
|
|
45
|
+
{opt_in_url?
|
|
46
|
+
<View style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
|
|
47
|
+
<Checkbox
|
|
48
|
+
checked={opted_in}
|
|
49
|
+
color={Colors.text.action}
|
|
50
|
+
onSelect={() => setOptedIn(!opted_in)}
|
|
51
|
+
/>
|
|
52
|
+
<Button type='text' style={{ flex:1, marginLeft:5 }} onPress={() => Linking.openURL(opt_in_url)}>
|
|
53
|
+
<Text theme='description' color={Colors.text.action}>By confirming you are agreeing to the terms and conditions outlined here HERE</Text>
|
|
54
|
+
</Button>
|
|
55
|
+
</View>
|
|
56
|
+
:<></>}
|
|
41
57
|
<View type='footer' style={{ padding:10, flexDirection:'row' }}>
|
|
42
58
|
{onCancel?
|
|
43
59
|
<Button
|
|
@@ -49,7 +65,8 @@ const ConfirmationModal = ({ visible, mode, title, padding_bottom, image, descri
|
|
|
49
65
|
:<></>}
|
|
50
66
|
<Button
|
|
51
67
|
title={confirm_title ?? 'CONFIRM'}
|
|
52
|
-
style={{ flex:1, marginLeft:5 }}
|
|
68
|
+
style={{ flex:1, marginLeft:5, opacity:!opted_in && opt_in_url ? 0.5: 1 }}
|
|
69
|
+
disabled={opt_in_url && !opted_in ? true : false}
|
|
53
70
|
type='success'
|
|
54
71
|
onPress={() => onConfirm()}
|
|
55
72
|
/>
|
package/src/Components/Icons.tsx
CHANGED
|
@@ -1443,6 +1443,24 @@ const FilterIcon = ({ color, size }:IconProps) => {
|
|
|
1443
1443
|
)
|
|
1444
1444
|
}
|
|
1445
1445
|
|
|
1446
|
+
const BarstoolIcon = ({ color, size }:IconProps) => {
|
|
1447
|
+
const ratio = 0.718
|
|
1448
|
+
const height = size ?? 18
|
|
1449
|
+
const width = height * ratio
|
|
1450
|
+
return (
|
|
1451
|
+
<Svg width={`${width}px`} height={`${height}px`} viewBox="0 0 23 32">
|
|
1452
|
+
<G id="app-icons" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
1453
|
+
<G id="bar-chair-svgrepo-com" transform="translate(1.000000, 1.000000)" stroke={color ?? Colors.brand.midnight} stroke-width="2">
|
|
1454
|
+
<Path d="M0.0472499134,7.40626782 C-0.364035035,4.09285824 1.95287968,1.04649362 5.31310426,0.48252369 L5.90944418,0.382443702 C8.9476488,-0.127481234 12.0523484,-0.127481234 15.090598,0.382443702 L15.686848,0.48252369 C19.0471475,1.04649362 21.3640472,4.09285824 20.9527473,7.40626782 L20.9257473,7.6240978 C20.8282473,8.4094527 20.1472474,9 19.3391975,9 L1.66078471,9 C0.852704813,9 0.171779898,8.4094527 0.07429491,7.6240978 L0.0472499134,7.40626782 Z" id="Path"></Path>
|
|
1455
|
+
<Line x1="5.99999917" y1="9.00000262" x2="1.49999973" y2="30" id="Path" strokeLinecap="round"></Line>
|
|
1456
|
+
<Line x1="14.999998" y1="9.00000262" x2="19.4999975" y2="30" id="Path" strokeLinecap="round"></Line>
|
|
1457
|
+
<Line x1="17.9999977" y1="22.5000009" x2="2.99999954" y2="22.5000009" id="Path" strokeLinecap="round"></Line>
|
|
1458
|
+
</G>
|
|
1459
|
+
</G>
|
|
1460
|
+
</Svg>
|
|
1461
|
+
)
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1446
1464
|
|
|
1447
1465
|
|
|
1448
1466
|
export default {
|
|
@@ -1453,6 +1471,7 @@ export default {
|
|
|
1453
1471
|
//BetScopeSuccessIcon,
|
|
1454
1472
|
AlertIcon,
|
|
1455
1473
|
QuestionIcon,
|
|
1474
|
+
BarstoolIcon,
|
|
1456
1475
|
FilterIcon,
|
|
1457
1476
|
PieIcon,
|
|
1458
1477
|
BankIcon,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useColors } from '../constants/useColors';
|
|
4
|
+
import { Text } from './Themed';
|
|
5
|
+
|
|
6
|
+
type ProgressBarProps = {
|
|
7
|
+
hide_labels?:boolean,
|
|
8
|
+
height?:number,
|
|
9
|
+
max_value:number,
|
|
10
|
+
current_value:number,
|
|
11
|
+
background_color:string,
|
|
12
|
+
fill_color:string,
|
|
13
|
+
max_label?:string,
|
|
14
|
+
val_color?:string,
|
|
15
|
+
val_label?:string,
|
|
16
|
+
val_format?: {
|
|
17
|
+
loc: 'front'|'back',
|
|
18
|
+
label: string
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const ProgressBar = ({ max_value, val_format, val_color, current_value, height, hide_labels, background_color, fill_color, max_label, val_label }:ProgressBarProps) => {
|
|
23
|
+
const Colors = useColors();
|
|
24
|
+
const [ progressSize, setProgressSize ] = useState({ x:0, y:0, width:0, height:0 })
|
|
25
|
+
|
|
26
|
+
const getProgressWidth = (current_value:number) => {
|
|
27
|
+
let progress = current_value / max_value
|
|
28
|
+
if(progress > 1){ progress = 1 }
|
|
29
|
+
return progressSize.width * progress
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<View style={{ padding:10 }}>
|
|
35
|
+
<View style={{ flexDirection:'row' }}>
|
|
36
|
+
<View style={{ flex:1, padding:height??8, backgroundColor:background_color??Colors.views.header, borderRadius:4 }} onLayout={(ev) => {
|
|
37
|
+
const { x, y, width, height } = ev.nativeEvent.layout
|
|
38
|
+
setProgressSize({ x, y, width, height })
|
|
39
|
+
}}>
|
|
40
|
+
<View style={{ borderRadius:4, position:'absolute', backgroundColor:fill_color??Colors.text.h1, left:0, top:0, width:getProgressWidth(current_value??0), height:progressSize.height }} />
|
|
41
|
+
</View>
|
|
42
|
+
</View>
|
|
43
|
+
{!hide_labels ?
|
|
44
|
+
<View style={{ flexDirection:'row', justifyContent:'space-between', alignItems:'center', marginTop:10}}>
|
|
45
|
+
<Text size={12} color={val_color ?? Colors.text.h1}>{val_label?`${val_label}: `:''}{val_format?.loc=='front'?val_format.label:''}{current_value?.toFixed(2)}{val_format?.loc=='back'?val_format.label:''}</Text>
|
|
46
|
+
<Text size={12} color={Colors.text.h1}>{max_label?`${max_label}: `:''}{val_format?.loc=='front'?val_format.label:''}{max_value?.toFixed(2)}{val_format?.loc=='back'?val_format.label:''}</Text>
|
|
47
|
+
</View>
|
|
48
|
+
:<></>}
|
|
49
|
+
</View>
|
|
50
|
+
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default ProgressBar
|
package/src/Components/index.tsx
CHANGED
|
@@ -8,13 +8,14 @@ import LinearDiagnal from './LinearDiagnal';
|
|
|
8
8
|
import Switch from './Switch';
|
|
9
9
|
import ConfirmationModal from './ConfirmationModal';
|
|
10
10
|
import Toggle from './Toggle';
|
|
11
|
-
|
|
11
|
+
import ProgressBar from './ProgressBar';
|
|
12
12
|
export {
|
|
13
13
|
Button,
|
|
14
14
|
Text,
|
|
15
15
|
Spring,
|
|
16
16
|
Switch,
|
|
17
17
|
TextInput,
|
|
18
|
+
ProgressBar,
|
|
18
19
|
Checkbox,
|
|
19
20
|
Toggle,
|
|
20
21
|
Icons,
|