Commit f95a2964 by Arjun Jhukal

displayed the verifying status in the user profile

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