From 8a9fc46bbfed3201ea909355b91fc19df31b258f Mon Sep 17 00:00:00 2001 From: RezaAshrafi77 Date: Sat, 9 Oct 2021 13:53:24 +0330 Subject: [PATCH] reza added level3 profile --- src/components/Input/index.js | 2 +- src/components/Navbar/index.scss | 8 +- src/components/NavbarDrawer/NavbarDrawer.scss | 10 +- src/components/NavbarDrawer/NavbarDrawer.tsx | 4 +- src/components/PrivateRouter/index.js | 2 +- src/redux/reducers/user.tsx | 8 +- .../Profile/Document/{index.tsx => index.js} | 13 ++- src/views/Auth/Profile/Document/index.scss | 26 ++++- .../Auth/Profile/MultipleSelector/index.js | 96 ------------------- .../Auth/Profile/MultipleSelector/index.tsx | 43 +++++++++ src/views/Auth/Profile/Upload/index.scss | 5 + src/views/Auth/Profile/index.scss | 24 +++++ src/views/Auth/Profile/index.tsx | 65 +++++++------ src/views/Course/Lesson/index.scss | 5 +- src/views/Course/index.scss | 2 +- src/views/Course/index.tsx | 4 +- src/views/Home/Courses/index.scss | 2 +- src/views/Home/Courses/index.tsx | 4 +- src/views/Home/Header/index.scss | 2 +- 19 files changed, 163 insertions(+), 162 deletions(-) rename src/views/Auth/Profile/Document/{index.tsx => index.js} (69%) delete mode 100644 src/views/Auth/Profile/MultipleSelector/index.js create mode 100644 src/views/Auth/Profile/MultipleSelector/index.tsx diff --git a/src/components/Input/index.js b/src/components/Input/index.js index d408fe5..7331085 100644 --- a/src/components/Input/index.js +++ b/src/components/Input/index.js @@ -36,7 +36,7 @@ export default function FormPropsTextFields({ name={name} label={label} variant={"outlined"} - onChange={(e) => onChange(e)} + onChange={(e) => onChange(name, e.target.value)} defaultValue={defaultValue[name] || ""} inputProps={{ maxLength }} onInput={ diff --git a/src/components/Navbar/index.scss b/src/components/Navbar/index.scss index e28aad1..e2c9f4b 100644 --- a/src/components/Navbar/index.scss +++ b/src/components/Navbar/index.scss @@ -17,7 +17,7 @@ li{ text-align: center; padding: 6px 0px; - border-radius: 7px; + border-radius: 6px; min-width : 130px; font-family: numeralLight; a{ @@ -74,7 +74,7 @@ &--links{ li{ padding: 0px 20px; - font-size: calc(100vw / 95); + font-size: calc(100vw / 120); span{ width: 2px; height: 15px; @@ -86,7 +86,9 @@ } &--buttons{ li{ - font-size: calc(100vw / 100); + a{ + font-size: calc(100vw / 120); + } min-width: 100px; } } diff --git a/src/components/NavbarDrawer/NavbarDrawer.scss b/src/components/NavbarDrawer/NavbarDrawer.scss index 726bf63..ff7f3f9 100644 --- a/src/components/NavbarDrawer/NavbarDrawer.scss +++ b/src/components/NavbarDrawer/NavbarDrawer.scss @@ -16,7 +16,6 @@ } &__header { height: 60px; - background-color: rgb(0, 0, 0); width: 100%; align-items: center; padding: 0px 8px; @@ -26,11 +25,11 @@ & h1 { margin-bottom: 0px; font-size: 17px; - color: #4d4d4f; + color:white; letter-spacing: -1px; } & div { - color: #4d4d4f; + color: white; font-size: calc(100vw / 34); letter-spacing: -1px; } @@ -58,7 +57,6 @@ &__dropdown { width: calc(100vw * 0.8); margin: 10px auto; - background-color: rgb(0, 0, 0); .navbar-drawer-user { padding: 10px 10px; width: 100%; @@ -68,11 +66,11 @@ & h1 { margin-bottom: 0px; font-size: calc(100vw / 22); - color: #4d4d4f; + color: white; letter-spacing: -1px; } & div { - color: #4d4d4f; + color: white; font-size: calc(100vw / 34); letter-spacing: -1px; } diff --git a/src/components/NavbarDrawer/NavbarDrawer.tsx b/src/components/NavbarDrawer/NavbarDrawer.tsx index e673bcc..96a4027 100644 --- a/src/components/NavbarDrawer/NavbarDrawer.tsx +++ b/src/components/NavbarDrawer/NavbarDrawer.tsx @@ -205,7 +205,7 @@ const NavbarDrawer = ({ status, logout }: any) => { className="navbar-drawer__header--dropdown" onClick={() => setDropdown(false)} > - {score ? {score} امتیاز : null} + {/* {score ? {score} امتیاز : null} */} ) : ( @@ -213,7 +213,7 @@ const NavbarDrawer = ({ status, logout }: any) => { className="navbar-drawer__header--dropdown" onClick={() => setDropdown(true)} > - {score ? {score} امتیاز : null}{" "} + {/* {score ? {score} امتیاز : null}{" "} */} )} diff --git a/src/components/PrivateRouter/index.js b/src/components/PrivateRouter/index.js index 7765f86..a602432 100644 --- a/src/components/PrivateRouter/index.js +++ b/src/components/PrivateRouter/index.js @@ -15,7 +15,7 @@ const PrivateRouter = ({ status ? ( ) : ( - + ) } /> diff --git a/src/redux/reducers/user.tsx b/src/redux/reducers/user.tsx index 661e525..c2b569c 100644 --- a/src/redux/reducers/user.tsx +++ b/src/redux/reducers/user.tsx @@ -9,6 +9,7 @@ const initialState = { domains: [], mothers: [], profileStatus: false, + setDone: false, }; export default function user(state = initialState, action : UserAction) { let { type, data } = action; @@ -29,7 +30,7 @@ export default function user(state = initialState, action : UserAction) { }; case "user/getProfile": localStorage.setItem("userData", JSON.stringify(data)); - return { ...state, loading: false, status: data, error: null }; + return { ...state, loading: false, status: data, error: null, setDone : false, }; case "user/logout": return { ...state, loading: false, status: proxy.status(), error: null }; case "user/getUserRole": @@ -42,10 +43,7 @@ export default function user(state = initialState, action : UserAction) { // return { ...state, loading: false, mothers: data, error: null }; case "user/setProfile": toast.success("تغییرات اعمال شد."); - setTimeout(() => { - window.location.pathname = "/"; - }, 500); - return { ...state, loading: false, error: null }; + return { ...state, loading: false, error: null, setDone : true }; case "loading": return { ...state, loading: true }; case "error": diff --git a/src/views/Auth/Profile/Document/index.tsx b/src/views/Auth/Profile/Document/index.js similarity index 69% rename from src/views/Auth/Profile/Document/index.tsx rename to src/views/Auth/Profile/Document/index.js index 583a27b..9556b88 100644 --- a/src/views/Auth/Profile/Document/index.tsx +++ b/src/views/Auth/Profile/Document/index.js @@ -1,16 +1,15 @@ import React from "react"; import "./index.scss"; -export default function Document({ defaultValue, name, onChange } : any) { +export default function Document({ defaultValue, name, onChange }) { return (
- {defaultValue?.docFileIds === "" ? ( + {defaultValue.docFileIds === "" ? ( <> onChange(e.target.name, e.target.files[0])} + onChange={(e) => onChange(name, e.target.files[0])} /> گواهی تدریس خود را آپلود کنید. @@ -19,7 +18,7 @@ export default function Document({ defaultValue, name, onChange } : any) { onChange(e.target.name, e.target.files[0])} + onChange={(e) => onChange(name, e.target.files[0])} /> - {defaultValue?.docFileIds.name || - "گواهی تدریس ثبت شده و درحال بررسی می باشد"} + {/* {defaultValue.docFileIds.name || + "گواهی تدریس ثبت شده و درحال بررسی می باشد"} */} )} diff --git a/src/views/Auth/Profile/Document/index.scss b/src/views/Auth/Profile/Document/index.scss index e31bad8..42de1ef 100644 --- a/src/views/Auth/Profile/Document/index.scss +++ b/src/views/Auth/Profile/Document/index.scss @@ -4,7 +4,7 @@ width: 100%; height: 50px; border-radius: 10px; - border: 2px dashed rgb(209, 209, 209); + border: 2px dashed #777; position: relative; input { width: 100%; @@ -26,3 +26,27 @@ } } } + +@media screen and (min-width: 1441px){ + span{ + font-size: 14px; + } +} + +@media screen and (min-width: 1008px) and (max-width: 1440px){ + span{ + font-size: calc(100vw / 100); + } +} + +@media screen and (min-width: 641px) and (max-width: 1007px){ + span{ + font-size: calc(100vw / 45); + } +} + +@media screen and (max-width: 640px){ + span{ + font-size: calc(100vw / 30); + } +} diff --git a/src/views/Auth/Profile/MultipleSelector/index.js b/src/views/Auth/Profile/MultipleSelector/index.js deleted file mode 100644 index 029e696..0000000 --- a/src/views/Auth/Profile/MultipleSelector/index.js +++ /dev/null @@ -1,96 +0,0 @@ -import React from "react"; -import Select from "@mui/material/Select"; -import { makeStyles } from "@mui/styles"; -import Input from "@mui/material/Input"; -import InputLabel from "@mui/material/InputLabel"; -import MenuItem from "@mui/material/MenuItem"; -import FormControl from "@mui/material/FormControl"; -import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown"; - -import "./index.scss"; -export default function MultipleSelector(props) { - const useStyles = makeStyles((theme) => ({ - root: { - "& .MuiTextField-root": { - width: "100%", - position: "relative", - marginRight: 10, - "& input": { - textAlign: props.align, - direction: props.align === "right" ? "rtl" : "ltr", - }, - }, - }, - })); - - const classes = useStyles(); - const { parent, defaultValue, name, label, options, selectedOptions } = props; - return ( - <> - {window.innerWidth < 1000 ? ( - - {label} - } - variant="outlined" - > - {options.map((name, i) => ( - - {name} - - ))} - - - - ) : null} - {window.innerWidth > 1000 ? ( - - {label} - } - variant="outlined" - > - {options.map((name, i) => ( - - {name} - - ))} - - - - ) : null} - - ); -} diff --git a/src/views/Auth/Profile/MultipleSelector/index.tsx b/src/views/Auth/Profile/MultipleSelector/index.tsx new file mode 100644 index 0000000..015eb1c --- /dev/null +++ b/src/views/Auth/Profile/MultipleSelector/index.tsx @@ -0,0 +1,43 @@ +import React from "react"; +import Select from "@mui/material/Select"; +import Input from "@mui/material/Input"; +import InputLabel from "@mui/material/InputLabel"; +import MenuItem from "@mui/material/MenuItem"; +import FormControl from "@mui/material/FormControl"; +import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown"; + +import "./index.scss"; +export default function MultipleSelector({align, onChange, selectedOptions, options, defaultValue, label, name,} : any) { + return ( + + {label} + } + variant="outlined" + > + {options.map((name : any, i : any) => ( + + {name} + + ))} + + + + ); +} diff --git a/src/views/Auth/Profile/Upload/index.scss b/src/views/Auth/Profile/Upload/index.scss index 7be20b5..22189a6 100644 --- a/src/views/Auth/Profile/Upload/index.scss +++ b/src/views/Auth/Profile/Upload/index.scss @@ -7,6 +7,11 @@ position: relative; cursor: pointer; background-color: #272727; + img{ + width: 100%; + height: 100%; + border-radius: 50%; + } input { width: 100%; height: 100%; diff --git a/src/views/Auth/Profile/index.scss b/src/views/Auth/Profile/index.scss index 683f679..6d2b1cc 100644 --- a/src/views/Auth/Profile/index.scss +++ b/src/views/Auth/Profile/index.scss @@ -67,6 +67,12 @@ @media screen and (min-width: 1441px) { .profile { + h1{ + font-size: 30px; + } + p{ + font-size: 14px; + } button { font-size: 21px; } @@ -83,6 +89,12 @@ @media screen and (min-width: 1008px) and (max-width: 1440px) { .profile { + h1{ + font-size: calc(100vw / 50); + } + p{ + font-size: calc(100vw / 90); + } button { font-size: calc(100vw / 70); } @@ -104,6 +116,12 @@ header { margin: 0px; margin-top: 30px; + h1{ + font-size: calc(100vw / 35); + } + p{ + font-size: calc(100vw / 55); + } } &__box { flex-direction: column; @@ -124,6 +142,12 @@ header { margin: 0px; margin-top: 70px; + h1{ + font-size: calc(100vw / 20); + } + p{ + font-size: calc(100vw / 35); + } } &__box { flex-direction: column; diff --git a/src/views/Auth/Profile/index.tsx b/src/views/Auth/Profile/index.tsx index 6e042b1..2474591 100644 --- a/src/views/Auth/Profile/index.tsx +++ b/src/views/Auth/Profile/index.tsx @@ -15,10 +15,6 @@ import "./index.scss"; import { useHistory } from "react-router-dom"; import Navbar from "../../../components/Navbar/index"; import Footer from "../../Home/Footer/index"; -function Navigate({ path }: any) { - let history = useHistory(); - return <>{history.push(path)}; -} function Profile({ profile, @@ -32,29 +28,30 @@ function Profile({ provinceList, cityList, }: any) { + let history = useHistory(); const [render, setRender] = useState(false); const [formData, setFormData] = useState({ file: uploads["file"] || profile.picFileId || null, picFileId: uploads["file"] || profile.picFileId || null, docFileIds: uploads["docFileIds"] || profile.docFileIds || "", - firstName: "", - lastName: "", - password: "", - username: "", - address: "", - email: "", - birthDate: "", + firstName: profile.firstName || "", + lastName: profile.lastName || "", + password: profile.password || "", + username: profile.username || "", + address: profile.address || "", + email: profile.email || "", + birthDate: profile.birthDate || "", gender: profile.gender || 1, status: profile.status || 1, - nationalId: "", - phone: "", - schools: null, - zoneId: "", - schoolId: "", - postalCode: "", - gradeIds: profile.gradeIds, - provinceId: profile.provinceId, - cityId: profile.cityId, + nationalId: profile.nationalId || "", + phone: profile.phone || "", + schools: profile.schools || null, + zoneId: profile.zoneId || "", + schoolId: profile.schoolId || "", + postalCode: profile.postalCode || "", + gradeIds: profile.gradeIds || [], + provinceId: profile.provinceId || null, + cityId: profile.cityId || null, }); useEffect(() => { @@ -62,6 +59,12 @@ function Profile({ getCity({ provinceId: profile.provinceId }); }, []); + useEffect(() => { + if(setDone){ + history.push('/'); + } + },[setDone]) + const grades = [ { name: "پیش دبستانی", @@ -222,7 +225,7 @@ function Profile({ label="نام" align="right" onInput={onInput.persianOnly} - defaultValue={profile} + defaultValue={formData} onChange={onChange} // ref={usernameInput} /> @@ -232,7 +235,7 @@ function Profile({ name="lastName" label="نام خانوادگی" align="right" - defaultValue={profile} + defaultValue={formData} onChange={onChange} onInput={onInput.persianOnly} /> @@ -241,7 +244,7 @@ function Profile({
@@ -314,6 +317,8 @@ function Profile({ label={"پایه تحصیلی"} selectedOptions={formData.gradeIds} onChange={onChange} + align="right" + defaultValue={profile} />
) : null} @@ -368,7 +373,7 @@ function Profile({ @@ -379,7 +384,7 @@ function Profile({ @@ -388,7 +393,7 @@ function Profile({ {formData.status == 2 ? ( ) : null} @@ -400,7 +405,7 @@ function Profile({ onChange={onChange} maxLength={10} inputMode="numeric" - defaultValue={profile} + defaultValue={formData} onInput={onInput.numberOnly} /> @@ -408,7 +413,7 @@ function Profile({