turkmentv_front/app/(main)/lottery/page.tsx

43 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-12-23 19:13:36 +00:00
"use client";
import { useLotteryAuth } from "@/store/useLotteryAuth";
import ProtectedRoute from "@/components/lottery/auth/ProtectedRoute";
2024-12-23 19:32:36 +00:00
import { useLottery } from "@/lib/hooks/useLottery";
import { LOTTERY_CONFIG } from "@/constants/lottery";
import LotteryHeader from "@/components/lottery/LotteryHeader";
import LotteryCounter from "@/components/lottery/RollingCounter/RollingCounter";
2024-12-23 19:13:36 +00:00
import LotteryWinnersSection from "@/components/lottery/LotteryWinnersSection";
import LotteryRulesSection from "@/components/lottery/rules/LotteryRulesSection";
2024-12-23 19:32:36 +00:00
const LotteryPage = () => {
2024-12-23 19:13:36 +00:00
const { lotteryData } = useLotteryAuth();
2024-12-23 19:32:36 +00:00
const { status, currentNumber } = useLottery(
LOTTERY_CONFIG.START_DATE,
LOTTERY_CONFIG.END_DATE
);
2024-12-23 19:13:36 +00:00
return (
<ProtectedRoute>
<div className="flex flex-col md:gap-[128px] gap-[80px] font-roboto md:pt-[64px] sm:pt-[48px] pt-[40px] pb-[128px] text-lightOnSurface">
{lotteryData && (
2024-12-23 19:32:36 +00:00
<LotteryHeader
title={lotteryData.data.title}
description={lotteryData.data.description}
image={lotteryData.data.image}
smsCode={lotteryData.data.sms_code}
/>
2024-12-23 19:13:36 +00:00
)}
<LotteryRulesSection />
2024-12-23 19:32:36 +00:00
{(status === "ended" || status === "started") && (
<LotteryWinnersSection />
)}
2024-12-23 19:13:36 +00:00
</div>
</ProtectedRoute>
);
};
2024-12-23 19:32:36 +00:00
export default LotteryPage;