cimmit
This commit is contained in:
parent
f82fb4da08
commit
db2c990744
|
|
@ -1,90 +1,90 @@
|
||||||
// 'use client';
|
'use client';
|
||||||
// import PrizeCard from '@/components/prizes/PrizeCard';
|
import PrizeCard from '@/components/prizes/PrizeCard';
|
||||||
// import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
// import axios from 'axios';
|
import axios from 'axios';
|
||||||
// import { useQuery, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||||
// import { GiftsType } from '@/typings/gifts/gifts.type';
|
import { GiftsType } from '@/typings/gifts/gifts.type';
|
||||||
// import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
// // Define the expected shape of the fetched data
|
// Define the expected shape of the fetched data
|
||||||
// interface Prize {
|
interface Prize {
|
||||||
// id: number;
|
id: number;
|
||||||
// name: string;
|
name: string;
|
||||||
// description: string;
|
description: string;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const PrizesPage = ({ params }: { params: { user_id: string } }) => {
|
const PrizesPage = ({ params }: { params: { user_id: string } }) => {
|
||||||
// const [selectedPrize, setSelectedPrize] = useState<null | number>(null);
|
const [selectedPrize, setSelectedPrize] = useState<null | number>(null);
|
||||||
// const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
// const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
// // Fetching data using TanStack Query
|
// Fetching data using TanStack Query
|
||||||
// const { data, isLoading, error } = useQuery<GiftsType, Error>(
|
const { data, isLoading, error } = useQuery<GiftsType, Error>(
|
||||||
// [`gifts-${params.user_id}`, params.user_id], // Query key using user_id
|
[`gifts-${params.user_id}`, params.user_id], // Query key using user_id
|
||||||
// () =>
|
() =>
|
||||||
// axios
|
axios
|
||||||
// .get(`https://sms.turkmentv.gov.tm/api/gifts/${params.user_id}`)
|
.get(`https://sms.turkmentv.gov.tm/api/gifts/${params.user_id}`)
|
||||||
// .then((response) => response.data),
|
.then((response) => response.data),
|
||||||
// {
|
{
|
||||||
// // Handle error with onError callback to trigger the redirect
|
// Handle error with onError callback to trigger the redirect
|
||||||
// onError: () => {
|
onError: () => {
|
||||||
// router.push('/prizes/auth');
|
router.push('/prizes/auth');
|
||||||
// },
|
},
|
||||||
// },
|
},
|
||||||
// );
|
);
|
||||||
|
|
||||||
// if (isLoading)
|
if (isLoading)
|
||||||
// return (
|
return (
|
||||||
// <div className="flex justify-center items-center h-full text-heading2 leading-heading2 font-medium min-h-[50vh]">
|
<div className="flex justify-center items-center h-full text-heading2 leading-heading2 font-medium min-h-[50vh]">
|
||||||
// Loading...
|
Loading...
|
||||||
// </div>
|
</div>
|
||||||
// );
|
);
|
||||||
|
|
||||||
// // Log the error to the console, even if redirecting
|
// Log the error to the console, even if redirecting
|
||||||
// if (error) {
|
if (error) {
|
||||||
// console.error('Error loading prizes:', error.message);
|
console.error('Error loading prizes:', error.message);
|
||||||
// return null; // Return null since the redirect will occur
|
return null; // Return null since the redirect will occur
|
||||||
// }
|
}
|
||||||
|
|
||||||
// return (
|
// return (
|
||||||
// <div className="flex flex-col gap-[32px] md:gap-[64px] items-center">
|
// <div className="flex flex-col gap-[32px] md:gap-[64px] items-center">
|
||||||
// <header className="flex flex-col gap-[24px]">
|
// <header className="flex flex-col gap-[24px]">
|
||||||
// <div className="flex flex-col gap-[8px] max-w-[639px] w-full">
|
// <div className="flex flex-col gap-[8px] max-w-[639px] w-full">
|
||||||
// <h1 className="text-lightOnSurface text-heading1 leading-heading1 md:text-display1 md:leading-display1 tracking-[-1%] text-center font-medium">
|
// <h1 className="text-lightOnSurface text-heading1 leading-heading1 md:text-display1 md:leading-display1 tracking-[-1%] text-center font-medium">
|
||||||
// {data.data.title}
|
// {data.data.title}
|
||||||
// </h1>
|
// </h1>
|
||||||
// <p className="text-center text-textSmall leading-textSmall md:text-textBase md:leading-textBase tracking-[-1%] text-lightOnSurface">
|
// <p className="text-center text-textSmall leading-textSmall md:text-textBase md:leading-textBase tracking-[-1%] text-lightOnSurface">
|
||||||
// Поздравляю с победой в викторине! Вы стали победителем и получаете возможность выбрать
|
// Поздравляю с победой в викторине! Вы стали победителем и получаете возможность выбрать
|
||||||
// подарок по своему выбору. Пожалуйста, ознакомьтесь с доступными вариантами подарков и
|
// подарок по своему выбору. Пожалуйста, ознакомьтесь с доступными вариантами подарков и
|
||||||
// сообщите нам ваше предпочтение. С нетерпением ждем вашего выбора, чтобы доставить вам
|
// сообщите нам ваше предпочтение. С нетерпением ждем вашего выбора, чтобы доставить вам
|
||||||
// заслуженный приз!
|
// заслуженный приз!
|
||||||
// </p>
|
// </p>
|
||||||
// </div>
|
// </div>
|
||||||
// <p className="text-center text-textXSmall leading-textXSmall md:text-textSmall md:leading-textSmall tracking-[0.4px] md:-tracking-[1%] text-lightOnSurface">
|
// <p className="text-center text-textXSmall leading-textXSmall md:text-textSmall md:leading-textSmall tracking-[0.4px] md:-tracking-[1%] text-lightOnSurface">
|
||||||
// Есть вопросы? Обратись XYXYXY!
|
// Есть вопросы? Обратись XYXYXY!
|
||||||
// </p>
|
// </p>
|
||||||
// </header>
|
// </header>
|
||||||
// <div className="flex flex-col gap-[24px] md:gap-[16px] items-center max-w-[832px] w-full">
|
// <div className="flex flex-col gap-[24px] md:gap-[16px] items-center max-w-[832px] w-full">
|
||||||
// {data.data.gifts &&
|
// {data.data.gifts &&
|
||||||
// data.data.gifts.map((prize, i) => (
|
// data.data.gifts.map((prize, i) => (
|
||||||
// <PrizeCard
|
// <PrizeCard
|
||||||
// key={prize.id}
|
// key={prize.id}
|
||||||
// variant={
|
// variant={
|
||||||
// selectedPrize === null
|
// selectedPrize === null
|
||||||
// ? 'default'
|
// ? 'default'
|
||||||
// : selectedPrize === prize.id
|
// : selectedPrize === prize.id
|
||||||
// ? 'selected'
|
// ? 'selected'
|
||||||
// : 'disabled'
|
// : 'disabled'
|
||||||
// }
|
// }
|
||||||
// setSelectedPrize={setSelectedPrize}
|
// setSelectedPrize={setSelectedPrize}
|
||||||
// id={prize.id}
|
// id={prize.id}
|
||||||
// code={params.user_id}
|
// code={params.user_id}
|
||||||
// {...prize}
|
// {...prize}
|
||||||
// />
|
// />
|
||||||
// ))}
|
// ))}
|
||||||
// </div>
|
// </div>
|
||||||
// </div>
|
// </div>
|
||||||
// );
|
// );
|
||||||
// };
|
};
|
||||||
|
|
||||||
// export default PrizesPage;
|
export default PrizesPage;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
// import SmsForm from '@/components/prizes/SmsForm';
|
import SmsForm from '@/components/prizes/SmsForm';
|
||||||
// import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
// const page = () => {
|
const page = () => {
|
||||||
// return (
|
// return (
|
||||||
// <div className="">
|
// <div className="">
|
||||||
// <div className="flex justify-center items-center min-h-[50vh]">
|
// <div className="flex justify-center items-center min-h-[50vh]">
|
||||||
// <SmsForm />
|
// <SmsForm />
|
||||||
// </div>
|
// </div>
|
||||||
// </div>
|
// </div>
|
||||||
// );
|
// );
|
||||||
// };
|
};
|
||||||
|
|
||||||
// export default page;
|
export default page;
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ const MobileMenu = () => {
|
||||||
}}>
|
}}>
|
||||||
TV market
|
TV market
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
{/* <Link
|
||||||
href={'/prizes/auth'}
|
href={'/prizes/auth'}
|
||||||
className="block text-2xl text-white transition-all font-roboto font-bold"
|
className="block text-2xl text-white transition-all font-roboto font-bold"
|
||||||
style={path.includes('prizes') ? { color: '#FFAB48' } : {}}
|
style={path.includes('prizes') ? { color: '#FFAB48' } : {}}
|
||||||
|
|
@ -176,7 +176,7 @@ const MobileMenu = () => {
|
||||||
onClickCloseBurgerHandler();
|
onClickCloseBurgerHandler();
|
||||||
}}>
|
}}>
|
||||||
Sowgatlar
|
Sowgatlar
|
||||||
</Link>
|
</Link> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -140,13 +140,13 @@ const Nav = () => {
|
||||||
onClick={() => setDropDownOpened(false)}>
|
onClick={() => setDropDownOpened(false)}>
|
||||||
SMS ulgamy
|
SMS ulgamy
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
{/* <Link
|
||||||
href={'/prizes/auth'}
|
href={'/prizes/auth'}
|
||||||
className="block min-w-fit text-lg text-white transition-all font-roboto font-bold"
|
className="block min-w-fit text-lg text-white transition-all font-roboto font-bold"
|
||||||
style={path.includes('/prizes/auth') ? { color: '#FFAB48' } : {}}
|
style={path.includes('/prizes/auth') ? { color: '#FFAB48' } : {}}
|
||||||
onClick={() => setDropDownOpened(false)}>
|
onClick={() => setDropDownOpened(false)}>
|
||||||
Sowgatlar
|
Sowgatlar
|
||||||
</Link>
|
</Link> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue