diff --git a/navigation/index.js b/navigation/index.js index 9739705..bb471b9 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -18,6 +18,7 @@ import Login from "../src/screens/Login"; import Otp from "../src/screens/Otp"; import Product from "../src/screens/Product"; import QR from "../src/screens/QR"; +import QRContent from "../src/screens/QRContent"; import Faq from "../src/screens/Faq"; import Activation from "../src/screens/Activation"; import { connect } from "react-redux"; @@ -112,6 +113,9 @@ const HomeStackScreen = () => { initialRouteName="Home" > + + + ); @@ -173,6 +177,7 @@ const Navigation = ({ getStatus, isLogin }) => { + ); diff --git a/src/components/Drawer.js b/src/components/Drawer.js index f3d845b..3e086e4 100644 --- a/src/components/Drawer.js +++ b/src/components/Drawer.js @@ -9,7 +9,7 @@ import { TouchableOpacity, } from "react-native"; import { useNavigation } from "@react-navigation/native"; -import { Entypo, FontAwesome, Ionicons, AntDesign } from "@expo/vector-icons"; +import { Ionicons, AntDesign } from "@expo/vector-icons"; import tw from "tailwind-rn"; const width = Dimensions.get("window").width; @@ -100,7 +100,7 @@ const Drawer = ({ position, setBoxPosition }) => { > setBoxPosition()} - style={[tw(`w-1/5 h-full ${position === "0%" ? "" : ""}`)]} + style={[tw(`w-1/5 h-full ${position === "0%" ? "bg-black bg-opacity-40" : ""}`)]} > {routes.map((route, index) => ( diff --git a/src/redux/actions/index.js b/src/redux/actions/index.js index 9fd9385..f8ef32b 100644 --- a/src/redux/actions/index.js +++ b/src/redux/actions/index.js @@ -9,8 +9,4 @@ export { default as userProduct } from "./userProduct"; export { default as content } from "./content"; export { default as faq } from "./faq"; export { default as file } from "./file"; - - - - - +export { default as qr } from "./qr"; \ No newline at end of file diff --git a/src/redux/actions/qr.js b/src/redux/actions/qr.js new file mode 100644 index 0000000..e639def --- /dev/null +++ b/src/redux/actions/qr.js @@ -0,0 +1,33 @@ +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 7d836fc..aaa7d34 100644 --- a/src/redux/reducers/index.js +++ b/src/redux/reducers/index.js @@ -8,3 +8,4 @@ export { default as faq } from "./faq"; export { default as file } from "./file"; export { default as userFactor } from "./userFactor"; export { default as userProduct } from "./userProduct"; +import { 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..280d32f --- /dev/null +++ b/src/redux/reducers/qr.js @@ -0,0 +1,33 @@ +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/redux/store.js b/src/redux/store.js index a107d7f..62ad1cd 100644 --- a/src/redux/store.js +++ b/src/redux/store.js @@ -13,6 +13,7 @@ import faq from "./reducers/faq"; import file from "./reducers/file"; import userFactor from "./reducers/userFactor"; import userProduct from "./reducers/userProduct"; +import qr from './reducers/qr'; const persistConfig = { key: "root", @@ -43,6 +44,7 @@ const store = createStore( file, userFactor, userProduct, + qr }) ), initialState, diff --git a/src/screens/AR/index.js b/src/screens/AR/index.js index d7d5961..318a4d7 100644 --- a/src/screens/AR/index.js +++ b/src/screens/AR/index.js @@ -10,4 +10,4 @@ function AR({}) { ) } -export default AR; +export default AR; \ No newline at end of file diff --git a/src/screens/Activation/index.js b/src/screens/Activation/index.js index e30f59b..16f786a 100644 --- a/src/screens/Activation/index.js +++ b/src/screens/Activation/index.js @@ -53,78 +53,80 @@ function Activation({}) { position: "relative", }} > - - - - + + + - -
- - + + +
+ + + + + + + + + - - - - - - - - + + ); } diff --git a/src/screens/Faq/assets/+.png b/src/screens/Faq/assets/+.png deleted file mode 100644 index 258cdbd..0000000 Binary files a/src/screens/Faq/assets/+.png and /dev/null differ diff --git a/src/screens/Faq/assets/-.png b/src/screens/Faq/assets/-.png deleted file mode 100644 index 3013e21..0000000 Binary files a/src/screens/Faq/assets/-.png and /dev/null differ diff --git a/src/screens/Faq/components/Instance.js b/src/screens/Faq/components/Instance.js index 41ee679..a42106e 100644 --- a/src/screens/Faq/components/Instance.js +++ b/src/screens/Faq/components/Instance.js @@ -1,59 +1,55 @@ -import React, {useState} from 'react'; -import {View, Text, Dimensions, Image, Pressable} from 'react-native'; -import tw from 'tailwind-react-native-classnames'; -import minusIcon from '../assets/-.png'; -import plusIcon from '../assets/+.png'; +import { View, Text, Dimensions, TouchableOpacity } from "react-native"; +import { Entypo } from "@expo/vector-icons"; +import tw from "tailwind-rn"; -const width = Dimensions.get('window').width; +const { width } = Dimensions.get("window"); -function Instance(props) { - const [active, setActive] = useState(false); +function Instance({ question, selectFaq }) { return ( - setActive(!active)} + selectFaq(question.id)} style={[ - tw.style('w-full flex flex-col my-1.5 rounded-md px-4 py-2'), + tw("w-full flex flex-col my-1.5 rounded-md px-4 py-2"), { - backgroundColor: !active ? '#F9F9F9' : '#F6F9FD', - borderColor: !active ? '#DBDBDB' : '#196EC0', + backgroundColor: !question.active ? "#F9F9F9" : "#F6F9FD", + borderColor: !question.active ? "#DBDBDB" : "#196EC0", borderWidth: 1, }, - ]}> - + ]} + > + - نحوه خرید از سایت چگونه است ؟ + ]} + > + {question.title} - + {question.active ? ( + + ) : ( + + )} - {active && ( - + {question.active && ( + - هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دستاندازی می‌کند پس - می‌زند... در نهایت این مرگ است که باید پیروز شود، زیرا از هنگام تولد - بخشی از سرنوشت ما شده و فقط مدت کوتاهی پیش از بلعیدن طعمه اش، با آن - بازی می کند. با این همه، ما تا آنجا که ممکن است، با علاقه فراوان و - دلواپسی + { color: "#196EC0", fontSize: width / 36, fontFamily: "light" }, + tw("text-right flex-1"), + ]} + > + {question.description} )} - + ); } diff --git a/src/screens/Faq/index.js b/src/screens/Faq/index.js index cf1cb75..018ffb1 100644 --- a/src/screens/Faq/index.js +++ b/src/screens/Faq/index.js @@ -1,16 +1,17 @@ -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import { View, StyleSheet, Dimensions, ScrollView, - Text, SafeAreaView, Platform, StatusBar, LayoutAnimation, } from "react-native"; -import tw from "tailwind-react-native-classnames"; +import { connect } from "react-redux"; +import { faq } from "../../redux/actions"; +import tw from "tailwind-rn"; import Header from "../../components/Header"; import Navbar from "../../components/Navbar"; import Drawer from "../../components/Drawer"; @@ -20,10 +21,13 @@ import bgFaq from "./assets/bgFaq.png"; const width = Dimensions.get("window").width; -function Faq(props) { - const [search, setSearch] = useState(""); +function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) { const [position, setPosition] = useState("100%"); + useEffect(() => { + getFaq(); + }, []); + const setBoxPosition = () => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); setPosition(position === "100%" ? "0%" : "100%"); @@ -36,6 +40,7 @@ function Faq(props) { style={{ paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, position: "relative", + backgroundColor: "white", }} > +
+ + + -
- - - - {[0, 1, 2, 3, 4].map((item, index) => ( - - ))} - + {!search + ? list.length > 0 && + list.map((item, index) => ( + + )) + : list.length > 0 && + searchResult.map((item, index) => ( + + ))} ); } -// Later on in your styles.. -const styles = StyleSheet.create({ - contentContainerStyle: { - paddingBottom: 100, - alignItems: "flex-end", - }, - container: { - width: Dimensions.get("window").width, - backgroundColor: "white", - flexDirection: "column", - paddingVertical: 0, - paddingHorizontal: 16, - }, +const mapStateToProps = (state) => ({ + list: state.faq.list, + searchResult: state.faq.searchResult, + search: state.faq.search, }); -export default Faq; +const mapDispatchToProps = { + getFaq: faq.list, + selectFaq: faq.selectFaq, + searchFaq: faq.searchFaq, +}; + +export default connect(mapStateToProps, mapDispatchToProps)(Faq); diff --git a/src/screens/Home/assets/olum2.png b/src/screens/Home/assets/olum2.png deleted file mode 100644 index 0435ae3..0000000 Binary files a/src/screens/Home/assets/olum2.png and /dev/null differ diff --git a/src/screens/Home/components/MyBooks.js b/src/screens/Home/components/MyBooks.js index d7a95ee..ba8b5fd 100644 --- a/src/screens/Home/components/MyBooks.js +++ b/src/screens/Home/components/MyBooks.js @@ -1,4 +1,3 @@ -import React, { useState, useEffect } from "react"; import { View, Text, diff --git a/src/screens/Home/components/Scroll.js b/src/screens/Home/components/Scroll.js index e89963c..d3e2be1 100644 --- a/src/screens/Home/components/Scroll.js +++ b/src/screens/Home/components/Scroll.js @@ -55,7 +55,7 @@ const Product = ({ book, position }) => { height: position === 0 ? 245 : 118, }, ]} - onPress={() => navigation.navigate('Product')} + onPress={() => navigation.navigate("Product", { id : book.id, type : 'book'})} > -
+