|
|
@@ -2,7 +2,7 @@ import styles from './styles.module.scss'
|
|
|
import {useEffect, useRef, useState} from "react";
|
|
|
import {useThemeProvider} from "@contexts/themeContext";
|
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
|
-import {getBBConf, getUserID, getUserInfo} from "@features/mainSlice";
|
|
|
+import {getBBConf, getUserBBToken, getUserID, getUserInfo, getUserThemeAndLang} from "@features/mainSlice";
|
|
|
import {APP_THEME} from "@constants/app";
|
|
|
import {useLocation, useNavigate} from "react-router-dom";
|
|
|
import {ROUTE_PATH} from "@constants/routes";
|
|
|
@@ -23,7 +23,9 @@ const WSport=({})=>{
|
|
|
const dispatch=useDispatch();
|
|
|
const {pathname,hash} = useLocation();
|
|
|
const tempSPath=pathname.startsWith(ROUTE_PATH.RACING)?"/horse-racing-55":"/";
|
|
|
- const [sportPath,setSportPath]=useState(tempSPath)
|
|
|
+ const [sportPath,setSportPath]=useState(tempSPath);
|
|
|
+ const btToken=useSelector(getUserBBToken);
|
|
|
+ const userThemeLang=useSelector(getUserThemeAndLang);
|
|
|
const refreshToken=async ()=>{
|
|
|
return new Promise((resolve, reject) => {
|
|
|
dispatch(reqGameInfo()).then(({payload})=>{
|
|
|
@@ -46,10 +48,11 @@ const WSport=({})=>{
|
|
|
let themeIndex=0;
|
|
|
if (theme===APP_THEME.LIGHT)themeIndex=1;
|
|
|
let themeName=bbtheme[themeIndex];
|
|
|
- let token=null;
|
|
|
+ // let token=null;
|
|
|
// if (bbConf.token!=null)token=bbConf.token;
|
|
|
- if (user!=null&&user.bb!=null&&user.bb.token!=null)token=user.bb.token;
|
|
|
+ // if (user!=null&&user.bb!=null&&user.bb.token!=null)token=user.bb.token;
|
|
|
// token=null;
|
|
|
+ let token=btToken;
|
|
|
let betSlipOffsetBottom=isMobile()?70:0;
|
|
|
var bt = new window.BTRenderer().initialize({
|
|
|
brand_id: brand_id,
|
|
|
@@ -63,6 +66,7 @@ const WSport=({})=>{
|
|
|
betSlipOffsetRight: 0,
|
|
|
betSlipOffsetTop: 130,
|
|
|
betslipZIndex: 100,
|
|
|
+ stickyTop: 0,
|
|
|
url:sportPath,
|
|
|
onRouteChange: function() {},
|
|
|
onLogin: function() {
|
|
|
@@ -126,25 +130,25 @@ const WSport=({})=>{
|
|
|
},20);
|
|
|
}
|
|
|
},[hash])
|
|
|
- useEffect(()=>{
|
|
|
- if (objInfo.bt){
|
|
|
- if (bbConf==null)return null;
|
|
|
- let bbtheme=bbConf.theme;
|
|
|
- let themeIndex=0;
|
|
|
- if (theme===APP_THEME.LIGHT)themeIndex=1;
|
|
|
- let themeName=bbtheme[themeIndex];
|
|
|
- objInfo.bt.updateOptions({
|
|
|
- themeName:themeName
|
|
|
- })
|
|
|
- }
|
|
|
- },[theme])
|
|
|
- useEffect(()=>{
|
|
|
- if (objInfo.bt){
|
|
|
- objInfo.bt.updateOptions({
|
|
|
- lang: language,
|
|
|
- })
|
|
|
- }
|
|
|
- },[language])
|
|
|
+ // useEffect(()=>{
|
|
|
+ // if (objInfo.bt){
|
|
|
+ // if (bbConf==null)return null;
|
|
|
+ // let bbtheme=bbConf.theme;
|
|
|
+ // let themeIndex=0;
|
|
|
+ // if (theme===APP_THEME.LIGHT)themeIndex=1;
|
|
|
+ // let themeName=bbtheme[themeIndex];
|
|
|
+ // objInfo.bt.updateOptions({
|
|
|
+ // themeName:themeName
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // },[theme])
|
|
|
+ // useEffect(()=>{
|
|
|
+ // if (objInfo.bt){
|
|
|
+ // objInfo.bt.updateOptions({
|
|
|
+ // lang: language,
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // },[language])
|
|
|
useEffect(()=>{
|
|
|
clearBT();
|
|
|
objInfo.bt=initBetby();
|
|
|
@@ -152,7 +156,7 @@ const WSport=({})=>{
|
|
|
clearBT();
|
|
|
clearTimer();
|
|
|
}
|
|
|
- },[userID])
|
|
|
+ },[userID,userThemeLang])
|
|
|
//,theme,language
|
|
|
return (
|
|
|
<div id="betby" className={`${styles.container} ${isMobile()?styles.container_m:''}`}></div>
|