diff --git a/build.zip b/build.zip deleted file mode 100644 index bfd36aa..0000000 Binary files a/build.zip and /dev/null differ diff --git a/src/components/Audio/index.js b/src/components/Audio/index.js index 5085f97..482adc9 100644 --- a/src/components/Audio/index.js +++ b/src/components/Audio/index.js @@ -1,10 +1,9 @@ -export default function MaterialAudioPlayer(props) { +import { file } from "../../redux/actions"; + +export default function MaterialAudioPlayer({ fileIds }) { return ( ); } diff --git a/src/redux/actions/index.js b/src/redux/actions/index.js index 05cef0f..cc0da2a 100644 --- a/src/redux/actions/index.js +++ b/src/redux/actions/index.js @@ -10,6 +10,7 @@ export { default as content } from "./content"; export { default as faq } from "./faq"; export { default as file } from "./file"; export {default as scrollAction} from "./scroll"; +export {default as qr} from "./qr"; diff --git a/src/redux/actions/qr.js b/src/redux/actions/qr.js new file mode 100644 index 0000000..06dabbb --- /dev/null +++ b/src/redux/actions/qr.js @@ -0,0 +1,32 @@ +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 }); + }, + 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; \ No newline at end of file diff --git a/src/redux/reducers/index.js b/src/redux/reducers/index.js index c89c0b8..584b6eb 100644 --- a/src/redux/reducers/index.js +++ b/src/redux/reducers/index.js @@ -9,6 +9,4 @@ export { default as file } from "./file"; export { default as userFactor } from "./userFactor"; export { default as userProduct } from "./userProduct"; export {default as scrollAction} from "./scroll"; - - - +export {default as qr} from "./qr"; \ No newline at end of file diff --git a/src/redux/reducers/qr.js b/src/redux/reducers/qr.js new file mode 100644 index 0000000..6b7e646 --- /dev/null +++ b/src/redux/reducers/qr.js @@ -0,0 +1,32 @@ +const initialState = { + loading: false, + error: null, + list: null, +}; +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: data, + error: null, + }; + ///////////// + case "loading": + return { ...state, loading: true }; + case "error": + return { ...state, loading: false, error: data.message }; + default: + return state; + } +} \ No newline at end of file diff --git a/src/router.js b/src/router.js index cf11d80..123c4cc 100644 --- a/src/router.js +++ b/src/router.js @@ -1,6 +1,6 @@ import React, { useEffect } from "react"; -import { BrowserRouter, Routes, Route, } from "react-router-dom"; -import { Navigate } from 'react-router-dom'; +import { BrowserRouter, Routes, Route } from "react-router-dom"; +import { Navigate } from "react-router-dom"; import { connect } from "react-redux"; import { publicApi } from "./redux/actions"; import Navbar from "./components/Navbar"; @@ -35,7 +35,7 @@ function Router({ isLogin, headerOptions, setDesktopContentTransform, - footerOptions + footerOptions, }) { useEffect(() => { window.addEventListener("scroll", () => { @@ -65,7 +65,7 @@ function Router({ > {headerOptions?.shown && } - + {isMobile && ( <> @@ -160,25 +160,27 @@ function Router({ /> } /> - : + isMobile ? ( + + ) : ( + + ) } - > - + > } /> + + } + /> } /> - - {headerOptions?.shown && } + {headerOptions?.shown && !isMobile && } diff --git a/src/views/QR/Content/components/Links.js b/src/views/QR/Content/components/Links.js index 40a999e..867564f 100644 --- a/src/views/QR/Content/components/Links.js +++ b/src/views/QR/Content/components/Links.js @@ -2,12 +2,12 @@ import React from "react"; import { Link } from "react-router-dom"; import linkIcon from "./links.svg"; -export default function Links({ links }) { +export default function Links({ data }) { return (
لینک ها - {links.map((link, i) => ( + {data.map((link, i) => ( {link} diff --git a/src/views/QR/Content/components/PDF.js b/src/views/QR/Content/components/PDF.js index f294c8a..70d83ad 100644 --- a/src/views/QR/Content/components/PDF.js +++ b/src/views/QR/Content/components/PDF.js @@ -1,10 +1,10 @@ import React from "react"; import pdfIcon from "./pdf.svg"; -export default function PDF({ name, file }) { +export default function PDF({ data }) { return (
- {name} + {data.name}
); diff --git a/src/views/QR/Content/components/PPT.js b/src/views/QR/Content/components/PPT.js index 246407c..35779a6 100644 --- a/src/views/QR/Content/components/PPT.js +++ b/src/views/QR/Content/components/PPT.js @@ -2,11 +2,11 @@ import React from "react"; import pptIcon from "./ppt.png"; -export default function PPT({ name, file }) { +export default function PPT({ data }) { return (
- {name} + {data.name} +
+
+
- )} + + اسکن کد QR فعالسازی کتاب + +

+ کد کیو آر روی کارت فعالسازی را با دوربین گوشی اسکن کنید تا محتوای + دیجیتال مربوط به کتاب برای شما فعال شود +

+ +
); }; diff --git a/src/views/QR/index.js b/src/views/QR/index.js index 281506a..ec614e3 100644 --- a/src/views/QR/index.js +++ b/src/views/QR/index.js @@ -1,9 +1,12 @@ import React, { useState } from "react"; +import {connect} from 'react-redux'; +import {qr} from '../../redux/actions'; import Scan from "./Scan"; import Content from "./Content"; function QR({ headerOptions, page }) { const [currentPage, setCurrentPage] = useState(page); + return ( <> {currentPage === "scan" && ( @@ -16,4 +19,12 @@ function QR({ headerOptions, page }) { ); } -export default QR; +const mapStateToProps = (state) => ({ + +}); + +const mapDispatchToProps = { + getData : qr.info +} + +export default connect()(QR);