From 064fe9efabcd64c548ee9469609b8f9632cd59e4 Mon Sep 17 00:00:00 2001 From: RezaAshrafi77 Date: Wed, 28 Jul 2021 16:02:27 +0430 Subject: [PATCH] reza added qr redux --- src/AppRouter.js | 8 +- src/History/index.js | 3 + src/Redux/actions/index.js | 6 +- src/Redux/actions/qr.js | 37 +++++ src/Redux/reducers/blog.js | 16 +- src/Redux/reducers/index.js | 10 +- src/Redux/reducers/qr.js | 70 ++++++++ src/views/AR/Item/index.js | 40 +++++ src/views/AR/Item/index.scss | 76 +++++++++ src/views/AR/index.js | 86 ++++++++++ src/views/AR/index.scss | 20 +++ src/views/Auth/Profile/Birthdate/index.js | 8 + .../Auth/Profile/MultipleSelector/index.js | 2 +- .../Auth/Profile/MultipleSelector/index.scss | 4 +- src/views/QR/index.js | 154 +++++++----------- src/views/QRScan/History/index.js | 3 + src/views/QRScan/index.js | 33 +++- 17 files changed, 449 insertions(+), 127 deletions(-) create mode 100644 src/History/index.js create mode 100644 src/Redux/actions/qr.js create mode 100644 src/Redux/reducers/qr.js create mode 100644 src/views/AR/Item/index.js create mode 100644 src/views/AR/Item/index.scss create mode 100644 src/views/AR/index.js create mode 100644 src/views/AR/index.scss create mode 100644 src/views/QRScan/History/index.js diff --git a/src/AppRouter.js b/src/AppRouter.js index 90a2560..4025fa4 100644 --- a/src/AppRouter.js +++ b/src/AppRouter.js @@ -1,7 +1,7 @@ import React, { Component } from "react"; import "./App.css"; import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; - +import history from "./History/index"; import { connect } from "react-redux"; import proxy from "./Redux/proxy"; @@ -19,6 +19,7 @@ import ChatList from "./views/ChatList/index"; import Chatroom from "./views/ChatRoom/index"; import Cart from "./views/Cart/index"; import MyBooks from "./views/MyBooks/index"; +import AR from "./views/AR/index"; class AppRouter extends Component { constructor(props) { @@ -42,7 +43,7 @@ class AppRouter extends Component { ); return ( - + {home} @@ -84,6 +85,9 @@ class AppRouter extends Component { + + + {window.innerWidth < 1000 ? ( diff --git a/src/History/index.js b/src/History/index.js new file mode 100644 index 0000000..ec3d07f --- /dev/null +++ b/src/History/index.js @@ -0,0 +1,3 @@ +import { createBrowserHistory } from "history"; + +export default createBrowserHistory(); diff --git a/src/Redux/actions/index.js b/src/Redux/actions/index.js index db5f287..ec2b4e1 100644 --- a/src/Redux/actions/index.js +++ b/src/Redux/actions/index.js @@ -1,7 +1,7 @@ // @create-index -export { default as chat } from './chat.js'; +export { default as chat } from "./chat.js"; // export { default as message } from './message.js'; // export { default as public } from './public.js'; -export { default as user } from './user.js'; - +export { default as user } from "./user.js"; +export { default as qr } from "./qr.js"; diff --git a/src/Redux/actions/qr.js b/src/Redux/actions/qr.js new file mode 100644 index 0000000..d67af7e --- /dev/null +++ b/src/Redux/actions/qr.js @@ -0,0 +1,37 @@ +import proxy from "../proxy"; +const qr = { + list: + (data = {}) => + async (dispatch) => + await proxy.get("qr/list", data, { dispatch }), + info: + // (data = {}) => + // async (dispatch) => { + // await proxy.get("qr/info", data, { dispatch }); + // }, + + + (data = {}) => + async (dispatch) => + dispatch({ type: "qr/info", payload: data }), + add: + (data = {}, data2 = {}) => + async (dispatch) => { + await proxy.post("qr/add", data); + await proxy.get("qr/list", 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 qr; diff --git a/src/Redux/reducers/blog.js b/src/Redux/reducers/blog.js index 05b1d0e..bd808b2 100644 --- a/src/Redux/reducers/blog.js +++ b/src/Redux/reducers/blog.js @@ -3,23 +3,23 @@ const initialState = { error: null, list: [], }; -export default function user(state = initialState, action) { +export default function blog(state = initialState, action) { let { type, data } = action; switch (type) { - case 'blog/list': + case "blog/list": return { ...state, loading: false, list: data, error: null }; - case 'blog/update': + case "blog/update": return { ...state, loading: false, error: null }; - case 'blog/add': + case "blog/add": return { ...state, loading: false, error: null }; - case 'blog/delete': + case "blog/delete": return { ...state, loading: false, error: null }; ///////////// - case 'loading': + case "loading": return { ...state, loading: true }; - case 'error': + case "error": return { ...state, loading: false, error: data.message }; default: return state; } -} \ No newline at end of file +} diff --git a/src/Redux/reducers/index.js b/src/Redux/reducers/index.js index 8605f81..8a951e9 100644 --- a/src/Redux/reducers/index.js +++ b/src/Redux/reducers/index.js @@ -1,7 +1,7 @@ // @create-index -export { default as chat } from './chat.js'; -export { default as message } from './message.js'; -export { default as public } from './public.js'; -export { default as user } from './user.js'; - +export { default as chat } from "./chat.js"; +export { default as message } from "./message.js"; +export { default as public } from "./public.js"; +export { default as user } from "./user.js"; +export { default as qr } from "./qr.js"; diff --git a/src/Redux/reducers/qr.js b/src/Redux/reducers/qr.js new file mode 100644 index 0000000..d7796e3 --- /dev/null +++ b/src/Redux/reducers/qr.js @@ -0,0 +1,70 @@ +const initialState = { + loading: false, + error: null, + list: [ + { + type: "voice", + title: "استاد رضایی:‌توضیح در مورد درس آتشفشان", + file: null, + }, + { + type: "video", + title: "ویدئوی آزمایشی آتش فشان سرکه", + file: null, + }, + { + type: "ppt", + title: "فایل پاورپوینت ارائه درس آتشفشان", + link: "", + }, + { + type: "pdf", + title: "فایل پی دی اف ارائه درس آتشفشان", + link: "", + }, + { + type: "links", + links: [ + { + title: "وبسایت آموزشی دانوین", + link: "", + }, + { + title: "وبسایت رسمی مدیریت راهبردی کشور", + link: "", + }, + { + title: "سازمان تبلیغات صنایع سبک", + link: "", + }, + ], + }, + ], +}; +export default function qr(state = initialState, action) { + let { type, data } = action; + switch (type) { + case "qr/list": + return { ...state, loading: false, error: null }; + case "qr/update": + return { ...state, loading: false, error: null }; + case "qr/add": + return { ...state, loading: false, error: null }; + case "qr/delete": + return { ...state, loading: false, error: null }; + case "qr/info": + return { + ...state, + loading: false, + list: action.payload === "Zist10-13" ? [] : null, + error: null, + }; + ///////////// + case "loading": + return { ...state, loading: true }; + case "error": + return { ...state, loading: false, error: data.message }; + default: + return state; + } +} diff --git a/src/views/AR/Item/index.js b/src/views/AR/Item/index.js new file mode 100644 index 0000000..2a6a5fd --- /dev/null +++ b/src/views/AR/Item/index.js @@ -0,0 +1,40 @@ +import React, { Component } from "react"; + +import "./index.scss"; + +const maxMobileSize = 550; +const maxDesktopSize = 1250; + +const fontSize = { + mobile: { + h1: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 26, + h2: window.innerWidth > maxMobileSize ? 16 : window.innerWidth / 34, + div: window.innerWidth > maxMobileSize ? 18 : window.innerWidth / 32, + }, + desktop: { + h1: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 70, + div: window.innerWidth > maxDesktopSize ? 16 : window.innerWidth / 85, + old: window.innerWidth > maxDesktopSize ? 9 : window.innerWidth / 120, + }, +}; + +export default class Item extends Component { + render() { + const { data } = this.props; + return ( + <> + {window.innerWidth < 1000 ? ( + + ) : null} + {window.innerWidth > 1000 ? ( +
+ ) : null} + + ); + } +} diff --git a/src/views/AR/Item/index.scss b/src/views/AR/Item/index.scss new file mode 100644 index 0000000..fcd1bf1 --- /dev/null +++ b/src/views/AR/Item/index.scss @@ -0,0 +1,76 @@ +.mobile-ar-book { + width: calc(100% / 2); + padding: 10px; + a { + width: 100%; + text-decoration: none; + &:hover { + } + img { + width: 100%; + height: 170px; + border-radius: 20px; + } + h1 { + font-family: numeralBold; + margin-top: 15px; + color: #4d4d4d; + letter-spacing: -1px; + } + } +} + +.products-product { + width: calc(100% / 4); + padding: 10px; + margin-bottom: 20px; + a { + width: 100%; + text-decoration: none; + &:hover { + } + img { + width: 100%; + height: 200px; + border-radius: 30px; + } + h1 { + font-family: numeralBold; + margin-top: 15px; + color: #02a1a6; + letter-spacing: -1px; + text-align: center; + } + } + &__notAvailabe { + font-family: numeralBold; + width: 100%; + text-align: center; + color: #6f7074; + margin-top: 15px; + } + &__price { + width: 100%; + margin-top: 15px; + text-align: center; + &--old { + font-family: numeralBold; + color: #6f7074; + position: relative; + margin-left: 10px; + align-items: center; + span { + position: absolute; + left: 0px; + width: 100%; + height: 2px; + background-color: rgba(121, 121, 121, 0.534); + transform: rotate(-14deg); + } + } + &--price { + color: #4d4d4d; + font-family: numeralBold; + } + } +} diff --git a/src/views/AR/index.js b/src/views/AR/index.js new file mode 100644 index 0000000..b518e8d --- /dev/null +++ b/src/views/AR/index.js @@ -0,0 +1,86 @@ +import React, { Component } from "react"; +import Navbar from "../Home/Navbar/index"; +import Footer from "../Home/Footer/index"; +import Item from "./Item/index"; + +import zist_10 from "~/assets/images/zist-10.png"; +import chemistry_10 from "~/assets/images/chemistry-10.png"; +import sciense_8 from "~/assets/images/sciense-8.png"; +import sciense_7 from "~/assets/images/sciense-7.png"; +import sciense_6 from "~/assets/images/sciense-6.png"; +import sciense_9 from "~/assets/images/sciense-9.png"; + +import "./index.scss"; + +const maxDesktopSize = 1250; + +const fontSize = { + desktop: { + h1: window.innerWidth > maxDesktopSize ? 25 : window.innerWidth / 70, + p: window.innerHeight > maxDesktopSize ? 15 : window.innerWidth / 90, + }, +}; + +export default class AR extends Component { + render() { + const { data } = this.props; + return ( + <> + {window.innerWidth > 1000 ? ( + <> +
+ +
+
+