edit referrals page, add referrals fetch functions

This commit is contained in:
smanylov
2026-02-07 14:31:04 +07:00
parent 7572c1ada2
commit 0ec7834cc5
11 changed files with 273 additions and 70 deletions
+21
View File
@@ -11,8 +11,25 @@ import navigation from './navigation.json';
import { useSideMenuStore } from '@/app/stores/sideMenuStore';
import { useRef } from 'react';
import { useClickOutside } from '@/app/hooks/useClickOutside';
import { fetchReferralUserStats } from '@/app/actions/referralsActions';
import { useQuery } from '@tanstack/react-query';
export default function NavLinks() {
const {
data: referralLink,
isLoading,
isError,
error
} = useQuery({
queryKey: ['referralUserStats'],
queryFn: () => {
return fetchReferralUserStats();
},
select: (data) => {
return data?.referralLink;
}
});
const pathname = usePathname().replace('/en/', '/').replace('/ru/', '/');
const t = useTranslations('Global');
@@ -69,6 +86,10 @@ export default function NavLinks() {
<DropDownList />
{links.map((link) => {
if (!referralLink && link.name === 'referral-program') {
return null;
}
return (
<Link
key={link.name}