import { isEmpty } from "lodash";
import React, { useEffect, useState } from "react";
import { useContext } from "react";
import { Link, useNavigate } from "react-router-dom";
import AuthProvider from "../context/AuthContext";
import { apiGet, apiPost } from "../Utils/apiFetch";
import apiPath from "../Utils/apiPath";
import obj from "../Utils/helpers";
import Slider from "react-slick";
import Aboutus from "../components/staticContent/Aboutus";
import GeneralTerms from "../components/staticContent/GeneralTerms";
import Kyc from "../components/staticContent/Kyc";
import PrivacyPolicy from "../components/staticContent/PrivacyPolicy";
import RulesRegulation from "../components/staticContent/RulesRegulation";
import ResponsibleGaming from "../components/staticContent/ResponsibleGaming";
import { LazyLoadImage } from "react-lazy-load-image-component";
// import Play111Apk from "../assets/images/Play111.apk";
import {
NavDepositWithrawData,
// DepositWithrawDataArray,
} from "../Utils/constants";
function Home() {
var settings = {
dots: false,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
arrows: false,
};
var settings1 = {
dots: false,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
arrows: false,
};
const [inplayCountData, setInplayCountData] = useState({});
const navigate = useNavigate();
let {
isLoged,
setIsLoged,
setCasinoModel,
setCasinoObj,
launchCasino,
user,
open,
setOpen,
content,
slug,
setSlug,
handleContentToggle,
launchGis,
dolaunchCasinoNew,
setAnnouncmentToogle
} = useContext(AuthProvider);
const inPlayCount = async () => {
const { status, data: response_users } = await apiGet(apiPath.inPlayCount);
if (status === 200) {
if (response_users.success) {
if (response_users.results) {
setInplayCountData(response_users.results);
}
}
}
};
const [linkData, setLinkData] = useState([]);
const getSetting = async (event) => {
try {
const { status, data: response_users } = await apiGet(apiPath.getSetting);
if (status === 200) {
if (response_users.success) {
setLinkData(response_users.results);
}
}
} catch (err) {}
};
const [bannerData, setBannerData] = useState([]);
const getData = async () => {
const { status, data } = await apiPost(apiPath.getBanner, {
type: "home_top",
});
if (status == 200) {
if (data?.success) {
setBannerData(data?.results?.banners);
}
}
};
useEffect(() => {
inPlayCount();
getSetting();
getData();
}, []);
const [data, setData] = useState([]);
const [key, setKey] = useState("homegame");
// useEffect(() => {
// setData(
// DepositWithrawDataArray?.find((res) => {
// {
// return res?.key == "homegame";
// }
// })
// );
// }, []);
// const setFunc = (type) => {
// setData(
// DepositWithrawDataArray?.find((res) => {
// {
// return res?.key == type;
// }
// })
// );
// setKey(type);
// };
const [message, setMessage] = useState([]);
const messageList = async () => {
let hostname = window.location.hostname;
hostname = hostname.replace(/^www\./, "");
hostname = hostname.replace(/^ag\./, "");
hostname = hostname || "sabaexch.com";
const { status, data: response_users } = await apiGet(
apiPath.messageList + "?domain=" + hostname
);
if (status === 200) {
if (response_users.success) {
setMessage(response_users.results);
}
}
};
useEffect(() => {
messageList();
}, []);
return (
{bannerData?.length > 0 ? (
{bannerData?.length > 0 &&
bannerData?.map((item) => {
return (
);
})}
) : (
)}
{!isEmpty(user) && (
News
{
setAnnouncmentToogle(message.length > 0 ? true : false);
}}
>
)}
{NavDepositWithrawData?.map((item) => {
return (
{
if (!isEmpty(item?.link)) {
navigate(item?.link);
} else if (item?.platForm) {
if (isEmpty(user)) {
navigate("/login");
} else {
launchCasino({
platForm: item?.platForm,
gameType: item?.gameType,
casinoType: item?.casinoType,
});
}
} else {
}
}}
className={`payment-box ${
key == item?.type ? "active" : ""
}`}
>
{item?.type=="homegame"?
:
}
{item?.title}
);
})}
{/* {
key!="homegame"?
{data?.array && data?.array.length>0 && data?.array?.map((res) => {
return (
- {
if (!isEmpty(user)) {
// console.log(key,res?.gameCode);
if (!isEmpty(user)) {
if (res?.gameTypeCheck == "cricket") {
window.open(res?.link, "_self");
} else if (res?.gameTypeCheck == "platForm") {
launchCasino({
platForm: res?.platForm,
gameType: res?.gameType,
casinoType: res?.casinoType,
});
}
else {
if (
res?.platForm !== "" &&
res?.gameType !== "" &&
res?.casinoType !== ""
) {
launchCasino({
platForm: res?.platForm,
gameType: res?.gameType,
casinoType: res?.casinoType,
});
}
}
} else {
navigate("/login");
}
} else {
navigate("/login");
}
}}>
);
})}
:""} */}
{
if (!isEmpty(user)) {
launchCasino({
platForm: "EVOLUTION",
gameType: "",
casinoType: "",
});
} else {
navigate("/login");
}
}}
neua="AEIndia Banner"
>
- Evolution
-
Play Now
- Play111
-
Play Now
navigate("/inplay")}
className="on_live"
>
{/* -
LIVE
*/}
{/* -
Cricket
{inplayCountData?.cricketInplayCount || 0}
-
Soccer
{inplayCountData?.soccerInplayCount || 0}
*/}
{/* -
E-Soccer
{inplayCountData?.soccerInplayCount || 0}
*/}
{/* -
Tennis
{inplayCountData?.tennisInplayCount || 0}
*/}
{
if (!isEmpty(user)) {
launchCasino({
platForm: "SPRIBE",
gameType: "EGAME",
casinoType: "SPRIBE-EGAME-001",
});
} else {
navigate("/login");
}
}}
neua="AEIndia Banner"
>
- Aviator
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "SEXYBCRT",
gameType: "LIVE",
casinoType: "MX-LIVE-002",
});
} else {
navigate("/login");
}
}}
neua="AEIndia Banner"
>
- AE Sexy
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "JILI",
gameType: "",
casinoType: "",
});
} else {
navigate("/login");
}
}}
neua="32Cards Banner"
>
- Jili
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "JILI",
gameType: "SLOT",
casinoType: "JILI-SLOT-029",
});
} else {
navigate("/login");
}
}}
neua="32Cards Banner"
>
- Money Coming
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "KINGMAKER",
gameType: "TABLE",
casinoType: "KM-TABLE-015",
});
} else {
navigate("/login");
}
}}
>
- Sicbo
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "KINGMAKER",
gameType: "TABLE",
casinoType: "KM-TABLE-032",
});
} else {
navigate("/login");
}
}}
neua="Rummy Banner"
>
- Andar Bahar
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "JILI",
gameType: "SLOT",
casinoType: "JILI-SLOT-027",
});
} else {
navigate("/login");
}
}}
href="javascript:void(0)"
>
- Super Ace
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "KINGMAKER",
gameType: "TABLE",
casinoType: "KM-TABLE-046",
});
} else {
navigate("/login");
}
}}
neua="BetGames Banner"
>
- Teen Patti
- Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "KINGMAKER",
gameType: "",
casinoType: "",
});
} else {
navigate("/login");
}
}}
neua="AEIndia Banner"
>
- Kingmaker
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "JILI",
gameType: "TABLE",
casinoType: "JILI-TABLE-018",
});
} else {
navigate("/login");
}
}}
neua="AEIndia Banner"
>
- Super Bingo
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "KINGMAKER",
gameType: "TABLE",
casinoType: "KM-TABLE-043",
});
} else {
navigate("/login");
}
}}
href="javascript:void(0)"
neua="7Up7Down Banner"
>
- Bonus Dice
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "JILI",
gameType: "SLOT",
casinoType: "JILI-SLOT-029",
});
} else {
navigate("/login");
}
}}
href="javascript:void(0)"
neua="7Up7Down Banner"
>
- Money Coming
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "JILI",
gameType: "SLOT",
casinoType: "JILI-SLOT-014",
});
} else {
navigate("/login");
}
}}
href="javascript:void(0)"
neua="7Up7Down Banner"
>
- Crazy777
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "JILI",
gameType: "SLOT",
casinoType: "JILI-SLOT-006",
});
} else {
navigate("/login");
}
}}
href="javascript:void(0)"
neua="7Up7Down Banner"
>
- Lottery
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "HOTROAD",
gameType: "",
casinoType: "J",
});
} else {
navigate("/login");
}
}}
href="javascript:void(0)"
neua="7Up7Down Banner"
>
- Ezugi
-
Play Now
{
if (!isEmpty(user)) {
launchCasino({
platForm: "EVOLUTION",
gameType: "LIVE",
casinoType: "EVOLUTION-LIVE-001",
});
} else {
navigate("/login");
}
}}
href="javascript:void(0)"
neua="7Up7Down Banner"
>
- Roulette
-
Play Now
{/* new-phase */}
{/*
*/}
);
}
export default Home;