|
@@ -1,16 +1,16 @@
|
|
|
"use client";
|
|
|
import { Category, GameListRep, GameRequest } from "@/api/home";
|
|
|
+import { userInfoApi } from "@/api/login";
|
|
|
import Box from "@/components/Box";
|
|
|
import useGame from "@/hooks/useGame";
|
|
|
import { useRouter } from "@/i18n/routing";
|
|
|
import { useWalletStore } from "@/stores/useWalletStore";
|
|
|
import { getToken } from "@/utils/Cookies";
|
|
|
-import { Button, CenterPopup, Popup } from "antd-mobile";
|
|
|
+import { Button, Popup } from "antd-mobile";
|
|
|
import { useTranslations } from "next-intl";
|
|
|
import { FC, PropsWithChildren, ReactNode, useEffect, useRef, useState } from "react";
|
|
|
-import styles from "./style.module.scss";
|
|
|
-import { userInfoApi } from "@/api/login";
|
|
|
import TipsModal, { ModalProps } from "../TipsModal";
|
|
|
+import styles from "./style.module.scss";
|
|
|
export interface CardProps {
|
|
|
item?: GameListRep;
|
|
|
render?: (value: GameListRep) => ReactNode;
|
|
@@ -26,8 +26,8 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const brandRef = useRef<GameListRep | null>(null);
|
|
|
const wallet = useWalletStore((state) => state.wallet);
|
|
|
// 判断是否有未结算的对局
|
|
|
- const gameModelRef = useRef<ModalProps>(null)
|
|
|
- const gameRef = useRef<GameListRep & { mode: GameRequest["mode"] } | null>(null);
|
|
|
+ const gameModelRef = useRef<ModalProps>(null);
|
|
|
+ const gameRef = useRef<(GameListRep & { mode: GameRequest["mode"] }) | null>(null);
|
|
|
|
|
|
const [visible, setVisible] = useState(false);
|
|
|
const element = useRef<HTMLElement | null>(null);
|
|
@@ -66,34 +66,34 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const play_list = data?.play_list.map((item: any) => {
|
|
|
return {
|
|
|
...item,
|
|
|
- mode: 1
|
|
|
- }
|
|
|
- })
|
|
|
+ mode: 1,
|
|
|
+ };
|
|
|
+ });
|
|
|
const free_game_list = data?.free_game_list.map((item: any) => {
|
|
|
return {
|
|
|
...item,
|
|
|
- mode: 2
|
|
|
- }
|
|
|
- })
|
|
|
+ mode: 2,
|
|
|
+ };
|
|
|
+ });
|
|
|
const lose_game_list = data?.lose_game_list.map((item: any) => {
|
|
|
return {
|
|
|
...item,
|
|
|
- mode: 3
|
|
|
- }
|
|
|
- })
|
|
|
- let gameList = [...free_game_list, ...lose_game_list]
|
|
|
+ mode: 3,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ let gameList = [...free_game_list, ...lose_game_list];
|
|
|
if (groupType === 2) {
|
|
|
- gameList = [...play_list, ...lose_game_list]
|
|
|
+ gameList = [...play_list, ...lose_game_list];
|
|
|
}
|
|
|
if (groupType === 3) {
|
|
|
- gameList = [...play_list, ...free_game_list]
|
|
|
+ gameList = [...play_list, ...free_game_list];
|
|
|
}
|
|
|
- let unfinishedGame = gameList.find((item: { id: number }) => item?.id === game.id)
|
|
|
+ let unfinishedGame = gameList.find((item: { id: number }) => item?.id === game.id);
|
|
|
if (unfinishedGame) {
|
|
|
- gameRef.current = unfinishedGame
|
|
|
+ gameRef.current = unfinishedGame;
|
|
|
setVisible(false);
|
|
|
- gameModelRef.current?.onOpen()
|
|
|
- return
|
|
|
+ gameModelRef.current?.onOpen();
|
|
|
+ return;
|
|
|
}
|
|
|
getGameUrl(brandRef.current!, params);
|
|
|
};
|
|
@@ -101,9 +101,9 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
const goGame = () => {
|
|
|
getGameUrl(gameRef.current!, {
|
|
|
id: gameRef.current?.id + "",
|
|
|
- mode: gameRef.current?.mode!
|
|
|
+ mode: gameRef.current?.mode!,
|
|
|
});
|
|
|
- }
|
|
|
+ };
|
|
|
return (
|
|
|
<>
|
|
|
{render ? (
|
|
@@ -134,17 +134,18 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
<div className={styles.cardWrap} style={{ width: "1.1rem" }}>
|
|
|
<img
|
|
|
src={item?.game_icon}
|
|
|
- alt={item?.game_name_cn + '-' + item?.category_name}
|
|
|
+ alt={item?.game_name + "-" + item?.category_name}
|
|
|
className={"h-[100%] w-[100%]"}
|
|
|
/>
|
|
|
</div>
|
|
|
<div className={styles.cardWrapGmeInfo}>
|
|
|
- <p className={"h-[0.6rem]"}>{item?.game_name_cn}</p>
|
|
|
+ <p className={"h-[0.6rem]"}>{item?.game_name}</p>
|
|
|
|
|
|
<div className={"flex w-[2.2rem] justify-around"}>
|
|
|
{/* 只是PG游戏展示demo试玩按钮 */}
|
|
|
- {
|
|
|
- (item?.category_name === 'Pragmaticplay' || item?.category_name === 'PP') && <Button
|
|
|
+ {(item?.category_name === "Pragmaticplay" ||
|
|
|
+ item?.category_name === "PP") && (
|
|
|
+ <Button
|
|
|
onClick={() => playGameHandler({ ...item!, demo: 1 })}
|
|
|
className={
|
|
|
"h-[0.39rem] w-[0.89rem] rounded-[0.05rem] text-[0.15rem]" +
|
|
@@ -154,7 +155,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
|
|
|
>
|
|
|
{t("demo")}
|
|
|
</Button>
|
|
|
- }
|
|
|
+ )}
|
|
|
<Button
|
|
|
onClick={() => playGameHandler(item!)}
|
|
|
style={{
|