So Many Changes

New Product Component Made And Cmpleted
Categories Sorted With Mr.Khajis Component
Redux Changes
Cart Remove Or Decrease
OTP is Ready To use But Not Merged
main
Pedram Keshavarzi 3 years ago
parent e2508e1f6f
commit b6501aad7f
  1. 2
      src/App.js
  2. 144
      src/components/Product/index.js
  3. 50
      src/components/ShoppingCart/Product/index.js
  4. 16
      src/components/ShoppingCart/index.js
  5. 127
      src/store/index.js
  6. 292
      src/view/LoginSignUp/SignUpForm/index.js
  7. 3
      src/view/contact/index.js
  8. 22
      src/view/dashboard2/Games.js
  9. 292
      src/view/register/SignUpForm/index.js
  10. 93
      src/view/services/index.js
  11. 70
      src/view/services/service/index.js
  12. 3
      tailwind.config.js

@ -623,7 +623,7 @@ function App() {
} }
} }
} }
const [LOGIN,setLOGIN]=useState(false); const [LOGIN,setLOGIN]=useState(true);
const activeLogin=()=>{ const activeLogin=()=>{
setLOGIN(true); setLOGIN(true);
} }

@ -1,4 +1,5 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { BsExclamationSquareFill } from "react-icons/bs";
@ -33,51 +34,148 @@ const ProductDesign = ({
numberOfRegards, numberOfRegards,
productHolderHoverBorder, productHolderHoverBorder,
hoverMode, hoverMode,
teacher teacher,
btnOnClick,
catId
}) => { }) => {
const [isHovering, setIsHovering] = useState(false); const [isHovering, setIsHovering] = useState(false);
return (
<div className={`flex flex-col pt-4 text-right rounded-xl justify-start w-full m-4 border border-red82OP`}
style={ {width: '400px', direction:'rtl'}}
>
const emkanat = [
{
title: 'دستشویی',
isActive: true,
},
{
title: 'آب خوری',
isActive: true,
},
{
title: 'تخته هوشمند',
isActive: true,
},
{
title: 'کامپیوتر',
isActive: true,
},
{
title: 'کتابخانه',
isActive: true,
},
{
title: 'مشاوره تحصیلی',
isActive: true,
},
{
title: 'آزمایشگاه',
isActive: false,
},
]
if (catId == 1) {
return (
<div className={`flex flex-col pt-4 text-right rounded-xl justify-start w-full m-4 border border-red82OP`}
style={{ width: '375px', direction: 'rtl' }}
>
<div className="border-b border-red82OP pb-2 px-4"> <div className="border-b border-red82OP pb-2 px-4">
<h1 className="text-red52 text-lg font-bold">{productName}</h1> <h1 className="text-red52 text-lg font-bold">{productName}</h1>
<p className="text-red26 text-sm my-2"> <p className="text-red26 text-sm my-2">
در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد
</p> </p>
</div> </div>
<div className="flex border-b border-red82OP px-4 py-2"> <div className="flex border-b border-red82OP px-4 py-2">
<div> <div>
<h1 className="font-bold text-red26"> <h1 className="font-bold text-red26">
استاد : {teacher} استاد : {teacher}
</h1> </h1>
</div> </div>
</div> </div>
<div className="flex border-b border-red82OP px-4 py-2 text-red26"> <div className="flex border-b border-red82OP px-4 py-2 text-red26">
<h1>نوع گروه : A</h1> <h1>نوع گروه : A</h1>
</div> </div>
<div className="flex p-4 justify-between items-center"> <div className="flex p-4 justify-between items-center">
<h1 className="font-black text-xl text-red52">{productPrice} تومان</h1> <h1 className="font-black text-xl text-red52">{productPrice} تومان</h1>
<div <div
className={`bg-pinkF5 text-red26 w-32 border-2 border-red52 px-1 py-2 text-xs flex justify-center className={`bg-pinkF5 text-red26 w-32 border-2 border-red52 px-1 py-2 text-xs flex justify-center hover:bg-red52 hover:text-white
`} `}
> >
<button>افزودن به سبد خرید</button> <button onClick={btnOnClick}>افزودن به سبد خرید</button>
</div> </div>
</div>
</div>
)
}
if (catId == 2) {
return (
<div className="flex p-6 pl-0 pb-0 border border-red82OP my-4 rounded-lg" style={{width: '90%' , marginRight: '5%'}}>
<div className="h-full w-60 pl-4">
{/* image */}
<img src="https://fa.tripyar.com/uploads/picture/2977/2.jpg" className="h-full rounded-md" />
</div>
<div className="flex flex-col text-right">
<h1 className="font-bold text-red52 border-b border-red82OP pb-2">دبیرستان غیر انتفاعی مدرسان هوشمند</h1>
<p className="font-bold text-sm text-red26 border-b border-red82OP py-2">تهران خیابان انقلاب اسلامی حدفاصل ابوریحان و فلسطین پلاک2 </p>
<div className="flex border-b border-red82OP text-center">
<div className="border-l text-sm font-bold text-red26 border-red82OP p-2 pr-0">
شماره تلفن: ۰۲۱۶۶۴۵۶۷۳۸
</div>
<div className="border-l text-sm font-bold text-red26 border-red82OP p-2 px-4 text-center">
آدرس وبسایت : www.google.com
</div>
<div className="text-sm font-bold text-red26 p-2 px-4 text-center">
آدرس بروی نقشه
</div>
</div>
<div className="flex">
<div className="w-3/5 flex flex-wrap pb-6 border-l border-red82OP">
امکانات :
{
emkanat.map((item, index) => (
<div className="flex justify-center items-center p-1 px-2">
<div className={`w-6 h-6 mx-1 text-white text-sm rounded-full flex justify-center items-center ${item.isActive ? 'bg-green17' : 'bg-gray-200'}`}>
</div> <svg width="37" height="37" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.75 12L10.58 14.83L16.25 9.17004" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</div>
<p>{item.title}</p>
</div>
))
}
</div>
<div className="flex p-4 w-2/5 justify-between items-center">
<h1 className="font-black text-xl text-red52">{productPrice} تومان</h1>
<div
className={`bg-pinkF5 text-red26 w-32 border-2 border-red52 px-1 py-2 text-xs flex justify-center hover:bg-red52 hover:text-white
`}
>
<button onClick={btnOnClick}>افزودن به سبد خرید</button>
</div>
</div> </div>
</div>
</div>
); </div>
)
}
}; };
export default ProductDesign; export default ProductDesign;

