diff --git a/src/App.css b/src/App.css index 7e6d352..534a887 100644 --- a/src/App.css +++ b/src/App.css @@ -1,10 +1,7 @@ - - - - * { box-sizing: border-box !important; - direction: rtl; + direction: rtl; + font-family: numeralLight; } @font-face { diff --git a/src/AppRouter.js b/src/AppRouter.js index 16fb2fb..ed081a3 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -43,7 +43,7 @@ class AppRouter extends Component { const mobile = window.innerWidth < 1000 ? true : false; let home = mobile ? ( - {proxy.status() ? ( + {proxy.status ? ( this.props.profile ? ( ) : ( diff --git a/src/Redux/actions/comment.js b/src/Redux/actions/comment.js new file mode 100644 index 0000000..e2d0fb8 --- /dev/null +++ b/src/Redux/actions/comment.js @@ -0,0 +1,40 @@ +import proxy from "../proxy"; +const comment = { + list: + (data = {}) => + async (dispatch) => + await proxy.get("comment/list", data, { dispatch }), + info: + (data = {}) => + async (dispatch) => { + await proxy.get("comment/info", data, { dispatch }); + }, + add: + ( + data = {}, + data2 = { + id: window.location.pathname.slice( + window.location.pathname.lastIndexOf("/") + 1, + window.location.pathname.length + ), + } + ) => + async (dispatch) => { + await proxy.post("comment/add", data); + await proxy.get("book/info", data2, { dispatch }); + }, + del: + (data = {}, data2 = {}) => + async (dispatch) => { + await proxy.delete("ar/delete", data); + await proxy.get("ar/list", data2, { dispatch }); + }, + update: + (data = {}, data2 = {}) => + async (dispatch) => { + await proxy.put("ar/update", data); + await proxy.get("ar/list", data2, { dispatch }); + }, +}; + +export default comment; diff --git a/src/Redux/actions/index.js b/src/Redux/actions/index.js index 090cb86..00e0510 100644 --- a/src/Redux/actions/index.js +++ b/src/Redux/actions/index.js @@ -8,3 +8,4 @@ export { default as qr } from "./qr.js"; export { default as book } from "./book.js"; export { default as userProduct } from "./userProduct.js"; export { default as transport } from "./transport.js"; +export { default as comment } from "./comment.js"; diff --git a/src/Redux/reducers/comment.js b/src/Redux/reducers/comment.js new file mode 100644 index 0000000..069fa0c --- /dev/null +++ b/src/Redux/reducers/comment.js @@ -0,0 +1,34 @@ +import { toast } from "react-toastify"; + +const initialState = { + loading: false, + error: null, + list: null, +}; + +export default function comment(state = initialState, action) { + let { type, data } = action; + switch (type) { + case "comment/list": + return { ...state, loading: false, error: null }; + case "comment/update": + return { ...state, loading: false, error: null }; + case "comment/add": + return { ...state, loading: false, error: null }; + case "comment/delete": + return { ...state, loading: false, error: null }; + case "comment/info": + return { + ...state, + loading: false, + list: data, + error: null, + }; + case "loading": + return { ...state, loading: true }; + case "error": + return { ...state, loading: false, error: data.message }; + default: + return state; + } +} diff --git a/src/Redux/reducers/index.js b/src/Redux/reducers/index.js index 6491242..67acb5d 100644 --- a/src/Redux/reducers/index.js +++ b/src/Redux/reducers/index.js @@ -8,3 +8,4 @@ export { default as qr } from "./qr.js"; export { default as book } from "./book.js"; export { default as userProduct } from "./userProduct.js"; export { default as transport } from "./transport.js"; +export { default as comment } from "./comment.js"; diff --git a/src/Redux/reducers/user.js b/src/Redux/reducers/user.js index cfbc526..825cfab 100644 --- a/src/Redux/reducers/user.js +++ b/src/Redux/reducers/user.js @@ -16,8 +16,10 @@ export default function user(state = initialState, action) { case "user/register": case "user/switchRole": case "public/sendOTP": + toast.success("کد به شماره شما ارسال گردید."); return { ...state, loading: false, status: data.profile, error: null }; case "user/otp/login": + toast.success("به دانوین خوش آمدید."); return { ...state, loading: false, @@ -38,6 +40,8 @@ export default function user(state = initialState, action) { case "mothers/list": return { ...state, loading: false, mothers: data, error: null }; case "user/setProfile": + toast.success("تغییرات اعمال شد."); + window.location = "/"; return { ...state, loading: false, error: null }; ///////////// case "loading": diff --git a/src/Redux/reducers/userProduct.js b/src/Redux/reducers/userProduct.js index c190b26..6edacb2 100644 --- a/src/Redux/reducers/userProduct.js +++ b/src/Redux/reducers/userProduct.js @@ -6,12 +6,22 @@ const initialState = { list: [], info: null, sum: null, + checkEmpty: false, }; export default function userProduct(state = initialState, action) { let { type, data, message } = action; switch (type) { case "userProduct/list": - return { ...state, loading: false, list: data, error: null }; + const checkEmpty = data.filter( + (item) => item.condition === 2 && item.product.productType === (1 || 3) + ); + return { + ...state, + loading: false, + list: data, + checkEmpty: checkEmpty.length > 0 ? false : true, + error: null, + }; case "userProduct/info": return { ...state, loading: false, info: data, error: null }; case "userProduct/update": diff --git a/src/assets/icons/image.jpg b/src/assets/icons/image.jpg new file mode 100644 index 0000000..88109f8 Binary files /dev/null and b/src/assets/icons/image.jpg differ diff --git a/src/util/onInput.js b/src/util/onInput.js new file mode 100644 index 0000000..a42c2f8 --- /dev/null +++ b/src/util/onInput.js @@ -0,0 +1,274 @@ +import { toast } from "react-toastify"; + +class onInput { + persianOnly = (txt) => { + let newText = txt; + newText = newText.replace(/`/g, ""); + newText = newText.replace(/0/g, ""); + newText = newText.replace(/1/g, ""); + newText = newText.replace(/2/g, ""); + newText = newText.replace(/3/g, ""); + newText = newText.replace(/4/g, ""); + newText = newText.replace(/5/g, ""); + newText = newText.replace(/6/g, ""); + newText = newText.replace(/7/g, ""); + newText = newText.replace(/8/g, ""); + newText = newText.replace(/9/g, ""); + newText = newText.replace(/0/g, ""); + newText = newText.replace(/q/g, ""); + newText = newText.replace(/w/g, ""); + newText = newText.replace(/e/g, ""); + newText = newText.replace(/r/g, ""); + newText = newText.replace(/t/g, ""); + newText = newText.replace(/y/g, ""); + newText = newText.replace(/u/g, ""); + newText = newText.replace(/i/g, ""); + newText = newText.replace(/o/g, ""); + newText = newText.replace(/p/g, ""); + newText = newText.replace(/\[/g, ""); + newText = newText.replace(/\]/g, ""); + newText = newText.replace(/a/g, ""); + newText = newText.replace(/s/g, ""); + newText = newText.replace(/d/g, ""); + newText = newText.replace(/f/g, ""); + newText = newText.replace(/g/g, ""); + newText = newText.replace(/h/g, ""); + newText = newText.replace(/j/g, ""); + newText = newText.replace(/k/g, ""); + newText = newText.replace(/l/g, ""); + newText = newText.replace(/\;/g, ""); + newText = newText.replace(/\'/g, ""); + newText = newText.replace(/z/g, ""); + newText = newText.replace(/x/g, ""); + newText = newText.replace(/c/g, ""); + newText = newText.replace(/v/g, ""); + newText = newText.replace(/b/g, ""); + newText = newText.replace(/n/g, ""); + newText = newText.replace(/m/g, ""); + newText = newText.replace(/\,/g, ""); + newText = newText.replace(/\./g, ""); + newText = newText.replace(/\//g, ""); + newText = newText.replace(/~/g, " "); + newText = newText.replace(/Q/g, ""); + newText = newText.replace(/W/g, ""); + newText = newText.replace(/E/g, ""); + newText = newText.replace(/R/g, ""); + newText = newText.replace(/T/g, ""); + newText = newText.replace(/Y/g, ""); + newText = newText.replace(/U/g, ""); + newText = newText.replace(/I/g, ""); + newText = newText.replace(/O/g, ""); + newText = newText.replace(/P/g, ""); + newText = newText.replace(/A/g, ""); + newText = newText.replace(/S/g, ""); + newText = newText.replace(/G/g, ""); + newText = newText.replace(/H/g, ""); + newText = newText.replace(/J/g, ""); + newText = newText.replace(/K/g, ""); + newText = newText.replace(/L/g, ""); + newText = newText.replace(/Z/g, ""); + newText = newText.replace(/X/g, ""); + newText = newText.replace(/B/g, ""); + newText = newText.replace(/N/g, ""); + newText = newText.replace(/M/g, ""); + newText = newText.replace(/\?/g, ""); + if (!newText) { + toast.info("از کاراکتر فارسی استفاده کنید"); + } + return newText; + }; + englishAndNumberWithoutSpace = (txt) => { + let newText = txt; + newText = newText.replace(/`/g, ""); + newText = newText.replace(/0/g, "0"); + newText = newText.replace(/1/g, "1"); + newText = newText.replace(/2/g, "2"); + newText = newText.replace(/3/g, "3"); + newText = newText.replace(/4/g, "4"); + newText = newText.replace(/5/g, "5"); + newText = newText.replace(/6/g, "6"); + newText = newText.replace(/7/g, "7"); + newText = newText.replace(/8/g, "8"); + newText = newText.replace(/9/g, "9"); + newText = newText.replace(/ا/g, ""); + newText = newText.replace(/ب/g, ""); + newText = newText.replace(/پ/g, ""); + newText = newText.replace(/ت/g, ""); + newText = newText.replace(/ث/g, ""); + newText = newText.replace(/ج/g, ""); + newText = newText.replace(/چ/g, ""); + newText = newText.replace(/ح/g, ""); + newText = newText.replace(/خ/g, ""); + newText = newText.replace(/د/g, ""); + newText = newText.replace(/\[/g, ""); + newText = newText.replace(/\]/g, ""); + newText = newText.replace(/ذ/g, ""); + newText = newText.replace(/ر/g, ""); + newText = newText.replace(/ز/g, ""); + newText = newText.replace(/ژ/g, ""); + newText = newText.replace(/ط/g, ""); + newText = newText.replace(/ظ/g, ""); + newText = newText.replace(/ع/g, ""); + newText = newText.replace(/غ/g, ""); + newText = newText.replace(/ف/g, ""); + newText = newText.replace(/\;/g, ""); + newText = newText.replace(/\'/g, ""); + newText = newText.replace(/ق/g, ""); + newText = newText.replace(/س/g, ""); + newText = newText.replace(/ش/g, ""); + newText = newText.replace(/ص/g, ""); + newText = newText.replace(/ض/g, ""); + newText = newText.replace(/ک/g, ""); + newText = newText.replace(/گ/g, ""); + newText = newText.replace(/\,/g, ""); + newText = newText.replace(/\./g, ""); + newText = newText.replace(/\//g, ""); + newText = newText.replace(/~/g, " "); + newText = newText.replace(/ل/g, ""); + newText = newText.replace(/م/g, ""); + newText = newText.replace(/ن/g, ""); + newText = newText.replace(/و/g, ""); + newText = newText.replace(/ه/g, ""); + newText = newText.replace(/ی/g, ""); + newText = newText.replace(/\?/g, ""); + if (!newText) { + toast.info("از کاراکتر انگلیسی واعداداستفاده کنید"); + } + return newText; + }; + numberOnly = (txt) => { + let newText = txt; + newText = newText.replace(/`/g, ""); + newText = newText.replace(/0/g, "0"); + newText = newText.replace(/1/g, "1"); + newText = newText.replace(/2/g, "2"); + newText = newText.replace(/3/g, "3"); + newText = newText.replace(/4/g, "4"); + newText = newText.replace(/5/g, "5"); + newText = newText.replace(/6/g, "6"); + newText = newText.replace(/7/g, "7"); + newText = newText.replace(/8/g, "8"); + newText = newText.replace(/9/g, "9"); + newText = newText.replace(/ا/g, ""); + newText = newText.replace(/ب/g, ""); + newText = newText.replace(/پ/g, ""); + newText = newText.replace(/ت/g, ""); + newText = newText.replace(/ث/g, ""); + newText = newText.replace(/ج/g, ""); + newText = newText.replace(/چ/g, ""); + newText = newText.replace(/ح/g, ""); + newText = newText.replace(/خ/g, ""); + newText = newText.replace(/د/g, ""); + newText = newText.replace(/\[/g, ""); + newText = newText.replace(/\]/g, ""); + newText = newText.replace(/ذ/g, ""); + newText = newText.replace(/ر/g, ""); + newText = newText.replace(/ز/g, ""); + newText = newText.replace(/ژ/g, ""); + newText = newText.replace(/ط/g, ""); + newText = newText.replace(/ظ/g, ""); + newText = newText.replace(/ع/g, ""); + newText = newText.replace(/غ/g, ""); + newText = newText.replace(/ف/g, ""); + newText = newText.replace(/\;/g, ""); + newText = newText.replace(/\'/g, ""); + newText = newText.replace(/ق/g, ""); + newText = newText.replace(/س/g, ""); + newText = newText.replace(/ش/g, ""); + newText = newText.replace(/ص/g, ""); + newText = newText.replace(/ض/g, ""); + newText = newText.replace(/ک/g, ""); + newText = newText.replace(/گ/g, ""); + newText = newText.replace(/\,/g, ""); + newText = newText.replace(/\./g, ""); + newText = newText.replace(/\//g, ""); + newText = newText.replace(/~/g, " "); + newText = newText.replace(/ل/g, ""); + newText = newText.replace(/م/g, ""); + newText = newText.replace(/ن/g, ""); + newText = newText.replace(/و/g, ""); + newText = newText.replace(/ه/g, ""); + newText = newText.replace(/ی/g, ""); + newText = newText.replace(/\?/g, ""); + newText = newText.replace(/q/g, ""); + newText = newText.replace(/w/g, ""); + newText = newText.replace(/e/g, ""); + newText = newText.replace(/r/g, ""); + newText = newText.replace(/t/g, ""); + newText = newText.replace(/y/g, ""); + newText = newText.replace(/u/g, ""); + newText = newText.replace(/i/g, ""); + newText = newText.replace(/o/g, ""); + newText = newText.replace(/p/g, ""); + newText = newText.replace(/a/g, ""); + newText = newText.replace(/s/g, ""); + newText = newText.replace(/d/g, ""); + newText = newText.replace(/f/g, ""); + newText = newText.replace(/g/g, ""); + newText = newText.replace(/h/g, ""); + newText = newText.replace(/j/g, ""); + newText = newText.replace(/k/g, ""); + newText = newText.replace(/l/g, ""); + newText = newText.replace(/z/g, ""); + newText = newText.replace(/x/g, ""); + newText = newText.replace(/c/g, ""); + newText = newText.replace(/v/g, ""); + newText = newText.replace(/b/g, ""); + newText = newText.replace(/n/g, ""); + newText = newText.replace(/m/g, ""); + newText = newText.replace(/Q/g, ""); + newText = newText.replace(/W/g, ""); + newText = newText.replace(/E/g, ""); + newText = newText.replace(/R/g, ""); + newText = newText.replace(/T/g, ""); + newText = newText.replace(/Y/g, ""); + newText = newText.replace(/U/g, ""); + newText = newText.replace(/I/g, ""); + newText = newText.replace(/O/g, ""); + newText = newText.replace(/P/g, ""); + newText = newText.replace(/A/g, ""); + newText = newText.replace(/S/g, ""); + newText = newText.replace(/G/g, ""); + newText = newText.replace(/H/g, ""); + newText = newText.replace(/J/g, ""); + newText = newText.replace(/K/g, ""); + newText = newText.replace(/L/g, ""); + newText = newText.replace(/Z/g, ""); + newText = newText.replace(/X/g, ""); + newText = newText.replace(/B/g, ""); + newText = newText.replace(/N/g, ""); + newText = newText.replace(/M/g, ""); + if (!newText) { + toast.info("از اعداداستفاده کنید"); + } + return newText; + }; + dayHandler = (num) => { + let newNum = this.numberOnly(num); + if (newNum > 31) { + toast.error("روز نباید بزرگتر از 31 باشد."); + return Math.floor(newNum / 10); + } + return newNum; + }; + monthHandler = (num) => { + let newNum = this.numberOnly(num); + if (newNum > 12 || newNum < 0) { + toast.error("ماه باید بین 1 تا 12 باشد."); + return Math.floor(newNum / 10); + } + return newNum; + }; + yearHandler = (num) => { + let newNum = this.numberOnly(num); + if (newNum > 1395) { + toast.error("سال باید کوچک‌تر از 1395 باشد."); + return Math.floor(newNum / 10); + } + return newNum; + }; +} + +const _onInput = new onInput(); + +export default _onInput; diff --git a/src/views/AR/BreadCrumb/index.js b/src/views/AR/BreadCrumb/index.js new file mode 100644 index 0000000..b49bc8b --- /dev/null +++ b/src/views/AR/BreadCrumb/index.js @@ -0,0 +1,45 @@ +import React from "react"; +import Breadcrumbs from "@material-ui/core/Breadcrumbs"; +import { Link } from "react-router-dom"; + +import "./index.scss"; + +function handleClick(event) { + event.preventDefault(); + console.info("You clicked a breadcrumb."); +} + +const maxDesktopSize = 1250; +const maxMobileSize = 650; + +const fontSize = { + desktop: window.innerWidth > maxDesktopSize ? 12 : window.innerWidth / 90, + mobile: window.innerWidth > maxDesktopSize ? 14 : window.innerWidth / 25, +}; + +export default function ActiveLastBreadcrumb(props) { + const { name } = props; + return ( + + 1000 ? fontSize.desktop : fontSize.mobile, + }} + to={"/"} + > + صفحه اصلی + + 1000 ? fontSize.desktop : fontSize.mobile, + color: "#00CC69", + }} + to={"/ar"} + > + واقعیت افزوده + + + ); +} diff --git a/src/views/AR/BreadCrumb/index.scss b/src/views/AR/BreadCrumb/index.scss new file mode 100644 index 0000000..e10f243 --- /dev/null +++ b/src/views/AR/BreadCrumb/index.scss @@ -0,0 +1,8 @@ +.MuiBreadcrumbs-li{ + a { + text-decoration: none; + font-family: numeralLight; + color: #6F7074; + letter-spacing: -1px; + } +} diff --git a/src/views/AR/index.js b/src/views/AR/index.js index 8a88bfc..b952c4a 100644 --- a/src/views/AR/index.js +++ b/src/views/AR/index.js @@ -6,6 +6,7 @@ import Navbar from "../Home/Navbar/index"; import Footer from "../Home/Footer/index"; import Loader from "~/components/Loader/index"; import Item from "./Item/index"; +import BreadCrumbs from "./BreadCrumb/index"; import "./index.scss"; @@ -30,8 +31,9 @@ class AR extends Component { {window.innerWidth > 1000 ? ( arList ? ( <> -
+
+