diff --git a/app/(main)/cekilis/auth/page.tsx b/app/(main)/b/auth/page.tsx
similarity index 100%
rename from app/(main)/cekilis/auth/page.tsx
rename to app/(main)/b/auth/page.tsx
diff --git a/app/(main)/cekilis/page.tsx b/app/(main)/b/page.tsx
similarity index 100%
rename from app/(main)/cekilis/page.tsx
rename to app/(main)/b/page.tsx
diff --git a/components/MobileMenu.tsx b/components/MobileMenu.tsx
index f1f76bb..82a4b29 100644
--- a/components/MobileMenu.tsx
+++ b/components/MobileMenu.tsx
@@ -1,12 +1,12 @@
-'use client';
-import Image from 'next/image';
-import Link from 'next/link';
-import { usePathname } from 'next/navigation';
-import { useContext, useEffect, useRef, useState } from 'react';
-import GlobalContext from '@/context/GlobalContext';
-import close from '@/public/close-white.svg';
+"use client";
+import Image from "next/image";
+import Link from "next/link";
+import { usePathname } from "next/navigation";
+import { useContext, useEffect, useRef, useState } from "react";
+import GlobalContext from "@/context/GlobalContext";
+import close from "@/public/close-white.svg";
const MobileMenu = () => {
- const path = usePathname() ?? '/';
+ const path = usePathname() ?? "/";
const { burgerOpen, setBurgerOpen } = useContext(GlobalContext).burgerContext;
const onClickCloseBurgerHandler = () => {
@@ -18,17 +18,20 @@ const MobileMenu = () => {
useEffect(() => {
const handleOutsideClick = (event: MouseEvent) => {
- if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
+ if (
+ dropdownRef.current &&
+ !dropdownRef.current.contains(event.target as Node)
+ ) {
setDropDownOpened(false);
}
};
// Attach the event listener to the document
- document.addEventListener('click', handleOutsideClick);
+ document.addEventListener("click", handleOutsideClick);
// Cleanup the event listener when the component unmounts
return () => {
- document.removeEventListener('click', handleOutsideClick);
+ document.removeEventListener("click", handleOutsideClick);
};
}, []);
@@ -39,10 +42,10 @@ const MobileMenu = () => {
-
+
{
setBurgerOpen(false)}>
+ onClick={() => setBurgerOpen(false)}
+ >
@@ -69,41 +73,47 @@ const MobileMenu = () => {
*/}
onClickCloseBurgerHandler()}
className="block text-3xl text-white transition-all font-roboto font-bold dark:text-white"
style={
- path.includes('treasury') || path.includes('video/')
- ? { color: '#FFAB48' }
+ path.includes("treasury") || path.includes("video/")
+ ? { color: "#FFAB48" }
: {}
- }>
+ }
+ >
Hazyna
onClickCloseBurgerHandler()}
className="block text-3xl text-white transition-all font-roboto font-bold dark:text-white"
- style={path.includes('live') ? { color: '#FFAB48' } : {}}>
+ style={path.includes("live") ? { color: "#FFAB48" } : {}}
+ >
Göni Ýaýlym
onClickCloseBurgerHandler()}
className="block text-3xl text-white transition-all font-roboto font-bold dark:text-white"
- style={path.includes('advert') ? { color: '#FFAB48' } : {}}>
+ style={path.includes("advert") ? { color: "#FFAB48" } : {}}
+ >
Mahabat
onClickCloseBurgerHandler()}
- style={path.includes('contact_us') ? { color: '#FFAB48' } : {}}
- className="font-roboto font-bold text-white text-3xl dark:text-white transition-all">
+ style={
+ path.includes("contact_us") ? { color: "#FFAB48" } : {}
+ }
+ className="font-roboto font-bold text-white text-3xl dark:text-white transition-all"
+ >
Habarlaşmak üçin
@@ -111,7 +121,8 @@ const MobileMenu = () => {
setDropDownOpened(!dropDownOpened)}>
+ onClick={() => setDropDownOpened(!dropDownOpened)}
+ >
Interaktiw
@@ -123,8 +134,9 @@ const MobileMenu = () => {
viewBox="0 0 24 24"
fill="none"
className={`${
- dropDownOpened ? '' : 'rotate-180'
- } transition-all ease-in duration-150`}>
+ dropDownOpened ? "" : "rotate-180"
+ } transition-all ease-in duration-150`}
+ >
{
+ ? "h-fit opacity-100 pointer-events-auto py-[16px] px-[24px]"
+ : " h-0 opacity-0 pointer-events-none"
+ }`}
+ >
{
setDropDownOpened(false);
onClickCloseBurgerHandler();
- }}>
+ }}
+ >
Bäsleşik
{
setDropDownOpened(false);
onClickCloseBurgerHandler();
- }}>
+ }}
+ >
Ses bermek
{
setDropDownOpened(false);
onClickCloseBurgerHandler();
- }}>
+ }}
+ >
TV market
{
setDropDownOpened(false);
onClickCloseBurgerHandler();
- }}>
+ }}
+ >
Sowgatlar
{
setDropDownOpened(false);
onClickCloseBurgerHandler();
- }}>
+ }}
+ >
Bije
@@ -193,9 +217,10 @@ const MobileMenu = () => {
onClickCloseBurgerHandler()}
- className="font-roboto font-bold text-white text-3xl dark:text-white transition-all p-2 bg-red-500 rounded-lg ">
+ className="font-roboto font-bold text-white text-3xl dark:text-white transition-all p-2 bg-red-500 rounded-lg "
+ >
Ýaýlym tertibi
diff --git a/components/Nav.tsx b/components/Nav.tsx
index 8946516..f22a85a 100644
--- a/components/Nav.tsx
+++ b/components/Nav.tsx
@@ -138,9 +138,9 @@ const Nav = () => {
Sowgatlar
setDropDownOpened(false)}>
Bije
diff --git a/components/lottery/LotteryMain.tsx b/components/lottery/LotteryMain.tsx
index 84b03ec..6f571b0 100644
--- a/components/lottery/LotteryMain.tsx
+++ b/components/lottery/LotteryMain.tsx
@@ -4,36 +4,25 @@ import LotteryRulesSection from "@/components/lottery/rules/LotteryRulesSection"
import LotteryCountDown from "@/components/lottery/countDown/LotteryCountDown";
import Link from "next/link";
import { authenticateLottery } from "@/api";
-import { redirect } from "next/navigation";
+import { useRouter } from "next/navigation";
import { getLotteryStatus } from "@/lib/actions";
import LotteryWinners from "./LotteryWinners";
import { useEffect, useState } from "react";
-import { ILotteryResponse } from "@/models/lottery/lottery.model";
const LotteryMain = () => {
const [lotteryData, setLotteryData] = useState();
+ const router = useRouter();
useEffect(() => {
async function getData() {
- const phone = document.cookie
- .split("; ")
- [
- document.cookie
- .split("; ")
- .findIndex((item) => item.startsWith("phoneNumber="))
- ].split("=")[1];
- const key = document.cookie
- .split("; ")
- [
- document.cookie
- .split("; ")
- .findIndex((item) => item.startsWith("key="))
- ].split("=")[1];
+ const phone = localStorage.getItem("phoneNumber");
+ const key = localStorage.getItem("key");
if (phone && key) {
const res = await authenticateLottery(phone, key);
setLotteryData(res);
} else {
- redirect("/cekilis/auth");
+ localStorage.clear();
+ router.push("/b/auth");
}
}
@@ -77,7 +66,7 @@ const LotteryMain = () => {
Çykmak
diff --git a/components/lottery/auth/LotteryAuthForm.tsx b/components/lottery/auth/LotteryAuthForm.tsx
index f8291be..44335f4 100644
--- a/components/lottery/auth/LotteryAuthForm.tsx
+++ b/components/lottery/auth/LotteryAuthForm.tsx
@@ -36,9 +36,9 @@ const LotteryAuthForm = () => {
if (response.errorMessage) {
setError(response.errorMessage);
} else {
- document.cookie = `phoneNumber=${phoneNumber};path=/;max-age=3600;`;
- document.cookie = `key=${key};path=/;max-age=3600;`;
- router.replace("/cekilis");
+ localStorage.setItem("phoneNumber", phoneNumber);
+ localStorage.setItem("key", key);
+ router.replace("/b");
}
} catch (err) {
setError("Telefon belgisi ýa-da açar nädogry");