@ -145,15 +145,53 @@ function Product({ product, grades, pushToCart, isMobile }) {
// /> // />
// </div> // </div>
// </div> // </div>
return( return (
<div className="flex bg-white justify-between items-center border-2 border-gray-300 p-4 rounded-xl m-2 " style={{width: '90%'}}> <div className="flex bg-white justify-between items-center border-2 border-gray-300 p-4 rounded-xl m-2 " style={{ width: '90%' }}>
<div className="flex items-center"> <div className="flex items-center">
<div className="text-sm h-10 flex items-center p-2 border-l-2 border-gray-300 text-gray-400"> {product?.productCat} </div> <div className="text-sm h-10 flex items-center p-2 border-l-2 border-gray-300 text-gray-400"> {product?.product?.book?.category} </div>
<h1 className="text-lg font-black px-2 text-black40"> {product?.product?.book?.name}</h1> <h1 className="text-lg font-black px-2 text-black40"> {product?.product?.book?.name}</h1>
</div> </div>
<div className="flex items-center">
<div className="text-sm text-black40" style={{ transform: 'translateX(-20px)' }} >
{product?.product?.price} تومان
</div>
<div
className="w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52"
style={{ transform: 'translateX(-30px)' }}
onClick={() =>
pushToCart(
{
productId: product?.productId,
userId: product?.userId,
count: -product?.count,
},
{},
{ id: product?.factorId }
)
}
>
{product.count == 1 ?<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 15.044 15.044">
<g id="vuesax_linear_card-remove" data-name="vuesax/linear/card-remove" transform="translate(-252.46 -511.461)">
<g id="card-remove" transform="translate(253.309 512.31)">
<path id="Vector" d="M0,13.347,13.347,0" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2" />
<path id="Vector-2" data-name="Vector" d="M13.347,13.347,0,0" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2" />
</g>
</g>
</svg>:
<svg width="100" height="100" viewBox="0 0 100 100">
<g stroke = "#fff" stroke-width = "5" fill="none">
<path d="M 25 50 L 75 50
M 50 5
" />
</g>
</svg>}
<div className="text-sm text-black40"> </div>
{product?.product?.price} تومان
</div> </div>
</div> </div>
); );

@ -29,11 +29,11 @@ function ShoppingCart({
}) { }) {
const [phase, setPhase] = useState("products"); const [phase, setPhase] = useState("products");
useEffect(() => {
getList(); getList();
getFactorInfo({ userId }); getFactorInfo({ userId });
setHeaderOptions(headerOptions); setHeaderOptions(headerOptions);
}, []);
// const Table = () => { // const Table = () => {
// return ( // return (
@ -222,31 +222,31 @@ function ShoppingCart({
return( return(
<div className="flex flex-col justify-between items-center bg-gray-200 left-0 pt-24" style={{height: '100vh'}}> <div className="flex flex-col justify-between items-center bg-gray-200 left-0 pt-24" style={{height: '100vh'}}>
<div className="w-full flex items-center flex-col"> <div className="w-full flex items-center flex-col">
<Product />
<Product />
{list.map((product, index) => ( {list.map((product, index) => (
<Product key={index} product={product} /> <Product key={index} product={product} />
))} ))}
</div> </div>
{/* {console.log(list)} */}
<div style={{width: '80%'}} className="mb-6"> <div style={{width: '80%'}} className="mb-6">
<Code /> <Code />
<div className="flex flex-col w-full border-t border-gray-400 my-2 py-2"> <div className="flex flex-col w-full border-t border-gray-400 my-2 py-2">
<div className="flex justify-between w-full py-2 text-blue-700 text-lg "> <div className="flex justify-between w-full py-2 text-blue-700 text-lg ">
<p>جمع مبالغ خدمات</p> <p>جمع مبالغ خدمات</p>
<p>۴۲۰۰۰۰ تومان</p> <p>{factorInfo?.sumPrice} تومان</p>
</div> </div>
<div className="flex justify-between w-full py-2 text-red26 text-lg "> <div className="flex justify-between w-full py-2 text-red26 text-lg ">
<p> تخفیف </p> <p> تخفیف </p>
<p> -۱۰۰۰۰ تومان</p> <p> {factorInfo?.offPrice} - تومان</p>
</div> </div>
<div className="flex justify-between w-full py-2 text-red26 text-lg "> <div className="flex justify-between w-full py-2 text-red26 text-lg ">
<p>کسر از اعتبار</p> <p>کسر از اعتبار</p>
<p>-۴۵۰۰۰۰ تومان</p> <p>-۰ تومان</p>
</div> </div>
</div> </div>
<Button <Button
title=' پرداخت هزینه : ۴۵/۰۰۰ ' title={`پرداخت هزینه : ${factorInfo?.payPrice} تومان`}
borderType='rounded-xl' borderType='rounded-xl'
className='h-16 text-xl' className='h-16 text-xl'
/> />

@ -1,127 +0,0 @@
const PLATFORM_DATA = {
classes: [
{
id: 0,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 1,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 2,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 3,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 4,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 5,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 6,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 7,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 8,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
{
id: 9,
title: 'علوم تجربی',
gender: 'male',
grade: 9,
group: 'A',
category:'online',
teacher: 'محمدرضا سلیمی',
price: 90000,
capacity: 20,
description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد'
},
]
}
export default PLATFORM_DATA;

@ -0,0 +1,292 @@
import React, { useState, useRef, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import Input from "../../../components/Input";
import Button from "../../../components/Button";
import Timer from "../../../components/Timer";
import onInput from "../../../utils/onInput";
import { Link } from "react-router-dom";
import { connect } from "react-redux";
import { user, publicApi } from "../../../redux/actions";
import _ from "lodash";
//assets
import logoIcon from "./assets/logo.svg";
function SignUp({
sendOtp,
sendPhoneNumber,
loginFlag,
theme,
headerOptions,
setHeaderOptions,
}) {
const [level, setLevel] = useState("phonenumber");
const [signUpFields, setSignUpFiels] = useState({});
const [error, setError] = useState("");
const [resend, setResend] = useState(false);
const navigate = useNavigate();
const otp1 = useRef();
const otp2 = useRef();
const otp3 = useRef();
const otp4 = useRef();
const onChange = (name, value) => {
setSignUpFiels({ ...signUpFields, [name]: value });
switch (name) {
case "otp1":
if (value) {
otp2.current.focus();
}
break;
case "otp2":
if (value) {
otp3.current.focus();
} else {
otp1.current.focus();
}
break;
case "otp3":
if (value) {
otp4.current.focus();
} else {
otp2.current.focus();
}
break;
case "otp4":
if (value) {
checkOtp();
} else {
otp3.current.focus();
}
break;
default:
break;
}
};
const checkPhoneNumber = (e) => {
if (
signUpFields?.cellphone?.slice(0, 2) === "09" &&
signUpFields?.cellphone.length === 11
) {
setLevel("otp");
setResend(false);
sendPhoneNumber({ cellphone: signUpFields?.cellphone });
setError(undefined);
} else {
setError("شماره موبایل خود را چک کنید.");
}
};
const checkOtp = () => {
if (
signUpFields?.otp1 &&
signUpFields?.otp2 &&
signUpFields?.otp3 &&
signUpFields?.otp4
) {
sendOtp({
cellphone: signUpFields?.cellphone,
otp:
signUpFields?.otp1 +
signUpFields?.otp2 +
signUpFields?.otp3 +
signUpFields?.otp4,
userToken: "2",
applicationToken: "22",
});
setError(undefined);
} else {
setError("کد وارد شده را چک کنید.");
}
};
const numberInput = useRef();
useEffect(() => {
// numberInput.current.focus();
setHeaderOptions(headerOptions);
}, []);
useEffect(() => {
if (signUpFields?.otp?.length === 4) {
sendOtp({
cellphone: signUpFields?.cellphone,
otp: signUpFields?.otp,
userToken: "2",
applicationToken: "22",
});
}
}, [signUpFields]);
useEffect(() => {
if (level === "phonenumber") {
// numberInput.current.focus();
} else {
// otpInput.current.focus();
}
}, [level]);
useEffect(() => {
if (loginFlag) {
navigate("/");
}
}, [loginFlag]);
const light = theme === "light";
return (
<div
className="w-screen overflow-x-hidden flex flex-row transform -translate-y-10 relative"
style={{ height: "calc(100vh - 160px)" }}
>
<div
className={`flex flex-col items-center justify-center h-full w-full p-4 transition transform duration-300 absolute top-0 left-0 ${
level === "phonenumber" ? "translate-x-0" : "-translate-x-full"
}`}
>
<img src={logoIcon} alt="" className="" />
<strong className="w-full leading-6 dark:text-white mt-10">
سلام <br /> خوش برگشتی!
</strong>
<div className="w-full flex flex-col mt-10">
<Input
label={"شماره موبایل"}
name="cellphone"
regex={onInput.numberOnly}
onChange={(name, value) => onChange(name, value)}
value={signUpFields?.cellphone}
align="text-center"
maxLength="11"
direction="ltr"
/>
<span className="text-red-500 text-xs">{error}</span>
<br />
<Button
title="ادامه"
backgroundColor="bg-blueC0"
border={{ color: "#196EC055", width: "1px" }}
width="100%"
color="text-white"
onClick={(e) => checkPhoneNumber(e)}
/>
</div>
</div>
<div
className={`flex flex-col items-center justify-center w-full h-full p-4 transition transform duration-300 absolute top-0 left-0 ${
level === "otp" ? "translate-x-0" : "translate-x-full"
}`}
>
<img src={logoIcon} alt="" className="" />
{!resend && (
<div className="w-full leading-6 dark:text-white mt-10 text-xs text-gray1">
یک کد چهار رقمی تا &nbsp;{" "}
<Timer seconds={120} refresh={setResend} /> &nbsp; دیگر برای شماره
&nbsp;{" "}
<span className="text-greenBA text-sm">
{signUpFields?.cellphone}
</span>{" "}
&nbsp; ارسال خواهد شد.
</div>
)}
<div className="w-full flex flex-col mt-5">
<div className="w-full flex flex-row-reverse justify-center">
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp1"
className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.numberOnly(e.target.value))
)
}
maxlength="1"
ref={otp1}
/>
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp2"
className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.numberOnly(e.target.value))
)
}
maxlength="1"
ref={otp2}
/>
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp3"
className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.numberOnly(e.target.value))
)
}
maxlength="1"
ref={otp3}
/>
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp4"
className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.englishAndNumberWithoutSpace(e.target.value))
)
}
maxlength="1"
ref={otp4}
/>
</div>
<br />
<Button
title="ادامه فرایند خرید"
backgroundColor="bg-blueC0"
border={{ color: "#196EC055", width: "1px" }}
width="100%"
color="text-white"
onClick={(e) =>
level === "phonenumber" ? checkPhoneNumber(e) : checkOtp(e)
}
/>
<div className="mt-10 flex flex-row text-center w-full justify-center">
<div className="text-xs text-gray1">
شماره خود را اشتباه وارد کردید؟{" "}
<button
className="bg-transparent border-none text-greenBA font-medium"
onClick={() => setLevel("phonenumber")}
>
اصلاح شماره تلفن
</button>
</div>
</div>
</div>
</div>
</div>
);
}
const mapStateToProps = (state) => ({
loginFlag : state.user.status,
});
const mapDispatchToProps = {
sendOtp: user.otp_login,
sendPhoneNumber: user.otp,
setHeaderOptions: publicApi.setHeaderOptions,
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(SignUp);

@ -77,7 +77,8 @@ const ContactUs = () => {
</div> </div>
<div className="w-1/2 overflow-hidden" style={{height:'400px'}}> <div className="w-full border-t border-gray-300"></div>
<div className="w-full rounded-xl overflow-hidden my-4 " style={{height:'215px'}}>
<Map /> <Map />
</div> </div>
</div> </div>

@ -15,46 +15,46 @@ const Games = ({ gameId, chooseGame, selectedGames }) => {
{ {
id: 1, id: 1,
img: img1, img: img1,
title: "ماجراجو", title: 'کلاس های آموزشی',
}, },
{ {
id: 2, id: 2,
img: img2, img: img2,
title: "فرفره", title: 'پیش ثبت نام مدارس',
}, },
{ {
id: 3, id: 3,
img: img3, img: img3,
title: "آشپزباشی", title: 'بسته های آزمون',
}, },
{ {
id: 4, id: 4,
img: img4, img: img4,
title: "صخره نورد", title: 'کتاب های آموزشی',
}, },
{ {
id: 5, id: 5,
img: img5, img: img5,
title: "معمارک", title: 'دوره های مجازی',
}, },
{ {
id: 6, id: 6,
img: img6, img: img6,
title: "کنجکاو", title: 'سایر خدمات',
}, },
]); ]);
return ( return (
<div className="Games w-full h-1/4 pb-3 px-4 flex items-center justify-between border-b border-color1 flex-row-reverse"> <div className="Games w-full h-full pb-3 px-4 flex items-center justify-between border-b border-color1 flex-row-reverse">
{data.map((item, index) => ( {data.map((item, index) => (
<div <div
key={item.id} key={item.id}
className="Games-item h-full rounded-lg bg-white relative flex items-center justify-center flex-col hover:bg-color12 cursor-pointer hover:border hover:border-color2" className="Games-item h-full rounded-lg bg-white relative flex items-center justify-center flex-col hover:bg-red82OP hover:text-red52 cursor-pointer hover:border hover:border-red52"
style={ style={
gameId === item.id gameId === item.id
? { ? {
backgroundColor: "rgba(38,125,233,0.1)", backgroundColor: "rgba(223, 20, 82, 0.02)",
aspectRatio: "0.95/1", aspectRatio: "0.95/1",
border: "1px solid #267DE9", border: "1px solid #df1452",
} }
: { aspectRatio: "0.95/1" } : { aspectRatio: "0.95/1" }
} }
@ -66,7 +66,7 @@ const Games = ({ gameId, chooseGame, selectedGames }) => {
<img src={item.img} alt="game-img" className="h-2/5" /> <img src={item.img} alt="game-img" className="h-2/5" />
<div <div
className="Games-title mt-2" className="Games-title mt-2"
style={gameId === item.id ? { color: "#267DE9" } : null} style={gameId === item.id ? { color: "#df1452" } : null}
> >
{item.title} {item.title}
</div> </div>

@ -0,0 +1,292 @@
import React, { useState, useRef, useEffect } from "react";
import { useNavigate } from "react-router-dom";
import Input from "../../../components/Input";
import Button from "../../../components/Button";
import Timer from "../../../components/Timer";
import onInput from "../../../utils/onInput";
import { Link } from "react-router-dom";
import { connect } from "react-redux";
import { user, publicApi } from "../../../redux/actions";
import _ from "lodash";
//assets
import logoIcon from "./assets/logo.svg";
function SignUp({
sendOtp,
sendPhoneNumber,
loginFlag,
theme,
headerOptions,
setHeaderOptions,
}) {
const [level, setLevel] = useState("phonenumber");
const [signUpFields, setSignUpFiels] = useState({});
const [error, setError] = useState("");
const [resend, setResend] = useState(false);
const navigate = useNavigate();
const otp1 = useRef();
const otp2 = useRef();
const otp3 = useRef();
const otp4 = useRef();
const onChange = (name, value) => {
setSignUpFiels({ ...signUpFields, [name]: value });
switch (name) {
case "otp1":
if (value) {
otp2.current.focus();
}
break;
case "otp2":
if (value) {
otp3.current.focus();
} else {
otp1.current.focus();
}
break;
case "otp3":
if (value) {
otp4.current.focus();
} else {
otp2.current.focus();
}
break;
case "otp4":
if (value) {
checkOtp();
} else {
otp3.current.focus();
}
break;
default:
break;
}
};
const checkPhoneNumber = (e) => {
if (
signUpFields?.cellphone?.slice(0, 2) === "09" &&
signUpFields?.cellphone.length === 11
) {
setLevel("otp");
setResend(false);
sendPhoneNumber({ cellphone: signUpFields?.cellphone });
setError(undefined);
} else {
setError("شماره موبایل خود را چک کنید.");
}
};
const checkOtp = () => {
if (
signUpFields?.otp1 &&
signUpFields?.otp2 &&
signUpFields?.otp3 &&
signUpFields?.otp4
) {
sendOtp({
cellphone: signUpFields?.cellphone,
otp:
signUpFields?.otp1 +
signUpFields?.otp2 +
signUpFields?.otp3 +
signUpFields?.otp4,
userToken: "2",
applicationToken: "22",
});
setError(undefined);
} else {
setError("کد وارد شده را چک کنید.");
}
};
const numberInput = useRef();
useEffect(() => {
// numberInput.current.focus();
setHeaderOptions(headerOptions);
}, []);
useEffect(() => {
if (signUpFields?.otp?.length === 4) {
sendOtp({
cellphone: signUpFields?.cellphone,
otp: signUpFields?.otp,
userToken: "2",
applicationToken: "22",
});
}
}, [signUpFields]);
useEffect(() => {
if (level === "phonenumber") {
// numberInput.current.focus();
} else {
// otpInput.current.focus();
}
}, [level]);
useEffect(() => {
if (loginFlag) {
navigate("/");
}
}, [loginFlag]);
const light = theme === "light";
return (
<div
className="w-screen overflow-x-hidden flex flex-row transform -translate-y-10 relative"
style={{ height: "calc(100vh - 160px)" }}
>
<div
className={`flex flex-col items-center justify-center h-full w-full p-4 transition transform duration-300 absolute top-0 left-0 ${
level === "phonenumber" ? "translate-x-0" : "-translate-x-full"
}`}
>
<img src={logoIcon} alt="" className="" />
<strong className="w-full leading-6 dark:text-white mt-10">
سلام <br /> خوش برگشتی!
</strong>
<div className="w-full flex flex-col mt-10">
<Input
label={"شماره موبایل"}
name="cellphone"
regex={onInput.numberOnly}
onChange={(name, value) => onChange(name, value)}
value={signUpFields?.cellphone}
align="text-center"
maxLength="11"
direction="ltr"
/>
<span className="text-red-500 text-xs">{error}</span>
<br />
<Button
title="ادامه"
backgroundColor="bg-blueC0"
border={{ color: "#196EC055", width: "1px" }}
width="100%"
color="text-white"
onClick={(e) => checkPhoneNumber(e)}
/>
</div>
</div>
<div
className={`flex flex-col items-center justify-center w-full h-full p-4 transition transform duration-300 absolute top-0 left-0 ${
level === "otp" ? "translate-x-0" : "translate-x-full"
}`}
>
<img src={logoIcon} alt="" className="" />
{!resend && (
<div className="w-full leading-6 dark:text-white mt-10 text-xs text-gray1">
یک کد چهار رقمی تا &nbsp;{" "}
<Timer seconds={120} refresh={setResend} /> &nbsp; دیگر برای شماره
&nbsp;{" "}
<span className="text-greenBA text-sm">
{signUpFields?.cellphone}
</span>{" "}
&nbsp; ارسال خواهد شد.
</div>
)}
<div className="w-full flex flex-col mt-5">
<div className="w-full flex flex-row-reverse justify-center">
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp1"
className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.numberOnly(e.target.value))
)
}
maxlength="1"
ref={otp1}
/>
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp2"
className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.numberOnly(e.target.value))
)
}
maxlength="1"
ref={otp2}
/>
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp3"
className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.numberOnly(e.target.value))
)
}
maxlength="1"
ref={otp3}
/>
<input
inputMode="numeric"
style={{ direction: "ltr" }}
name="otp4"
className="bg-grayF9 rounded-md p-4 w-16 text-md text-center text-blueC0 mx-1"
onChange={(e) =>
onChange(
e.target.name,
(e.target.value = onInput.englishAndNumberWithoutSpace(e.target.value))
)
}
maxlength="1"
ref={otp4}
/>
</div>
<br />
<Button
title="ادامه فرایند خرید"
backgroundColor="bg-blueC0"
border={{ color: "#196EC055", width: "1px" }}
width="100%"
color="text-white"
onClick={(e) =>
level === "phonenumber" ? checkPhoneNumber(e) : checkOtp(e)
}
/>
<div className="mt-10 flex flex-row text-center w-full justify-center">
<div className="text-xs text-gray1">
شماره خود را اشتباه وارد کردید؟{" "}
<button
className="bg-transparent border-none text-greenBA font-medium"
onClick={() => setLevel("phonenumber")}
>
اصلاح شماره تلفن
</button>
</div>
</div>
</div>
</div>
</div>
);
}
const mapStateToProps = (state) => ({
loginFlag : state.user.status,
});
const mapDispatchToProps = {
sendOtp: user.otp_login,
sendPhoneNumber: user.otp,
setHeaderOptions: publicApi.setHeaderOptions,
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(SignUp);

@ -12,6 +12,9 @@ import img4 from "../../assets/img/Group 1364.svg";
import img5 from "../../assets/img/Group 1357.svg"; import img5 from "../../assets/img/Group 1357.svg";
import img6 from "../../assets/img/Group 1362.svg"; import img6 from "../../assets/img/Group 1362.svg";
import ShoppingCart from "../../components/ShoppingCart"; import ShoppingCart from "../../components/ShoppingCart";
import ServicePopUp from "./service";
import Games from "../dashboard2/Games";
import Packages from "../dashboard2/Packages";
const Services = ({ isMobile, const Services = ({ isMobile,
books, books,
@ -33,6 +36,17 @@ const Services = ({ isMobile,
productsType: "کتاب", productsType: "کتاب",
}); });
const [popup, setPopUp] = useState(false)
const [popUpContent, setPopUpContent] = useState({
title: '',
video: '',
description: '',
price: '',
teacher: '',
classHour: '',
classMinute: ''
})
const onChange = (name, value) => { const onChange = (name, value) => {
setFilter({ ...filter, [name]: value }); setFilter({ ...filter, [name]: value });
@ -80,13 +94,19 @@ const Services = ({ isMobile,
}, },
]; ];
const [selectedGames, setSelectedGames] = useState([]);
const [gameId, setGameId] = useState(1);
const chooseGame = (id) => {
setGameId(id);
};
return ( return (
<div className="flex items-start justify-between" style={{ width: '93.5%', direction: 'rtl' }}> <div className="flex items-start justify-between" style={{ width: '93.5%', direction: 'rtl' }}>
{popup ? <ServicePopUp content={popUpContent} closeOnClick={() => setPopUp(false)} /> : null}
<div className="w-3/4 flex flex-col justify-center " style={{ marginTop: '5.5%' }}> <div className="w-3/4 flex flex-col justify-center " style={{ marginTop: '5.5%' }}>
<div className="flex w-full flex-wrap justify-center px-4 border-b border-red82OP">
{ <div className="relative h-48 w-full border-b border-red82OP px-10" style={{ direction: 'ltr' }}>
{/* {
services.map((item, index) => ( services.map((item, index) => (
<div <div
className="flex flex-col justify-center items-center transition-all duration-200 m-4 rounded-xl border-2 border-red82OP hover:cursor-pointer hover:bg-pinkF5" className="flex flex-col justify-center items-center transition-all duration-200 m-4 rounded-xl border-2 border-red82OP hover:cursor-pointer hover:bg-pinkF5"
@ -114,7 +134,12 @@ const Services = ({ isMobile,
<h2 className="w-full text-md text-gray-400 font-bold">{item.title}</h2> <h2 className="w-full text-md text-gray-400 font-bold">{item.title}</h2>
</div> </div>
)) ))
} } */}
<Games
selectedGames={selectedGames}
gameId={gameId}
chooseGame={chooseGame}
/>
</div> </div>
{/* filters */} {/* filters */}
<div className="flex mx-2 my-4 justify-center"> <div className="flex mx-2 my-4 justify-center">
@ -135,10 +160,10 @@ const Services = ({ isMobile,
</div> </div>
<div className="flex items-center mx-4 pl-6 border-l-2 border-gray-300"> <div className="flex items-center mx-4 pl-6 border-l-2 border-gray-300">
<div <div
className={`flex w-32 border-2 p-2 mx-2 justify-center items-center rounded-md cursor-pointer className={`flex w-32 border-2 p-2 mx-2 justify-center items-center rounded-md cursor-pointer
hover:border-red52 hover:text-red52 hover:bg-pinkF5 hover:border-red52 hover:text-red52 hover:bg-pinkF5
${filterCheck[0] ? 'border-red52 text-red52 bg-pinkF5' : 'border-gray200 text-gray-400'}`} ${filterCheck[0] ? 'border-red52 text-red52 bg-pinkF5' : 'border-gray200 text-gray-400'}`}
onClick={prevState => setFilterCheck([...prevState, filterCheck[0] = !filterCheck[0]])} onClick={prevState => setFilterCheck([...prevState, filterCheck[0] = !filterCheck[0]])}
> >
<h3>آنلاین</h3> <h3>آنلاین</h3>
@ -207,30 +232,35 @@ const Services = ({ isMobile,
</div> </div>
</div> </div>
<div className="flex items-center mx-4 pl-6"> <div className="flex items-center mx-4 pl-6">
<select className="bg-white border border-solid border-gray-300 w-72 p-3 rounded-lg text-gray-400 outline-red52"> <select className="bg-white border border-solid border-gray-300 w-72 p-3 rounded-lg text-gray-400 outline-red52">
{services.map((item, index) => ( {services.map((item, index) => (
<option key={`Grade__${index}`}>{item.title}</option> <option key={`Grade__${index}`}>{item.title}</option>
))} ))}
</select> </select>
</div> </div>
</div> </div>
<div className="flex justify-center flex-wrap " > <div className={`flex ${gameId == 2 && 'flex-col'} items-center w-full justify-center flex-wrap `} >
{books?.map((product, index) => ( {books?.map((product, index) => (
<Link <Link
// to={"/class/" + product?.id} // to={"/class/" + product?.id}
to='#' to='#'
onClick={() => onClick={() => {
setPopUpContent({
pushToCart({ title: product?.name,
productId: product?.productId, video: '',
userId: product?.userId, teacher: product.vodTeacher,
count: 1, description: 'در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت قرار میگیرد در این قسمت یک توضیحات کوتاه در مورد دوره خواهد آمد که بصورت دو خط در این قسمت',
}) price: product.product[0].price,
classHour: 21,
} classMinute: 56
> })
setPopUp(true);
}}
>
{/* {console.log(product)} */}
<Product <Product
key={index} key={index}
productsType={filter.productsType} productsType={filter.productsType}
@ -238,22 +268,31 @@ const Services = ({ isMobile,
index={Number(index)} index={Number(index)}
productName={`${product?.name}`} productName={`${product?.name}`}
productCat={`پایه ${grades[product?.gradeId]}`} productCat={`پایه ${grades[product?.gradeId]}`}
productPrice={100000} productPrice={product.product[0].price}
// productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds} // productImg={"https://dnvn.ir/api/v1/file/" + product?.fileIds}
numberOfRegards={160} numberOfRegards={160}
productHolderBorder='' productHolderBorder=''
productHolderHoverBorder='shadow-md' productHolderHoverBorder='shadow-md'
teacher={product.vodTeacher} teacher={product.vodTeacher}
catId={gameId}
btnOnClick={() =>
pushToCart({
productId: product?.productId,
userId: product?.userId,
count: 1,
})}
/> />
</Link> </Link>
))} ))}
</div> </div>
</div> </div>
<div className="w-1/4 fixed left-0" style={{ height: '100vh' }}> <div className="w-1/4 fixed left-0" style={{ height: '100vh' }}>
<ShoppingCart /> <ShoppingCart />
</div> </div>
</div> </div>
); );
}; };

@ -0,0 +1,70 @@
import React from "react";
import Button from "../../../components/Button";
const servicePopUp = ({
content,
closeOnClick,
addToCartFunction
}) => {
return (
<div className="flex justify-center w-full items-center fixed text-right z-30 backdrop-blur" style={{ background: 'rgba(0,0,0,0.1)', height: 'calc(100vh - 6.5vh)', top: '8.5vh' }}>
<div className="bg-white flex flex-col w-1/2 rounded-2xl py-6 px-10" >
<div className="w-full">
<div className="w-8 h-8 text-white text-sm rounded-full cursor-pointer flex justify-center items-center bg-red52" onClick={closeOnClick}>
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 15.044 15.044">
<g id="vuesax_linear_card-remove" data-name="vuesax/linear/card-remove" transform="translate(-252.46 -511.461)">
<g id="card-remove" transform="translate(253.309 512.31)">
<path id="Vector" d="M0,13.347,13.347,0" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2" />
<path id="Vector-2" data-name="Vector" d="M13.347,13.347,0,0" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="2" />
</g>
</g>
</svg>
</div>
</div>
<div className="flex justify-between mb-20">
<div className="w-1/2 my-4 p-2">
<h1 className="text-red25 font-black text-md">کلاس آنلاین {content.title}</h1>
<p className="text-red26 text-sm my-2">
{content.description}
</p>
<div className="w-full flex flex-col">
<div className="flex mb-2">
<div className="bg-gray-100 rounded w-40 px-4 py-2 ml-2 text-red52">نام کلاس</div>
<div className="bg-gray-100 rounded w-full px-4 py-2 ml-2 text-red26">{content.title}</div>
</div>
<div className="flex mb-2">
<div className="bg-gray-100 rounded w-40 px-4 py-2 ml-2 text-red52"> استاد </div>
<div className="bg-gray-100 rounded w-full px-4 py-2 ml-2 text-red26">{content.teacher}</div>
</div>
<div className="flex mb-2">
<div className="bg-gray-100 rounded w-40 px-4 py-2 ml-2 text-red52">زمان کلاس</div>
<div className="bg-gray-100 rounded w-full px-4 py-2 ml-2 text-red26">
{content.classHour} ساعت و {content.classMinute} دقیقه
</div>
</div>
</div>
</div>
<video className="w-1/2 rounded-md" controls>
<source
src={`https://dnvn.ir/api/v1/file/20540`}
type="video/mp4"
/>
</video>
</div>
<div className="flex w-full items-center justify-start mb-8" style={{direction: 'ltr'}}>
<Button title='افزودن به سبد خرید' onClick={addToCartFunction} className="w-40"/>
<h1 className="text-xl font-bold text-red52 p-2 mt-3">
مبلغ کل : {content.price} تومان
</h1>
</div>
</div>
</div>
);
};
export default servicePopUp;

@ -30,7 +30,8 @@ module.exports = {
grayEC: '#ececec', grayEC: '#ececec',
red82OP: 'rgba(223, 20, 82, 0.08)', red82OP: 'rgba(223, 20, 82, 0.08)',
pinkF5: '#fff1f5', pinkF5: '#fff1f5',
black40: '#404040' black40: '#404040',
green17 : '#8daf17'
}, },
}, },
screens: { screens: {

Loading…
Cancel
Save