From 666fa19f38995ce56f31fc1eac5a5eb41b15e174 Mon Sep 17 00:00:00 2001 From: Pkpedram Date: Tue, 26 Apr 2022 20:23:17 +0430 Subject: [PATCH] Latest Changes --- package-lock.json | 14 +- package.json | 2 +- src/App.js | 18 +- src/components/ShoppingCart/index.js | 7 +- src/components/Timer/index.js | 9 +- src/components/fileInput/index.js | 40 ++-- src/components/input/index.js | 19 +- src/components/nav/Nav.js | 16 +- src/redux/actions/userFactor.js | 17 +- src/redux/reducers/user.js | 5 +- src/redux/reducers/userFactor.js | 3 + src/view/LoginSignUp/index.css | 18 +- src/view/LoginSignUp/index.js | 123 +++++++--- src/view/LoginSignUp/mobile/index.js | 165 +++++++------- src/view/register/index.js | 329 +++++++++++++++++---------- src/view/register/mobile/index.js | 103 +++++++-- yarn.lock | 8 +- 17 files changed, 598 insertions(+), 298 deletions(-) diff --git a/package-lock.json b/package-lock.json index 88bf2af..24cc202 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,7 +35,7 @@ "react-router-dom": "^6.2.1", "react-scripts": "5.0.0", "react-slideshow-image": "^3.7.0", - "react-toastify": "^8.1.1", + "react-toastify": "^8.2.0", "redux": "^4.1.2", "redux-devtools-extension": "^2.13.9", "redux-thunk": "^2.4.1", @@ -14656,9 +14656,9 @@ } }, "node_modules/react-toastify": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-8.1.1.tgz", - "integrity": "sha512-KQa+j+JHjy69xpPYheaWUq3SjVw1sV2D7/QsXW6Tpo2x9HhUCvASezAMYDmLhfAYoSnaXUVnTNFAgZQA75SExQ==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-8.2.0.tgz", + "integrity": "sha512-Pg2Ju7NngAamarFvLwqrFomJ57u/Ay6i6zfLurt/qPynWkAkOthu6vxfqYpJCyNhHRhR4hu7+bySSeWWJu6PAg==", "dependencies": { "clsx": "^1.1.1" }, @@ -28095,9 +28095,9 @@ } }, "react-toastify": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-8.1.1.tgz", - "integrity": "sha512-KQa+j+JHjy69xpPYheaWUq3SjVw1sV2D7/QsXW6Tpo2x9HhUCvASezAMYDmLhfAYoSnaXUVnTNFAgZQA75SExQ==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-8.2.0.tgz", + "integrity": "sha512-Pg2Ju7NngAamarFvLwqrFomJ57u/Ay6i6zfLurt/qPynWkAkOthu6vxfqYpJCyNhHRhR4hu7+bySSeWWJu6PAg==", "requires": { "clsx": "^1.1.1" } diff --git a/package.json b/package.json index c1b6087..1608572 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "react-router-dom": "^6.2.1", "react-scripts": "5.0.0", "react-slideshow-image": "^3.7.0", - "react-toastify": "^8.1.1", + "react-toastify": "^8.2.0", "redux": "^4.1.2", "redux-devtools-extension": "^2.13.9", "redux-thunk": "^2.4.1", diff --git a/src/App.js b/src/App.js index 157ef7a..8174ae8 100644 --- a/src/App.js +++ b/src/App.js @@ -7,6 +7,9 @@ import Nav from './components/nav/Nav'; import Dashboard from './view/dashboard/Dashboard'; import Accounting from './view/accounting/Accounting'; import Messages from './view/messages/Messages'; +import { ToastContainer } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +// import "react-modern-drawer/dist/index.css"; import Login from './view/login/Login'; import { useEffect, useState } from 'react'; // import {useParams} from 'react-router-dom'; @@ -666,7 +669,7 @@ function App() { return ( - +
{LOGIN &&
} @@ -731,6 +734,19 @@ function App() {
+ +
); } diff --git a/src/components/ShoppingCart/index.js b/src/components/ShoppingCart/index.js index ea2fd7e..059d47d 100644 --- a/src/components/ShoppingCart/index.js +++ b/src/components/ShoppingCart/index.js @@ -29,7 +29,8 @@ function ShoppingCart({ schoolList, desktopContentTransform, pushToCart, - pushSchoolToCart + pushSchoolToCart, + paySchool }) { const [phase, setPhase] = useState("products"); @@ -144,7 +145,7 @@ function ShoppingCart({
رزرو پیش ثبت نام

{school?.product?.name}

-

@@ -226,6 +227,7 @@ function ShoppingCart({ title={`پرداخت هزینه : ${factorInfo?.payPrice ? separate(factorInfo?.payPrice) : 0} تومان`} borderType='rounded-xl' className='h-16 text-xl xl:text-sm' + onClick={() => payFactor()} /> @@ -250,6 +252,7 @@ const mapDispatchToProps = { getInfo: userProduct.info, getFactorInfo: userFactor.info, payFactor: userFactor.payment, + paySchool: userFactor.paymentSchool, setHeaderOptions: publicApi.setHeaderOptions, pushToCart: userProduct.add, pushSchoolToCart: userProduct.addSchool, diff --git a/src/components/Timer/index.js b/src/components/Timer/index.js index f7ae584..d3b6866 100644 --- a/src/components/Timer/index.js +++ b/src/components/Timer/index.js @@ -52,7 +52,7 @@ export default class Timer extends Component { } startTimer() { - if (this.timer === 0 && this.state.seconds > 0) { + if (this.timer === 0 && this.state.seconds >= 0) { this.timer = setInterval(this.countDown, 1000); } } @@ -70,12 +70,15 @@ export default class Timer extends Component { }; componentWillUnmount() { - clearInterval(this.timer); + + if(this.props.refresh){ + clearInterval(this.timer); + } } render() { return ( <> -

+
{this.state.time ? this.state.time.m : ''}:{this.state.time ? this.state.time.s : ''}
diff --git a/src/components/fileInput/index.js b/src/components/fileInput/index.js index 0480dde..be9b52e 100644 --- a/src/components/fileInput/index.js +++ b/src/components/fileInput/index.js @@ -5,7 +5,10 @@ import { useState, useEffect } from "react"; const FileInput = ({ title, id, - mobile + mobile, + onChange, + file, + deleteHandler }) => { const [focus, setFocus] = useState('border-gray-300 border-dotted'); @@ -13,10 +16,16 @@ const FileInput = ({ const [imageUrl, setImageUrl] = useState(null); const [del, setDelete] = useState(false); useEffect(() => { - if (selectedImage) { - setImageUrl(URL.createObjectURL(selectedImage)); + if (file) { + setImageUrl(URL.createObjectURL(file)); + setDelete(true) + }else{ + setImageUrl(null); + setDelete(false) + setFocus('border-gray-300 border-dotted') } - }, [selectedImage]); + + }, [file]); function overrideEventDefaults(event) { event.preventDefault(); @@ -32,21 +41,21 @@ const FileInput = ({ let files = Array.from(fileList); // setFiles(files); console.log(files); - setSelectedImage(files[0]); + onChange(files[0]); } }; - useEffect(() => { - if(mobile){ - setDelete(true) - } - }, [mobile]) + // useEffect(() => { + // if(mobile){ + // setDelete(true) + // } + // }, [mobile]) return (
- setFocus('border-red52')} onChange={e => { setSelectedImage(e.target.files[0]); setFocus('border-red52 border-solid') }} /> + setFocus('border-red52')} onChange={e => { onChange(e.target.files[0]); setFocus('border-red52 border-solid') }} />