Commit a33bf789 by Arjun Jhukal

updated the new changes from client

parent cdfeb8d1
...@@ -4,13 +4,13 @@ import SilverCoinIcon from '@/icons/SilverCoinIcon' ...@@ -4,13 +4,13 @@ import SilverCoinIcon from '@/icons/SilverCoinIcon'
import { useGetUserBalanceQuery } from '@/services/userApi' import { useGetUserBalanceQuery } from '@/services/userApi'
import { UserBalance } from '@/types/user' import { UserBalance } from '@/types/user'
import { Box, Popper, Paper, Fade, ClickAwayListener, IconButton } from '@mui/material' import { Box, Popper, Paper, Fade, ClickAwayListener, IconButton } from '@mui/material'
import { CloseCircle } from '@wandersonalwes/iconsax-react' import { CloseCircle, Refresh } from '@wandersonalwes/iconsax-react'
import Image from 'next/image' import Image from 'next/image'
import Link from 'next/link' import Link from 'next/link'
import React from 'react' import React from 'react'
export default function UserCoinCard() { export default function UserCoinCard() {
const { data, isLoading } = useGetUserBalanceQuery(); const { data, isLoading, refetch, isFetching } = useGetUserBalanceQuery();
const [goldCoinPopperOpen, setGoldCoinPopperOpen] = React.useState(false); const [goldCoinPopperOpen, setGoldCoinPopperOpen] = React.useState(false);
const [sweepsCoinPopperOpen, setSweepsCoinPopperOpen] = React.useState(false); const [sweepsCoinPopperOpen, setSweepsCoinPopperOpen] = React.useState(false);
...@@ -65,6 +65,9 @@ export default function UserCoinCard() { ...@@ -65,6 +65,9 @@ export default function UserCoinCard() {
<h2 className="text-[24px] leading-[120%] text-white">{data?.data[1]?.value || 0}</h2> <h2 className="text-[24px] leading-[120%] text-white">{data?.data[1]?.value || 0}</h2>
<p className="text-[11px] text-[rgba(255,255,255,0.8)]">Gold Coins</p> <p className="text-[11px] text-[rgba(255,255,255,0.8)]">Gold Coins</p>
</div> </div>
<IconButton onClick={() => refetch()} disabled={isLoading || isFetching}>
<Refresh size={20} className={isLoading || isFetching ? 'animate-spin' : ''} />
</IconButton>
</div> </div>
<div className="content"> <div className="content">
<p className="text-[11px] text-[rgba(255,255,255,0.8)] mb-6">Gold coins can be used to play all the games under the bonus categories. Enjoy all the bonus games and earn more coins.</p> <p className="text-[11px] text-[rgba(255,255,255,0.8)] mb-6">Gold coins can be used to play all the games under the bonus categories. Enjoy all the bonus games and earn more coins.</p>
...@@ -121,6 +124,9 @@ export default function UserCoinCard() { ...@@ -121,6 +124,9 @@ export default function UserCoinCard() {
<h2 className="text-[24px] leading-[120%] text-white">{data?.data[0]?.value || 0}</h2> <h2 className="text-[24px] leading-[120%] text-white">{data?.data[0]?.value || 0}</h2>
<p className="text-[11px] text-[rgba(255,255,255,0.8)]">Sweeps Coins</p> <p className="text-[11px] text-[rgba(255,255,255,0.8)]">Sweeps Coins</p>
</div> </div>
<IconButton onClick={() => refetch()} disabled={isLoading || isFetching}>
<Refresh size={20} className={isLoading || isFetching ? 'animate-spin' : ''} />
</IconButton>
</div> </div>
<div className="flex flex-col gap-3"> <div className="flex flex-col gap-3">
......
...@@ -8,7 +8,7 @@ export default function GameCredentialsBlock({ game }: { game: any }) { ...@@ -8,7 +8,7 @@ export default function GameCredentialsBlock({ game }: { game: any }) {
const user = useAppSelector((s) => s ? s.auth.user : ""); const user = useAppSelector((s) => s ? s.auth.user : "");
if (!user) { if (!user) {
return ""; return "";
} }
return ( return (
<div className="game_cred "> <div className="game_cred ">
......
...@@ -17,8 +17,6 @@ import GameCredentialsBlock from "./GameCredentialsBlock"; ...@@ -17,8 +17,6 @@ import GameCredentialsBlock from "./GameCredentialsBlock";
export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse }) { export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse }) {
return ( return (
<> <>
<section className="detail__banner mb-8"> <section className="detail__banner mb-8">
...@@ -81,7 +79,7 @@ export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse ...@@ -81,7 +79,7 @@ export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse
) )
: game?.data?.game_url : game?.data?.game_url
? ( ? (
<ProtectedLink className="ss-btn bg-primary-grad" href={game.data.game_url} target={game?.data?.has_redirection ? "_blank" : "_self"} rel={game?.data?.has_redirection ? "noopener noreferrer" : ""}> <ProtectedLink className="ss-btn bg-primary-grad" href={game.data.game_url} target={game?.data?.has_redirection ? true : false} rel={game?.data?.has_redirection ? "noopener noreferrer" : ""}>
Play Now Play Now
</ProtectedLink> </ProtectedLink>
) )
...@@ -100,7 +98,7 @@ export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse ...@@ -100,7 +98,7 @@ export default function ExclusiveGameDetail({ game }: { game: SingleGameResponse
<div className="section__title"> <div className="section__title">
<h2 className="text-[14px] lg:text-[16px] mb-4">{game?.data?.name}</h2> <h2 className="text-[14px] lg:text-[16px] mb-4">{game?.data?.name}</h2>
</div> </div>
<CustomLightGallery images={game?.data?.subgames} column={7} aspectRatio="aspect-[212/120]" /> <CustomLightGallery images={game?.data?.subgames} column={7} aspectRatio="aspect-[242/242]" />
</section> : ""} </section> : ""}
</> </>
); );
......
...@@ -8,7 +8,7 @@ interface Props { ...@@ -8,7 +8,7 @@ interface Props {
href: string; href: string;
className?: string; className?: string;
children: React.ReactNode; children: React.ReactNode;
target?: string; target?: boolean;
rel?: string; rel?: string;
} }
...@@ -18,17 +18,19 @@ export default function ProtectedLink({ href, className, children, target, rel } ...@@ -18,17 +18,19 @@ export default function ProtectedLink({ href, className, children, target, rel }
const router = useRouter(); const router = useRouter();
const handleClick = (e: React.MouseEvent) => { const handleClick = (e: React.MouseEvent) => {
e.preventDefault(); if (!user) {
if (user) { e.preventDefault();
router.push(href);
} else {
// dispatch(openAuthModal());
router.push("/login"); router.push("/login");
return;
}
if (target) {
return;
} }
}; };
return ( return (
<a href={href} onClick={handleClick} className={className} target={target} rel={rel}> <a href={href} onClick={handleClick} className={className} target={target ? "_blank" : "_self"} rel={rel}>
{children} {children}
</a> </a>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment