be-components 6.5.1 → 6.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/ApiOverrides/index.js +4 -4
- package/lib/commonjs/ApiOverrides/index.js.map +1 -1
- package/lib/commonjs/Authenticator/Components/StrategyForm.js +2 -0
- package/lib/commonjs/Authenticator/Components/StrategyForm.js.map +1 -1
- package/lib/commonjs/Authenticator/index.js +1 -0
- package/lib/commonjs/Authenticator/index.js.map +1 -1
- package/lib/commonjs/Clarity/SmartEvents.js +19 -0
- package/lib/commonjs/Clarity/SmartEvents.js.map +1 -0
- package/lib/commonjs/Components/AutoPageFlatList.js +92 -0
- package/lib/commonjs/Components/AutoPageFlatList.js.map +1 -0
- package/lib/commonjs/Components/AutoScrollFlatList.js.map +1 -1
- package/lib/commonjs/Components/CircularFadeOut.js +34 -0
- package/lib/commonjs/Components/CircularFadeOut.js.map +1 -0
- package/lib/commonjs/Components/Jerseys.js +5 -2
- package/lib/commonjs/Components/Jerseys.js.map +1 -1
- package/lib/commonjs/Components/LinearDiagnal.js +3 -1
- package/lib/commonjs/Components/LinearDiagnal.js.map +1 -1
- package/lib/commonjs/Components/Pagination.js +4 -4
- package/lib/commonjs/Components/Pagination.js.map +1 -1
- package/lib/commonjs/Components/Themed.js +4 -1
- package/lib/commonjs/Components/Themed.js.map +1 -1
- package/lib/commonjs/Components/index.js +14 -0
- package/lib/commonjs/Components/index.js.map +1 -1
- package/lib/commonjs/EventComponents/TeamProfile/index.js.map +1 -1
- package/lib/commonjs/Guide/index.js +217 -0
- package/lib/commonjs/Guide/index.js.map +1 -0
- package/lib/commonjs/MarketComponents/api/index.js +25 -0
- package/lib/commonjs/MarketComponents/api/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/AthleteMarket/index.js +2 -2
- package/lib/commonjs/MarketComponents/components/AthleteMarket/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js +19 -6
- package/lib/commonjs/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/commonjs/MarketComponents/components/TeamTournamentMarket/index.js +2 -1
- package/lib/commonjs/MarketComponents/components/TeamTournamentMarket/index.js.map +1 -1
- package/lib/commonjs/RankingsCard/api/index.js +88 -0
- package/lib/commonjs/RankingsCard/api/index.js.map +1 -0
- package/lib/commonjs/RankingsCard/index.js +663 -0
- package/lib/commonjs/RankingsCard/index.js.map +1 -0
- package/lib/commonjs/index.js +21 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.d.js +1 -0
- package/lib/commonjs/types.d.js.map +1 -1
- package/lib/module/ApiOverrides/index.js +4 -4
- package/lib/module/ApiOverrides/index.js.map +1 -1
- package/lib/module/Authenticator/Components/StrategyForm.js +2 -0
- package/lib/module/Authenticator/Components/StrategyForm.js.map +1 -1
- package/lib/module/Authenticator/index.js +1 -0
- package/lib/module/Authenticator/index.js.map +1 -1
- package/lib/module/Clarity/SmartEvents.js +13 -0
- package/lib/module/Clarity/SmartEvents.js.map +1 -0
- package/lib/module/Components/AutoPageFlatList.js +84 -0
- package/lib/module/Components/AutoPageFlatList.js.map +1 -0
- package/lib/module/Components/AutoScrollFlatList.js.map +1 -1
- package/lib/module/Components/CircularFadeOut.js +27 -0
- package/lib/module/Components/CircularFadeOut.js.map +1 -0
- package/lib/module/Components/Jerseys.js +5 -2
- package/lib/module/Components/Jerseys.js.map +1 -1
- package/lib/module/Components/LinearDiagnal.js +3 -1
- package/lib/module/Components/LinearDiagnal.js.map +1 -1
- package/lib/module/Components/Pagination.js +4 -4
- package/lib/module/Components/Pagination.js.map +1 -1
- package/lib/module/Components/Themed.js +4 -1
- package/lib/module/Components/Themed.js.map +1 -1
- package/lib/module/Components/index.js +3 -1
- package/lib/module/Components/index.js.map +1 -1
- package/lib/module/EventComponents/TeamProfile/index.js.map +1 -1
- package/lib/module/Guide/index.js +210 -0
- package/lib/module/Guide/index.js.map +1 -0
- package/lib/module/MarketComponents/api/index.js +25 -0
- package/lib/module/MarketComponents/api/index.js.map +1 -1
- package/lib/module/MarketComponents/components/AthleteMarket/index.js +2 -2
- package/lib/module/MarketComponents/components/AthleteMarket/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js +19 -6
- package/lib/module/MarketComponents/components/TeamEventMarket/index.js.map +1 -1
- package/lib/module/MarketComponents/components/TeamTournamentMarket/index.js +2 -1
- package/lib/module/MarketComponents/components/TeamTournamentMarket/index.js.map +1 -1
- package/lib/module/RankingsCard/api/index.js +82 -0
- package/lib/module/RankingsCard/api/index.js.map +1 -0
- package/lib/module/RankingsCard/index.js +655 -0
- package/lib/module/RankingsCard/index.js.map +1 -0
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.d.js +1 -0
- package/lib/module/types.d.js.map +1 -1
- package/lib/typescript/lib/commonjs/Authenticator/Components/StrategyForm.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Authenticator/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Clarity/SmartEvents.d.ts +14 -0
- package/lib/typescript/lib/commonjs/Clarity/SmartEvents.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/AutoPageFlatList.d.ts +12 -0
- package/lib/typescript/lib/commonjs/Components/AutoPageFlatList.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/CircularFadeOut.d.ts +9 -0
- package/lib/typescript/lib/commonjs/Components/CircularFadeOut.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/Components/Jerseys.d.ts +3 -1
- package/lib/typescript/lib/commonjs/Components/Jerseys.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/LinearDiagnal.d.ts +2 -1
- package/lib/typescript/lib/commonjs/Components/LinearDiagnal.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/Themed.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/Components/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/Guide/index.d.ts +7 -0
- package/lib/typescript/lib/commonjs/Guide/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts +3 -0
- package/lib/typescript/lib/commonjs/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/RankingsCard/api/index.d.ts +14 -0
- package/lib/typescript/lib/commonjs/RankingsCard/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/RankingsCard/index.d.ts +7 -0
- package/lib/typescript/lib/commonjs/RankingsCard/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +3 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Authenticator/Components/StrategyForm.d.ts.map +1 -1
- package/lib/typescript/lib/module/Authenticator/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Clarity/SmartEvents.d.ts +13 -0
- package/lib/typescript/lib/module/Clarity/SmartEvents.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/AutoPageFlatList.d.ts +12 -0
- package/lib/typescript/lib/module/Components/AutoPageFlatList.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/CircularFadeOut.d.ts +9 -0
- package/lib/typescript/lib/module/Components/CircularFadeOut.d.ts.map +1 -0
- package/lib/typescript/lib/module/Components/Jerseys.d.ts +3 -1
- package/lib/typescript/lib/module/Components/Jerseys.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/LinearDiagnal.d.ts +2 -1
- package/lib/typescript/lib/module/Components/LinearDiagnal.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/Spring.d.ts +1 -1
- package/lib/typescript/lib/module/Components/Themed.d.ts.map +1 -1
- package/lib/typescript/lib/module/Components/index.d.ts +3 -1
- package/lib/typescript/lib/module/Components/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/Guide/index.d.ts +8 -0
- package/lib/typescript/lib/module/Guide/index.d.ts.map +1 -0
- 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 +3 -0
- package/lib/typescript/lib/module/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts +2 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamTournamentMarket/index.d.ts +2 -1
- package/lib/typescript/lib/module/MarketComponents/components/TeamTournamentMarket/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/RankingsCard/api/index.d.ts +13 -0
- package/lib/typescript/lib/module/RankingsCard/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/RankingsCard/index.d.ts +9 -0
- package/lib/typescript/lib/module/RankingsCard/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +4 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/Authenticator/Components/StrategyForm.d.ts.map +1 -1
- package/lib/typescript/src/Authenticator/index.d.ts.map +1 -1
- package/lib/typescript/src/Clarity/SmartEvents.d.ts +13 -0
- package/lib/typescript/src/Clarity/SmartEvents.d.ts.map +1 -0
- package/lib/typescript/src/Components/AutoPageFlatList.d.ts +15 -0
- package/lib/typescript/src/Components/AutoPageFlatList.d.ts.map +1 -0
- package/lib/typescript/src/Components/AutoScrollFlatList.d.ts.map +1 -1
- package/lib/typescript/src/Components/CircularFadeOut.d.ts +10 -0
- package/lib/typescript/src/Components/CircularFadeOut.d.ts.map +1 -0
- package/lib/typescript/src/Components/Jerseys.d.ts +3 -1
- package/lib/typescript/src/Components/Jerseys.d.ts.map +1 -1
- package/lib/typescript/src/Components/LinearDiagnal.d.ts +3 -1
- package/lib/typescript/src/Components/LinearDiagnal.d.ts.map +1 -1
- package/lib/typescript/src/Components/Pagination.d.ts +2 -2
- package/lib/typescript/src/Components/Pagination.d.ts.map +1 -1
- package/lib/typescript/src/Components/Themed.d.ts +1 -0
- package/lib/typescript/src/Components/Themed.d.ts.map +1 -1
- package/lib/typescript/src/Components/index.d.ts +3 -1
- package/lib/typescript/src/Components/index.d.ts.map +1 -1
- package/lib/typescript/src/EventComponents/TeamProfile/index.d.ts.map +1 -1
- package/lib/typescript/src/Guide/index.d.ts +8 -0
- package/lib/typescript/src/Guide/index.d.ts.map +1 -0
- package/lib/typescript/src/MarketComponents/api/index.d.ts +9 -1
- package/lib/typescript/src/MarketComponents/api/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts +3 -2
- package/lib/typescript/src/MarketComponents/components/TeamEventMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/components/TeamTournamentMarket/index.d.ts +2 -1
- package/lib/typescript/src/MarketComponents/components/TeamTournamentMarket/index.d.ts.map +1 -1
- package/lib/typescript/src/MarketComponents/index.d.ts +4 -2
- package/lib/typescript/src/MarketComponents/index.d.ts.map +1 -1
- package/lib/typescript/src/RankingsCard/api/index.d.ts +20 -0
- package/lib/typescript/src/RankingsCard/api/index.d.ts.map +1 -0
- package/lib/typescript/src/RankingsCard/index.d.ts +8 -0
- package/lib/typescript/src/RankingsCard/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ApiOverrides/index.ts +4 -4
- package/src/Authenticator/Components/StrategyForm.tsx +2 -0
- package/src/Authenticator/index.tsx +2 -0
- package/src/Clarity/SmartEvents.ts +13 -0
- package/src/Components/AutoPageFlatList.tsx +99 -0
- package/src/Components/AutoScrollFlatList.tsx +0 -1
- package/src/Components/CircularFadeOut.tsx +36 -0
- package/src/Components/Jerseys.tsx +5 -3
- package/src/Components/LinearDiagnal.tsx +4 -3
- package/src/Components/Pagination.tsx +6 -4
- package/src/Components/Themed.tsx +6 -4
- package/src/Components/index.tsx +4 -0
- package/src/EventComponents/TeamProfile/index.tsx +0 -1
- package/src/Guide/index.tsx +180 -0
- package/src/MarketComponents/api/index.ts +26 -1
- package/src/MarketComponents/components/AthleteMarket/index.tsx +2 -2
- package/src/MarketComponents/components/TeamEventMarket/index.tsx +17 -6
- package/src/MarketComponents/components/TeamTournamentMarket/index.tsx +3 -2
- package/src/RankingsCard/api/index.ts +80 -0
- package/src/RankingsCard/index.tsx +398 -0
- package/src/index.tsx +6 -2
- package/src/types.d.ts +53 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
FlatList,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
} from 'react-native';
|
|
6
|
+
import { View } from './Themed';
|
|
7
|
+
import Pagination from './Pagination';
|
|
8
|
+
|
|
9
|
+
interface AutoPageFlatListProps<T> {
|
|
10
|
+
data: T[];
|
|
11
|
+
reset_key:string,
|
|
12
|
+
renderItem: ({ item }: { item: T }) => JSX.Element;
|
|
13
|
+
horizontal?: boolean;
|
|
14
|
+
time_on_page?: number; // seconds
|
|
15
|
+
itemHeight?: number; // required for vertical paging
|
|
16
|
+
itemWidth?: number; // required for horizontal paging
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function AutoPageFlatList<T>({
|
|
20
|
+
reset_key,
|
|
21
|
+
data,
|
|
22
|
+
renderItem,
|
|
23
|
+
horizontal = false,
|
|
24
|
+
time_on_page,
|
|
25
|
+
itemHeight = 200,
|
|
26
|
+
itemWidth = 200,
|
|
27
|
+
}: AutoPageFlatListProps<T>) {
|
|
28
|
+
const [page, setPage] = useState(0);
|
|
29
|
+
const [containerSize, setContainerSize] = useState<number>(0);
|
|
30
|
+
|
|
31
|
+
const intervalRef = useRef<NodeJS.Timeout | null>(null);
|
|
32
|
+
|
|
33
|
+
const sizePerItem = horizontal ? itemWidth : itemHeight;
|
|
34
|
+
const itemsPerPage = containerSize ? Math.max(Math.floor(containerSize / sizePerItem), 1) : 1;
|
|
35
|
+
const totalPages = Math.ceil(data.length / itemsPerPage);
|
|
36
|
+
|
|
37
|
+
// Auto-advance effect
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!time_on_page || totalPages <= 1) return;
|
|
40
|
+
|
|
41
|
+
intervalRef.current = setInterval(() => {
|
|
42
|
+
setPage((prev) => (prev + 1) % totalPages);
|
|
43
|
+
}, time_on_page * 1000);
|
|
44
|
+
|
|
45
|
+
return () => {
|
|
46
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
47
|
+
};
|
|
48
|
+
}, [time_on_page, totalPages]);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
setPage(0)
|
|
52
|
+
},[reset_key])
|
|
53
|
+
|
|
54
|
+
const onContainerLayout = (e: any) => {
|
|
55
|
+
const size = horizontal ? e.nativeEvent.layout.width : e.nativeEvent.layout.height;
|
|
56
|
+
setContainerSize(size);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const currentData = data.slice(page * itemsPerPage, page * itemsPerPage + itemsPerPage);
|
|
60
|
+
|
|
61
|
+
const nextPage = () => setPage((p) => Math.min(p + 1, totalPages - 1));
|
|
62
|
+
const prevPage = () => setPage((p) => Math.max(p - 1, 0));
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<View transparent style={styles.container} onLayout={onContainerLayout}>
|
|
66
|
+
<View transparent style={{ flex:1 }}>
|
|
67
|
+
<FlatList
|
|
68
|
+
data={currentData}
|
|
69
|
+
renderItem={renderItem}
|
|
70
|
+
keyExtractor={(_, idx) => String(idx)}
|
|
71
|
+
horizontal={horizontal}
|
|
72
|
+
showsHorizontalScrollIndicator={false}
|
|
73
|
+
showsVerticalScrollIndicator={false}
|
|
74
|
+
/>
|
|
75
|
+
</View>
|
|
76
|
+
<View transparent>
|
|
77
|
+
<Pagination
|
|
78
|
+
pages={totalPages}
|
|
79
|
+
onNext={nextPage}
|
|
80
|
+
onPrevious={prevPage}
|
|
81
|
+
offset={page}
|
|
82
|
+
/>
|
|
83
|
+
</View>
|
|
84
|
+
</View>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const styles = StyleSheet.create({
|
|
89
|
+
container: { flex: 1 },
|
|
90
|
+
controls: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
justifyContent: 'space-between',
|
|
93
|
+
padding: 8,
|
|
94
|
+
},
|
|
95
|
+
arrow: { fontSize: 24, paddingHorizontal: 8 },
|
|
96
|
+
disabled: { color: '#ccc' },
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export default AutoPageFlatList;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { useRef, useEffect } from 'react';
|
|
2
|
+
import { Animated, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
start: boolean;
|
|
6
|
+
animationTime?: number; // seconds
|
|
7
|
+
onComplete?: () => void;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function FadeOutOverlay({
|
|
12
|
+
start,
|
|
13
|
+
animationTime = 2,
|
|
14
|
+
onComplete,
|
|
15
|
+
children,
|
|
16
|
+
}: Props) {
|
|
17
|
+
const opacity = useRef(new Animated.Value(1)).current;
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (start) {
|
|
21
|
+
Animated.timing(opacity, {
|
|
22
|
+
toValue: 0,
|
|
23
|
+
duration: animationTime * 1000,
|
|
24
|
+
useNativeDriver: true,
|
|
25
|
+
}).start(() => {
|
|
26
|
+
onComplete?.();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}, [start]);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Animated.View style={[StyleSheet.absoluteFill, { opacity }]}>
|
|
33
|
+
{children}
|
|
34
|
+
</Animated.View>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -65,13 +65,15 @@ const AthleteImage = ({ athlete, size, number_size, league }:AthleteImageProps)
|
|
|
65
65
|
type TeamImageProps = {
|
|
66
66
|
team: TeamProps,
|
|
67
67
|
league? :LeagueProps,
|
|
68
|
-
size:number
|
|
68
|
+
size:number,
|
|
69
|
+
padding?:number,
|
|
70
|
+
backgroundColor?:string
|
|
69
71
|
}
|
|
70
|
-
const TeamImage = ({ team, league , size} : TeamImageProps) => {
|
|
72
|
+
const TeamImage = ({ team, league , size, padding, backgroundColor} : TeamImageProps) => {
|
|
71
73
|
let image_size = size ?? 20
|
|
72
74
|
|
|
73
75
|
return (
|
|
74
|
-
<View style={{ alignSelf:'center', justifyContent:'center', alignItems:'center', borderRadius:100, backgroundColor:Colors.shades.white }}>
|
|
76
|
+
<View style={{ alignSelf:'center', justifyContent:'center', alignItems:'center', borderRadius:100, backgroundColor:backgroundColor ?? Colors.shades.white, padding }}>
|
|
75
77
|
{team.image?.url ?
|
|
76
78
|
<RN_Image source={{ uri: team.image.url }} style={{ height:image_size * 2, width:image_size * 2, borderRadius:100 }} resizeMode='center'/>
|
|
77
79
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View, StyleSheet } from "react-native"
|
|
2
|
+
import { View, StyleSheet, type ViewStyle } from "react-native"
|
|
3
3
|
import {LinearGradient} from "expo-linear-gradient";
|
|
4
4
|
import Colors from '../constants/colors';
|
|
5
5
|
import Text from './Text';
|
|
@@ -8,16 +8,17 @@ type LinearDiagnalProps = {
|
|
|
8
8
|
label?: string,
|
|
9
9
|
label_size?:number,
|
|
10
10
|
label_color?:string,
|
|
11
|
+
parent_style?:ViewStyle,
|
|
11
12
|
left_color:string,
|
|
12
13
|
right_color:string
|
|
13
14
|
no_buffer?:boolean,
|
|
14
15
|
style?:any,
|
|
15
16
|
children?:any
|
|
16
17
|
}
|
|
17
|
-
const LinearDiagnal = ({ left_color, right_color, no_buffer, label, label_size, label_color, style, children }:LinearDiagnalProps) => {
|
|
18
|
+
const LinearDiagnal = ({ left_color, right_color, parent_style, no_buffer, label, label_size, label_color, style, children }:LinearDiagnalProps) => {
|
|
18
19
|
const [ height, setHeight ] = useState(0);
|
|
19
20
|
return (
|
|
20
|
-
<View style={{ flexDirection:'row' }} onLayout={(ev) => {
|
|
21
|
+
<View style={{ flexDirection:'row', ...parent_style }} onLayout={(ev) => {
|
|
21
22
|
const { height } = ev.nativeEvent.layout
|
|
22
23
|
setHeight(height)
|
|
23
24
|
}}>
|
|
@@ -9,8 +9,8 @@ type PaginationProps = {
|
|
|
9
9
|
pages?:number,
|
|
10
10
|
next_title?:string,
|
|
11
11
|
previous_title?:string,
|
|
12
|
-
onPrevious
|
|
13
|
-
onNext
|
|
12
|
+
onPrevious?: () => void,
|
|
13
|
+
onNext?: () => void,
|
|
14
14
|
onSelectPage?:(page:number) => void
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -36,7 +36,7 @@ const Pagination = ({ offset, pages, onPrevious, onNext, next_title, previous_ti
|
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
38
|
<View transparent style={{ flexDirection: 'row', alignItems:'center', ...style }}>
|
|
39
|
-
|
|
39
|
+
{onPrevious ?
|
|
40
40
|
<Button
|
|
41
41
|
disabled={offset == 0}
|
|
42
42
|
style={{ opacity: offset == 0 ? 0.4: 1 }}
|
|
@@ -44,7 +44,7 @@ const Pagination = ({ offset, pages, onPrevious, onNext, next_title, previous_ti
|
|
|
44
44
|
type='text'
|
|
45
45
|
onPress={() => onPrevious()}
|
|
46
46
|
/>
|
|
47
|
-
|
|
47
|
+
:<></>}
|
|
48
48
|
<View transparent style={{ flex:1 }} onLayout={(ev) => {
|
|
49
49
|
const { width } = ev.nativeEvent.layout;
|
|
50
50
|
setWidth(width);
|
|
@@ -59,6 +59,7 @@ const Pagination = ({ offset, pages, onPrevious, onNext, next_title, previous_ti
|
|
|
59
59
|
|
|
60
60
|
/>
|
|
61
61
|
</View>
|
|
62
|
+
{onNext ?
|
|
62
63
|
<Button
|
|
63
64
|
title={next_title ?? 'NEXT'}
|
|
64
65
|
style={{ opacity: pages && pages == offset + 1 ? 0.4 : 1 }}
|
|
@@ -66,6 +67,7 @@ const Pagination = ({ offset, pages, onPrevious, onNext, next_title, previous_ti
|
|
|
66
67
|
type='text'
|
|
67
68
|
onPress={() => onNext()}
|
|
68
69
|
/>
|
|
70
|
+
:<></>}
|
|
69
71
|
</View>
|
|
70
72
|
)
|
|
71
73
|
}
|
|
@@ -99,13 +99,13 @@ export const View = forwardRef(({ ...props }:ViewProps, ref:any) => {
|
|
|
99
99
|
let floated = (float || type=='input') ? color_mode == 'dark' ? MyViewStyles.floatDark : MyViewStyles.floatLight : {}
|
|
100
100
|
let flexDirection:'row'|'column' = type == 'row' ? 'row' : 'column'
|
|
101
101
|
let alignItems:'center'|undefined = type == 'row' ? 'center' : undefined
|
|
102
|
-
|
|
103
|
-
return <DefaultView ref={ref} style={[{ backgroundColor:color, borderRadius, borderColor: border_color, borderWidth: border_width, ...floated }, { flexDirection, alignItems }, style]} {...otherProps} />;
|
|
102
|
+
return <DefaultView nativeID={props.nativeID} ref={ref} style={[{ backgroundColor:color, borderRadius, borderColor: border_color, borderWidth: border_width, ...floated }, { flexDirection, alignItems }, style]} {...otherProps} />;
|
|
104
103
|
})
|
|
105
104
|
|
|
106
105
|
|
|
107
106
|
type BEButtonProps = {
|
|
108
107
|
float?:boolean,
|
|
108
|
+
nativeID?:string,
|
|
109
109
|
backgroundColor?:string,
|
|
110
110
|
title?:string,
|
|
111
111
|
loading?:boolean,
|
|
@@ -149,7 +149,8 @@ export const Button = (props:ButtonProps) => {
|
|
|
149
149
|
return {
|
|
150
150
|
background_color:C.buttons.background.action,
|
|
151
151
|
text_color:C.text.white,
|
|
152
|
-
border_width:0
|
|
152
|
+
border_width:0,
|
|
153
|
+
border_color:'transparent'
|
|
153
154
|
}
|
|
154
155
|
case 'text':
|
|
155
156
|
return {
|
|
@@ -199,7 +200,8 @@ let floated = float ? color_mode == 'dark' ? MyViewStyles.floatDark : MyViewStyl
|
|
|
199
200
|
|
|
200
201
|
return (
|
|
201
202
|
<TouchableOpacity
|
|
202
|
-
|
|
203
|
+
nativeID={props.nativeID}
|
|
204
|
+
style={[{ borderRadius:8, backgroundColor:!transparent?background_color:'transparent', borderColor:border_color, borderWidth: border_width, padding:15, opacity:loading?0.5:1, ...floated }, style]}
|
|
203
205
|
disabled={loading || otherProps.disabled}
|
|
204
206
|
{ ...otherProps }
|
|
205
207
|
>
|
package/src/Components/index.tsx
CHANGED
|
@@ -15,12 +15,16 @@ import LeagueLozenge from './LeagueLozenge';
|
|
|
15
15
|
import MarketLozenge from './MarketLozenge';
|
|
16
16
|
import AthleteLozenge from './AthleteLozenge';
|
|
17
17
|
import PlayerLozenge from './PlayerLozenge';
|
|
18
|
+
import AutoPageFlatList from './AutoPageFlatList';
|
|
19
|
+
import CircularFadeOut from './CircularFadeOut';
|
|
18
20
|
|
|
19
21
|
export {
|
|
20
22
|
Button,
|
|
21
23
|
Text,
|
|
22
24
|
Spring,
|
|
23
25
|
AutoScrollingFlatList,
|
|
26
|
+
CircularFadeOut,
|
|
27
|
+
AutoPageFlatList,
|
|
24
28
|
Switch,
|
|
25
29
|
MarketLozenge,
|
|
26
30
|
TextInput,
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React, { useRef, useState, useEffect } from "react";
|
|
2
|
+
import { Platform, useWindowDimensions } from "react-native";
|
|
3
|
+
import type { GuideWrapProps } from "../types";
|
|
4
|
+
import { Button, Text, View } from "../Components/Themed";
|
|
5
|
+
import { useColors } from "../constants/useColors";
|
|
6
|
+
import { Icons } from "../Components";
|
|
7
|
+
|
|
8
|
+
export type GuideWrapperProps = {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
guide?: GuideWrapProps;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Layout = { x: number; y: number; width: number; height: number };
|
|
14
|
+
|
|
15
|
+
export default function GuideWrapper({ children, guide }: GuideWrapperProps) {
|
|
16
|
+
const Colors = useColors();
|
|
17
|
+
const wrapper_guid = guide ?? {};
|
|
18
|
+
const { tour, active, onComplete } = wrapper_guid;
|
|
19
|
+
const refs = useRef<{ [key: string]: any }>({});
|
|
20
|
+
const [currentStep, setCurrentStep] = useState(0);
|
|
21
|
+
const [layout, setLayout] = useState<Layout | null>(null);
|
|
22
|
+
const [ container_layout, setContainerLayout ] = useState({ height: 0, width:0, x:0, y:0 });
|
|
23
|
+
const { width } = useWindowDimensions();
|
|
24
|
+
//Check if it is negative
|
|
25
|
+
const MIN_WIDTH = 300
|
|
26
|
+
let right = false
|
|
27
|
+
if(layout){
|
|
28
|
+
let right_side = layout.x + MIN_WIDTH
|
|
29
|
+
if(right_side > container_layout.width){ right = true }
|
|
30
|
+
//Check if it goes over the bottom
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const sortedTour = tour ? [...tour].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0)) : []
|
|
34
|
+
const step = sortedTour[currentStep];
|
|
35
|
+
const ref = step ? refs.current[step.nativeID] : undefined
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
// Measure the current step element
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (!step || !ref || !active) return;
|
|
41
|
+
|
|
42
|
+
if (Platform.OS === "web") {
|
|
43
|
+
const rect = ref.getBoundingClientRect();
|
|
44
|
+
setLayout({
|
|
45
|
+
x: rect.left - container_layout.x,
|
|
46
|
+
y: rect.top - container_layout.y,
|
|
47
|
+
width: rect.width,
|
|
48
|
+
height: rect.height
|
|
49
|
+
});
|
|
50
|
+
} else if (ref && typeof ref.measure === "function") {
|
|
51
|
+
ref.measure(
|
|
52
|
+
(width: number, height: number, pageX: number, pageY: number) => {
|
|
53
|
+
setLayout({ x: pageX, y: pageY, width, height });
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}, [active, currentStep, step, ref, container_layout.x]);
|
|
58
|
+
|
|
59
|
+
// Recursively attach refs to children with nativeID
|
|
60
|
+
const attachRefs = (nodes: React.ReactNode): React.ReactNode => {
|
|
61
|
+
return React.Children.map(nodes, (child: any) => {
|
|
62
|
+
if (!React.isValidElement(child)) return child;
|
|
63
|
+
|
|
64
|
+
const props = (child.props as any) || {};
|
|
65
|
+
const nativeID = props.nativeID;
|
|
66
|
+
const newChildren = props.children ? attachRefs(props.children) : props.children;
|
|
67
|
+
|
|
68
|
+
if (nativeID) {
|
|
69
|
+
return React.cloneElement(child, {
|
|
70
|
+
ref: (ref: any) => {
|
|
71
|
+
if (ref) refs.current[nativeID] = ref;
|
|
72
|
+
},
|
|
73
|
+
children: newChildren,
|
|
74
|
+
} as any);
|
|
75
|
+
} else if (newChildren !== props.children) {
|
|
76
|
+
return React.cloneElement(child, { children: newChildren } as any);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return child;
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
if (!tour || !active) return <>{children}</>;
|
|
84
|
+
|
|
85
|
+
if (!step) return <>{attachRefs(children)}</>;
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
const handleNext = () => {
|
|
90
|
+
if (currentStep + 1 < sortedTour.length) {
|
|
91
|
+
setCurrentStep(currentStep + 1);
|
|
92
|
+
} else {
|
|
93
|
+
onComplete?.("complete");
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const handlePrev = () => {
|
|
98
|
+
if (currentStep > 0) setCurrentStep(currentStep - 1);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
if (!layout) return <>{attachRefs(children)}</>;
|
|
102
|
+
const isLastStep = currentStep === sortedTour.length - 1;
|
|
103
|
+
return (
|
|
104
|
+
<View style={{ flexGrow: 1 }} onLayout={(ev) => {
|
|
105
|
+
const l = ev.nativeEvent.layout
|
|
106
|
+
setContainerLayout({ height:l.height, width: l.width, x: l.x, y:l.y })
|
|
107
|
+
}}>
|
|
108
|
+
{/* Attach refs to children */}
|
|
109
|
+
{attachRefs(children)}
|
|
110
|
+
|
|
111
|
+
{/* Highlight border around active element */}
|
|
112
|
+
<View
|
|
113
|
+
transparent
|
|
114
|
+
style={{
|
|
115
|
+
position:'absolute',
|
|
116
|
+
zIndex: 9999999,
|
|
117
|
+
borderWidth:2,
|
|
118
|
+
borderColor:Colors.text.success,
|
|
119
|
+
borderRadius:4,
|
|
120
|
+
top: layout.y - 5,
|
|
121
|
+
left: layout.x - 5,
|
|
122
|
+
width: layout.width + 5,
|
|
123
|
+
height: layout.height + 10,
|
|
124
|
+
}}
|
|
125
|
+
>
|
|
126
|
+
<View
|
|
127
|
+
float
|
|
128
|
+
style={{
|
|
129
|
+
position:'absolute',
|
|
130
|
+
maxWidth: width - 10,
|
|
131
|
+
minWidth:300,
|
|
132
|
+
borderColor:Colors.text.success,
|
|
133
|
+
bottom: 0 + layout.height + 15,
|
|
134
|
+
left: right ? undefined : layout.x + 5,
|
|
135
|
+
right: right ? 5 : undefined
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
{step.title ?
|
|
139
|
+
<View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10, borderTopRightRadius:8, borderTopLeftRadius:8 }}>
|
|
140
|
+
<Icons.AlertIcon size={14} color={Colors.text.warning} />
|
|
141
|
+
<View transparent style={{flex:1, marginLeft:10, marginRight:10, borderLeftWidth:1, borderColor:Colors.borders.light}}>
|
|
142
|
+
<Text theme="h1">{step.title}</Text>
|
|
143
|
+
</View>
|
|
144
|
+
<Button
|
|
145
|
+
style={{ height:30, width:30, borderRadius:100, padding:0, justifyContent:'center', alignItems:'center' }}
|
|
146
|
+
title="X"
|
|
147
|
+
type="error"
|
|
148
|
+
onPress={() => onComplete ? onComplete('cancelled') : console.log('')}
|
|
149
|
+
/>
|
|
150
|
+
</View>
|
|
151
|
+
:<></>}
|
|
152
|
+
{step.body ?
|
|
153
|
+
<View type="body" style={{ padding:5 }}>
|
|
154
|
+
<Text theme="h2">{step.body}</Text>
|
|
155
|
+
</View>
|
|
156
|
+
:<></>}
|
|
157
|
+
<View type='footer' style={{ flexDirection:'row', alignItems:'center', padding:10, borderBottomRightRadius:8, borderBottomLeftRadius:8 }}>
|
|
158
|
+
{currentStep > 0 && (
|
|
159
|
+
<Button
|
|
160
|
+
type='action'
|
|
161
|
+
onPress={handlePrev}
|
|
162
|
+
style={{ padding:10, flex:1, margin:2 }}
|
|
163
|
+
title="BACK"
|
|
164
|
+
/>
|
|
165
|
+
)}
|
|
166
|
+
{!step.clickable && (
|
|
167
|
+
<Button
|
|
168
|
+
type='success'
|
|
169
|
+
style={{ padding:10, flex:1, margin:2 }}
|
|
170
|
+
onPress={handleNext}
|
|
171
|
+
title={isLastStep ? "Done" : "Next"}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
</View>
|
|
175
|
+
</View>
|
|
176
|
+
</View>
|
|
177
|
+
</View>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import { APIOverrides } from "../../ApiOverrides"
|
|
3
|
-
import type { AthleteProps, AthleteStatProps, BestAvailableOrderProps, BestAvailableResponseProps, ContestStatProps, EventOrderStatProps, EventProps, ExternalPriceProps, LeagueProps, MarketProps, MarketSideOptionProps, MarketStatsProps, MatchProps, MyPlayerProps, OrderProps, PodcastProps, PositionProps, PublicPlayerProps, TeamProps, TournamentProps, TradeProps } from "../../types"
|
|
3
|
+
import type { AthleteProps, AthleteStatProps, BestAvailableOrderProps, BestAvailableResponseProps, ContestStatProps, EventOrderStatProps, EventProps, ExternalPriceProps, LeagueProps, MarketProps, MarketSideOptionProps, MarketStatsProps, MatchProps, MyPlayerProps, OrderProps, PodcastProps, PositionProps, PublicPlayerProps, TeamProps, TeamRankingProps, TeamRecordProps, TournamentProps, TradeProps } from "../../types"
|
|
4
4
|
import moment, { type Moment } from 'moment-mini';
|
|
5
5
|
import { MarketMaketHelpers } from '../../MarketMaker/api';
|
|
6
6
|
|
|
@@ -88,6 +88,22 @@ const MarketComponentApi = {
|
|
|
88
88
|
return []
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
|
+
getScheduledTournamentsByTeams: async(team_ids:string):Promise<TournamentProps[]> => {
|
|
92
|
+
try {
|
|
93
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/tournaments/teams/${team_ids}`);
|
|
94
|
+
return resp.data.tournaments
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return []
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
getScheduledTournamentsByAthletes: async(athlete_ids:string):Promise<TournamentProps[]> => {
|
|
100
|
+
try {
|
|
101
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/tournaments/athletes/${athlete_ids}`);
|
|
102
|
+
return resp.data.tournaments
|
|
103
|
+
} catch (e) {
|
|
104
|
+
return []
|
|
105
|
+
}
|
|
106
|
+
},
|
|
91
107
|
getMarketStatsByEvent: async(event_id:string, event_type:string):Promise<MarketStatsProps[]> => {
|
|
92
108
|
try {
|
|
93
109
|
const resp = await axios.get(`${MK_SVC_API}/v1/markets/event/stats/${event_type}/${event_id}`);
|
|
@@ -248,6 +264,15 @@ const MarketComponentApi = {
|
|
|
248
264
|
}
|
|
249
265
|
|
|
250
266
|
},
|
|
267
|
+
getTeamById: async(team_id:string):Promise<undefined | { team:TeamProps, team_rankings:TeamRankingProps[], team_records:TeamRecordProps[], league:LeagueProps }> => {
|
|
268
|
+
try {
|
|
269
|
+
console.log('getting data')
|
|
270
|
+
const resp = await axios.get(`${EVENT_SVC_API}/v1/teams/team/${team_id}`);
|
|
271
|
+
return resp.data
|
|
272
|
+
} catch (e) {
|
|
273
|
+
return undefined
|
|
274
|
+
}
|
|
275
|
+
},
|
|
251
276
|
getLeagues:async():Promise<LeagueProps[]> => {
|
|
252
277
|
try {
|
|
253
278
|
const resp = await axios.get(`${EVENT_SVC_API}/v1/leagues`);
|
|
@@ -98,8 +98,8 @@ const AthleteMarket = ({ event, show_event, disabled_markets, float, image_size,
|
|
|
98
98
|
/>
|
|
99
99
|
:<></>}
|
|
100
100
|
<View style={{ flexGrow:1, padding:10, paddingBottom:0 }}>
|
|
101
|
-
<Text weight='bold' style={{ maxWidth:100 }} theme='h2' textAlign='center'>{athlete.first_name} {athlete.last_name}</Text>
|
|
102
|
-
<Text style={{ marginTop:3 }} theme='description' textAlign='center' size={12}>{athlete.team?`${athlete.team.abbr}`:''} ({athlete.position})</Text>
|
|
101
|
+
<Text weight='bold' style={{ maxWidth:100 }} theme='h2' textAlign={direction == 'horizontal' ?'left' :'center'}>{athlete.first_name} {athlete.last_name}</Text>
|
|
102
|
+
<Text style={{ marginTop:3 }} theme='description' textAlign={direction == 'horizontal' ?'left' :'center'} size={12}>{athlete.team?`${athlete.team.abbr}`:''} ({athlete.position})</Text>
|
|
103
103
|
</View>
|
|
104
104
|
</View>
|
|
105
105
|
<View transparent style={{ flexGrow:1, justifyContent:direction=='vertical'?'center':'flex-end', padding:10 }}>
|