Commit f95a2964 by Arjun Jhukal

displayed the verifying status in the user profile

parent b01ec1f2
import Avatar from '@/components/atom/Avatar';
import { useAppDispatch, useAppSelector } from '@/hooks/hook';
import { PATH } from '@/routes/PATH';
import { useGetAgeGateUuidQuery } from '@/services/authApi';
import { clearTokens } from '@/slice/authSlice';
import { Box, ClickAwayListener, Fade, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Paper, Popper } from '@mui/material';
import { ArrowDown2, Coin, Logout, MoneySend, Profile, Wallet2 } from "@wandersonalwes/iconsax-react";
import { ArrowDown2, Coin, Logout, MoneySend, Profile, TickCircle, Wallet2 } from "@wandersonalwes/iconsax-react";
import Link from 'next/link';
import { usePathname, useRouter, useSearchParams } from 'next/navigation';
import React, { useRef, useState } from 'react';
......@@ -104,6 +105,9 @@ export default function ProfileBlock() {
const handleMouseLeave = () => {
setGlassStyle((prev) => ({ ...prev, opacity: 0 }));
};
const { data } = useGetAgeGateUuidQuery();
return (
<Box >
<a
......@@ -117,7 +121,7 @@ export default function ProfileBlock() {
padding: 0
}}
>
<div className=' lg:flex items-center gap-1'>
<div className=' lg:flex items-center gap-1 relative'>
<Avatar alt="profile user" src={avataur1} />
{user?.role && user.role.toLowerCase() !== "user" ? <>
<div className=' hidden lg:block'>
......@@ -128,6 +132,9 @@ export default function ProfileBlock() {
</div>
<ArrowDown2 size={14} className='text-primary hidden lg:block' />
</> : ""}
<div className="absolute bottom-0 right-0">
{data?.data?.is_age_verified ? <TickCircle variant='Bold' size={16} className="text-green-500" /> : <TickCircle variant='Bold' size={16} className="text-white" />}
</div>
</div>
</a>
<Popper
......
......@@ -6,7 +6,6 @@ import { useCallback, useEffect } from "react";
export default function AgeGate() {
const { data, isSuccess } = useGetAgeGateUuidQuery();
const [verifyAgeGate] = useVerifyAgeGateMutation();
const handleSuccess = useCallback(async (uuid: string) => {
try {
await verifyAgeGate({ age_verify_uuid: uuid }).unwrap();
......@@ -38,14 +37,11 @@ export default function AgeGate() {
},
onpagehide: () => {
(window as any).AgeCheckerAPI.close();
// Optional: Handle page hide if needed
}
};
// 3. Now load the script
const existing = document.querySelector('script[src*="agechecker.net"]');
if (existing) {
// Script already loaded, just show
(window as any).AgeCheckerAPI?.show(uuid);
return;
}
......
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