|
@@ -1,6 +1,6 @@
|
|
|
"use client";
|
|
|
import { GroupType, PrizeTypes } from "@/api/home";
|
|
|
-import Box from "@/components/Box";
|
|
|
+import CustomTabs from "@/components/Tabs";
|
|
|
import { useRouter } from "@/i18n/routing";
|
|
|
import { useSystemStore } from "@/stores/useSystemStore";
|
|
|
import { getToken } from "@/utils/Cookies";
|
|
@@ -8,8 +8,8 @@ import { Toast } from "antd-mobile";
|
|
|
import clsx from "clsx";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import { FC, useState } from "react";
|
|
|
-import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
import HomeGames from "./HomeGames";
|
|
|
+
|
|
|
// import HomePrize from "./HomePrize";
|
|
|
|
|
|
const buttonGroup: any = [
|
|
@@ -92,34 +92,33 @@ const TabItem = ({
|
|
|
|
|
|
// const cls2 = clsx("iconfont text-[.34rem]", `icon-${item.icon}`);
|
|
|
|
|
|
- const rootCls = clsx(
|
|
|
- "relative aspect-square flex cursor-pointer rounded-[.1rem] pt-[.1rem] items-center justify-center flex-col bg-[#2b353f] text-[#596b73]"
|
|
|
- // active ? "text-[#596b73]" : "text-[ #596b73]"
|
|
|
- );
|
|
|
-
|
|
|
return (
|
|
|
- <div className={rootCls} onClick={() => handler(item)}>
|
|
|
- <div className="flex items-end justify-center">
|
|
|
+ <div
|
|
|
+ className={clsx(
|
|
|
+ "relative flex cursor-pointer items-center rounded-[.1rem] bg-[var(--main-background)] px-[.1rem] py-[.04rem]",
|
|
|
+ !!active ? "text-[#fff]" : "text-[var(--textColor2)]"
|
|
|
+ )}
|
|
|
+ onClick={() => handler(item)}
|
|
|
+ >
|
|
|
+ <div className="relative z-[2] inline-block flex w-[.24rem] items-center justify-center">
|
|
|
{!item.image && <span className={cls}></span>}
|
|
|
{item.image && (
|
|
|
<img
|
|
|
src={item.image}
|
|
|
- width={36}
|
|
|
- height={36}
|
|
|
- style={{ width: ".36rem" }}
|
|
|
+ style={{ height: ".24rem" }}
|
|
|
alt={item.url}
|
|
|
className={clsx(item.isAnimation ? "animate-slow-bounce" : "")}
|
|
|
></img>
|
|
|
)}
|
|
|
</div>
|
|
|
|
|
|
- <span
|
|
|
+ <div
|
|
|
className={
|
|
|
- "break-word mt-[.02rem] flex h-[.26rem] items-center justify-center truncate whitespace-normal px-[.02rem] text-center text-[0.1rem] leading-[1]"
|
|
|
+ "relative z-[2] min-w-[0] flex-1 whitespace-nowrap px-[.02rem] text-center text-[0.1rem]"
|
|
|
}
|
|
|
>
|
|
|
{item.locale ? t(item.category_name) : item.category_name}
|
|
|
- </span>
|
|
|
+ </div>
|
|
|
{/* {item.isHot && (
|
|
|
<img
|
|
|
className={"absolute -top-[0.12rem] right-0 h-[0.21rem] w-[0.21rem]"}
|
|
@@ -152,25 +151,44 @@ const Tabs: FC<Props> = (props) => {
|
|
|
}
|
|
|
return true;
|
|
|
});
|
|
|
- const tabData = [...tabs, ...newButtonGroup];
|
|
|
+ const tabData = [...tabs, ...newButtonGroup].map((item, idx) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ name: item.category_name,
|
|
|
+ id: `${item.category_name}_${idx}`,
|
|
|
+ headerRender: () => (
|
|
|
+ <TabItem
|
|
|
+ item={item as TabItemType}
|
|
|
+ active={`${item.category_name}_${idx}` === active || (!active && idx === 0)}
|
|
|
+ ></TabItem>
|
|
|
+ ),
|
|
|
+ };
|
|
|
+ });
|
|
|
|
|
|
- const [active, setActive] = useState<number>(0);
|
|
|
+ const [active, setActive] = useState<string | undefined>();
|
|
|
const router = useRouter();
|
|
|
- const selectHandler = (item: TabItemType, index: number) => {
|
|
|
- if (item.bet_type === 2 || item.bet_type === 3) {
|
|
|
- router.push(
|
|
|
- `/gameList/?gameListFlag=${item.category[0].jump_id}&type=1&bet_type=${item.bet_type}`
|
|
|
- );
|
|
|
- return;
|
|
|
- }
|
|
|
- setActive(index);
|
|
|
+ const selectHandler = (index?: String) => {
|
|
|
+ // if (item.bet_type === 2 || item.bet_type === 3) {
|
|
|
+ // router.push(
|
|
|
+ // `/gameList/?gameListFlag=${item.category[0].jump_id}&type=1&bet_type=${item.bet_type}`
|
|
|
+ // );
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ setActive(index as string);
|
|
|
};
|
|
|
|
|
|
- const groupGames = tabs[active]?.category;
|
|
|
+ const groupGames = tabs[0]?.category;
|
|
|
|
|
|
return (
|
|
|
<>
|
|
|
- <div className="sticky top-[0rem] z-[3] bg-[#0b0e10] px-[.1rem] pb-[.05rem] pt-[.05rem]">
|
|
|
+ <div className="homeTabsContainer sticky top-[0rem] z-[3] bg-[var(--primary1)] px-[.1rem] pb-[.05rem] pt-[.05rem]">
|
|
|
+ <CustomTabs
|
|
|
+ items={tabData as any}
|
|
|
+ activeKey={active}
|
|
|
+ onChanage={selectHandler}
|
|
|
+ ></CustomTabs>
|
|
|
+ </div>
|
|
|
+ {/* <div className="sticky top-[0rem] z-[3] bg-[var(--primary1)] px-[.1rem] pb-[.05rem] pt-[.05rem]">
|
|
|
<Swiper
|
|
|
slidesPerView={4.5}
|
|
|
spaceBetween={4}
|
|
@@ -200,8 +218,11 @@ const Tabs: FC<Props> = (props) => {
|
|
|
</Box>
|
|
|
</SwiperSlide>
|
|
|
))}
|
|
|
+ <div className="absolute left-[0] bg-gradient-to-r from-[var(--gradient-left6)] to-[var(--gradient-right6)]">
|
|
|
+ 2323
|
|
|
+ </div>
|
|
|
</Swiper>
|
|
|
- </div>
|
|
|
+ </div> */}
|
|
|
{/* <HomePrize data={prize}></HomePrize> */}
|
|
|
|
|
|
<HomeGames groupGames={groupGames} />
|