From ab71241656739282d6222f68b18a4ab523e0edbf Mon Sep 17 00:00:00 2001 From: Reza_ashrafi Date: Sat, 7 May 2022 20:29:49 +0430 Subject: [PATCH] reza added description to product page --- src/redux/actions/userProduct.js | 5 ++ src/redux/reducers/userProduct.js | 3 + src/screens/AR/index.js | 6 +- src/screens/Home/components/Blogs.js | 55 +++++++------ src/screens/Home/components/Videos.js | 42 +++++----- src/screens/Home/index.js | 13 +-- src/screens/Product/components/Book.js | 29 ++++--- src/screens/Product/components/Description.js | 46 ----------- src/screens/Product/components/Info.js | 82 ++++++++++++++++--- 9 files changed, 159 insertions(+), 122 deletions(-) delete mode 100644 src/screens/Product/components/Description.js diff --git a/src/redux/actions/userProduct.js b/src/redux/actions/userProduct.js index 8720881..be0aa82 100644 --- a/src/redux/actions/userProduct.js +++ b/src/redux/actions/userProduct.js @@ -1,5 +1,10 @@ import proxy from "../proxy"; const userProduct = { + arList: + (data = {}) => + async (dispatch) => { + await proxy.get("userProduct/arList", data, { dispatch }); + }, list: (data = {}) => async (dispatch) => { diff --git a/src/redux/reducers/userProduct.js b/src/redux/reducers/userProduct.js index db89fd3..9db329e 100644 --- a/src/redux/reducers/userProduct.js +++ b/src/redux/reducers/userProduct.js @@ -9,10 +9,13 @@ const initialState = { sum: null, checkEmpty: false, hasPhysical: false, + arList : [], }; export default function userFactor(state = initialState, action) { let { type, data } = action; switch (type) { + case "userProduct/arList": + return { ...state, loading: false, arList: data, error: null }; case "userProduct/myList": return { ...state, loading: false, myList: data, error: null }; case "userProduct/list": diff --git a/src/screens/AR/index.js b/src/screens/AR/index.js index d4a4975..866241c 100644 --- a/src/screens/AR/index.js +++ b/src/screens/AR/index.js @@ -9,7 +9,7 @@ import { View, } from "react-native"; import { connect } from "react-redux"; -import { publicApi } from "../../redux/actions"; +import { userProduct } from "../../redux/actions"; //components import Navbar from "../../components/Navbar"; @@ -99,13 +99,13 @@ function AR({ getArList, arList, mobile, theme }) { } const mapStateToProps = (state) => ({ - arList: state.publicApi.arList, + arList: state.userProduct.arList, mobile: state.publicApi.mobile, theme: state.publicApi.theme }); const mapDispatchToProps = { - getArList: publicApi.getArList, + getArList: userProduct.arList, }; export default connect(mapStateToProps, mapDispatchToProps)(AR); diff --git a/src/screens/Home/components/Blogs.js b/src/screens/Home/components/Blogs.js index 9a7de8f..a2a4ba8 100644 --- a/src/screens/Home/components/Blogs.js +++ b/src/screens/Home/components/Blogs.js @@ -30,21 +30,25 @@ const ios = Platform.OS === "ios"; function Blogs({ blogs, mobile, theme }) { return ( - -
- - ( - - )} - keyExtractor={(item) => item.id} - initialNumToRender={5} - /> + {blogs.length ? ( + <> + +
+ + ( + + )} + keyExtractor={(item) => item.id} + initialNumToRender={5} + /> + + ) : null} ); } @@ -53,10 +57,7 @@ const Blog = ({ blog, mobile, theme }) => { const navigation = useNavigation(); return ( navigation.push("Blog", { id: blog?.id })} > { shadowRadius: 2, elevation: 5, height: 85, - backgroundColor : theme === 'light' ? Colors.theme1.white : Colors.theme1.green79 + backgroundColor: + theme === "light" ? Colors.theme1.white : Colors.theme1.green79, }, ]} > @@ -88,7 +90,8 @@ const Blog = ({ blog, mobile, theme }) => { style={[ tw("mb-1"), { - color: theme === 'light' ? Colors.theme1.gray20 : Colors.theme1.white, + color: + theme === "light" ? Colors.theme1.gray20 : Colors.theme1.white, fontFamily: "regular", fontSize: mobile ? fontSize.sm : fontSize.lg, textAlign: ios ? "right" : "auto", @@ -109,7 +112,10 @@ const Blog = ({ blog, mobile, theme }) => { { style={[ tw("ml-1"), { - color: theme === 'light' ? Colors.theme1.gray20 : Colors.theme1.white, + color: + theme === "light" + ? Colors.theme1.gray20 + : Colors.theme1.white, fontFamily: "regular", fontSize: mobile ? fontSize.xs : fontSize.base, }, diff --git a/src/screens/Home/components/Videos.js b/src/screens/Home/components/Videos.js index 7d1230e..b887c79 100644 --- a/src/screens/Home/components/Videos.js +++ b/src/screens/Home/components/Videos.js @@ -16,27 +16,29 @@ const ios = Platform.OS === "ios"; function Videos({ videos, grades, mobile, theme }) { return ( - - -
- + {videos.length ? ( - ( -