From 318fb775a407fa82986d214424b601b18220683a Mon Sep 17 00:00:00 2001 From: Kakabay <2kakabayashyrberdyew@gmail.com> Date: Fri, 24 Jan 2025 18:20:37 +0500 Subject: [PATCH] text content cahnged --- components/lottery/auth/LotteryAuthForm.tsx | 66 ++++++++++--------- .../lottery/rules/LotteryRulesSection.tsx | 13 ++-- 2 files changed, 40 insertions(+), 39 deletions(-) diff --git a/components/lottery/auth/LotteryAuthForm.tsx b/components/lottery/auth/LotteryAuthForm.tsx index e043364..2a57b75 100644 --- a/components/lottery/auth/LotteryAuthForm.tsx +++ b/components/lottery/auth/LotteryAuthForm.tsx @@ -1,13 +1,13 @@ -'use client'; +"use client"; -import { Queries } from '@/api/queries'; -import { useState, FormEvent } from 'react'; -import { useRouter } from 'next/navigation'; -import { useLotteryAuth } from '@/store/useLotteryAuth'; +import { Queries } from "@/api/queries"; +import { useState, FormEvent } from "react"; +import { useRouter } from "next/navigation"; +import { useLotteryAuth } from "@/store/useLotteryAuth"; const LotteryAuthForm = () => { - const [phone, setPhone] = useState(''); - const [code, setCode] = useState(''); + const [phone, setPhone] = useState(""); + const [code, setCode] = useState(""); const [error, setError] = useState(null); const [isLoading, setIsLoading] = useState(false); const router = useRouter(); @@ -17,9 +17,6 @@ const LotteryAuthForm = () => { const phoneRegex = /^993\d{8}$/; const isValid = phoneRegex.test(value); - console.log('Phone Input:', value); - console.log('Regex Check Result:', isValid); - return isValid; }; @@ -27,9 +24,6 @@ const LotteryAuthForm = () => { const codeRegex = /^.+-\d{10}$/; // Any characters before "-", exactly 10 digits after const isValid = codeRegex.test(value); - console.log('Code Input:', value); - console.log('Regex Check Result:', isValid); - return isValid; }; @@ -37,15 +31,13 @@ const LotteryAuthForm = () => { e.preventDefault(); setError(null); - console.log('Submitting Phone:', phone); - if (!validatePhone(phone)) { - setError('Telefon belgisi nädogry'); + setError("Telefon belgisi nädogry"); return; } if (!validateCode(code)) { - setError('Açar nädogry'); + setError("Açar nädogry"); return; } @@ -55,24 +47,24 @@ const LotteryAuthForm = () => { const response = await Queries.authenticateLottery(phone, code); if (response.errorMessage) { - setError('Telefon belgisi ýa-da açar nädogry'); + setError(response.errorMessage); } else { - localStorage.setItem('lotteryPhone', phone); - localStorage.setItem('lotteryCode', code); + localStorage.setItem("lotteryPhone", phone); + localStorage.setItem("lotteryCode", code); setAuth(response, phone, code); - router.replace('/lottery'); + router.replace("/lottery"); } } catch (err) { - console.error('Authentication error:', err); - setError('Telefon belgisi ýa-da açar nädogry'); + console.error("Authentication error:", err); + setError("Telefon belgisi ýa-da açar nädogry"); } finally { setIsLoading(false); } }; const handlePhoneChange = (e: React.ChangeEvent) => { - const value = e.target.value.replace(/\\D/g, ''); + const value = e.target.value.replace(/\\D/g, ""); if (value.length <= 11) { setPhone(value); } @@ -88,13 +80,17 @@ const LotteryAuthForm = () => { return (
+ className="bg-lightSurfaceContainer rounded-[24px] md:p-[40px] sm:p-[24px] p-[16px] w-[530px] flex flex-col gap-[24px]" + >

- Lotereýa giriş + Giriş

-
-
- {error &&

{error}

} + {error && ( +

+ {error} +

+ )}
); diff --git a/components/lottery/rules/LotteryRulesSection.tsx b/components/lottery/rules/LotteryRulesSection.tsx index 7c3e2fa..6fa65fd 100644 --- a/components/lottery/rules/LotteryRulesSection.tsx +++ b/components/lottery/rules/LotteryRulesSection.tsx @@ -1,4 +1,4 @@ -import { useLotteryAuth } from '@/store/useLotteryAuth'; +import { useLotteryAuth } from "@/store/useLotteryAuth"; interface IProps { title: string; @@ -13,18 +13,15 @@ const LotteryRulesSection = () => {

- Bijäniň düzgünleri: + Düzgünleri:

-
-

- Umumy düzgünler: -

+
    {lotteryData?.data.rules?.map((item, i) => (
  • - {item.content} + {item.title}
  • ))}
@@ -32,7 +29,7 @@ const LotteryRulesSection = () => {

- Siziň açar sözleriňiz: + Siziň kodlaryňyz:

    {lotteryData?.user_lottery_numbers.map((item, i) => (