diff --git a/navigation/index.js b/navigation/index.js index 074c92e..019cd2f 100644 --- a/navigation/index.js +++ b/navigation/index.js @@ -37,6 +37,7 @@ import ProfileAddress from "../src/screens/Profile/components/ProfileAddress"; import Blogs from "../src/screens/Blogs"; import Blog from "../src/screens/Blog"; import Sample from "../src/screens/Product/components/Sample"; +import Info from "../src/screens/Product/components/Info"; //style import Colors from "../src/constants/Colors"; @@ -357,6 +358,7 @@ const HomeStackScreen = () => { + ); }; @@ -374,6 +376,7 @@ const ProductsStackScreen = () => { + ); }; @@ -405,6 +408,7 @@ const CARTStackScreen = () => { > + ); }; @@ -477,6 +481,7 @@ const Navigation = ({ getStatus, isLogin, userProducts, ltr, setLTR }) => { + ); diff --git a/src/components/BottomSheetComponents/ProductQuestion.js b/src/components/BottomSheetComponents/ProductQuestion.js deleted file mode 100644 index f4518ae..0000000 --- a/src/components/BottomSheetComponents/ProductQuestion.js +++ /dev/null @@ -1,141 +0,0 @@ -import { - View, - Text, - ScrollView, - Appearance, - Platform, -} from "react-native"; -import Divider from "../Divider"; -import { connect } from "react-redux"; -import React from "react"; - -//style -import fontSize from "../../constants/fontSize"; -import tw from "tailwind-rn"; -import Colors from "../../constants/Colors"; - -const ios = Platform.OS === "ios"; - -const ProductQuestion = ({ list, mobile, theme }) => { - return ( - - refRBSheet.current.open()} - style={[ - tw( - `flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 ${ - mobile ? "py-3" : "py-4" - } mb-4` - ), - { - backgroundColor: Colors.theme1[theme].greenFF1, - }, - ]} - > - - پرسش و پاسخ - - - - {/* {list?.map((question, index) => ( - - ))} */} - - - ); -}; - -const Question = ({ question, mobile, theme }) => { - return ( - - - سوال - - - {question?.question} - - {question?.answer && ( - <> - - پاسخ - - - {question?.answer} - - - )} - {/* */} - - - ); -}; - -const mapStateToProps = (state) => ({ - mobile: state.publicApi.mobile, - theme: state.publicApi.theme -}); - -export default connect(mapStateToProps)(ProductQuestion); - -ProductQuestion.defaultProps = { - list: [ - { - question: - "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ؟", - answer: - "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ : ” ﭘﺴﺮﻡ ﺩﺭ ﺯﻧﺪﮔﯽ ﻫﺮﮔﺰ ﺩﺯﺩﯼ ﻧﮑﻦ ” ﭘﺴﺮ ﻣﺘﻌﺠﺐ ﻭ ﻣﺒﻬﻮﺕ ﺑﻪ ﭘﺪﺭ ﻧﮕﺎﻩ ﮐﺮﺩ ﺑﺪﯾﻦ ﻣﻌﻨﺎ ﮐﻪ ﺍﻭ ﻫﺮﮔﺰ ﺩﺳﺖ ﮐﺞ ﻧﺪﺍﺷﺘﻪ ﭘﺪﺭ ﺑﻪ ﻧﮕﺎﻩ ﻣﺘﻌﺠﺐ ﻓﺮﺯﻧﺪ ﻟﺒﺨﻨﺪﯼ ﺯﺩ ﻭ ﺍﺩﺍﻣﻪ ", - like: 10, - }, - { - question: - "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ؟", - answer: null, - like: 0, - }, - { - question: - "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ؟", - answer: - "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ : ” ﭘﺴﺮﻡ ﺩﺭ ﺯﻧﺪﮔﯽ ﻫﺮﮔﺰ ﺩﺯﺩﯼ ﻧﮑﻦ ” ﭘﺴﺮ ﻣﺘﻌﺠﺐ ﻭ ﻣﺒﻬﻮﺕ ﺑﻪ ﭘﺪﺭ ﻧﮕﺎﻩ ﮐﺮﺩ ﺑﺪﯾﻦ ﻣﻌﻨﺎ ﮐﻪ ﺍﻭ ﻫﺮﮔﺰ ﺩﺳﺖ ﮐﺞ ﻧﺪﺍﺷﺘﻪ ﭘﺪﺭ ﺑﻪ ﻧﮕﺎﻩ ﻣﺘﻌﺠﺐ ﻓﺮﺯﻧﺪ ﻟﺒﺨﻨﺪﯼ ﺯﺩ ﻭ ﺍﺩﺍﻣﻪ ", - like: 10, - }, - ], -}; diff --git a/src/components/BottomSheetComponents/ProductReview.js b/src/components/BottomSheetComponents/ProductReview.js deleted file mode 100644 index 7357bba..0000000 --- a/src/components/BottomSheetComponents/ProductReview.js +++ /dev/null @@ -1,123 +0,0 @@ -import { View, Text, ScrollView, Dimensions, Appearance, Platform } from "react-native"; -import React from "react"; -import {connect} from 'react-redux'; - -//style -import fontSize from "../../constants/fontSize"; -import Colors from "../../constants/Colors"; -import tw from "tailwind-rn"; - -const { width } = Dimensions.get("window"); -const ios = Platform.OS === "ios"; - -const ProductReviews = ({ list, mobile, theme }) => { - - const Property = ({ question }) => { - return ( - - refRBSheet.current.open()} - style={[ - tw( - `flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 ${mobile ? "py-3" : "py-4"} mb-4` - ), - { - backgroundColor: Colors.theme1[theme].greenFF1 + '66', - }, - ]} - > - - {question.title} - - - - {question.text} - - - {question.images.map((image, index) => ( - - Pic - - ))} - - - ); - }; - - return ( - - refRBSheet.current.open()} - style={[ - tw( - "flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 py-3 mb-2" - ), - { - backgroundColor: Colors.theme1[theme].greenFF1 , - }, - ]} - > - - نقد بررسی و توضیحات تکمیلی محصول - - - - {list?.map((question, index) => ( - - ))} - - - ); -}; - -const mapStateToProps = (state) => ({ - mobile : state.publicApi.mobile, - theme : state.publicApi.theme -}) - -export default connect(mapStateToProps)(ProductReviews); - -ProductReviews.defaultProps = { - list: [ - { - title: "آیا ارزش خرید دارد یا خیر؟", - text: "هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دست‌ اندازی می‌کند پس می‌زند... در نهایت این مرگ است که باید پیروز شود، زیرا از هنگام تولد بخشی از سرنوشت ما شده و فقط مدت کوتاهی پیش از بلعیدن طعمه اش، با آن بازی می کند. با این همه، ما تا آنجا که ممکن است، با علاقه فراوان و دلواپسی زیاد به زندگی ادامه می دهیم، همان‌ طور که تا آنجا که ممکن است طولانی‌ تر در یک حباب صابون می‌ دمیم تا بزرگتر شود، گر چه با قطعیتی تمام می‌ دانیم که خواهد ترکید و ", - images: [0, 1], - }, - ], -}; - diff --git a/src/components/BottomSheetComponents/ProductSpecifications.js b/src/components/BottomSheetComponents/ProductSpecifications.js deleted file mode 100644 index deb9070..0000000 --- a/src/components/BottomSheetComponents/ProductSpecifications.js +++ /dev/null @@ -1,122 +0,0 @@ -import { View, Text, ScrollView, Dimensions, Platform } from "react-native"; -import React from "react"; -import {connect} from 'react-redux'; - -//style -import fontSize from "../../constants/fontSize"; -import Colors from "../../constants/Colors"; -import tw from "tailwind-rn"; - -const { width } = Dimensions.get("window"); -const ios = Platform.OS === "ios"; - -const ProductSpecifications = ({ list, mobile, theme }) => { - - const Property = ({ prop }) => { - return ( - - - - {prop?.description || 'description'} - - - - - {prop?.value || 'value'} - - - - ); - }; - - return ( - - refRBSheet.current.open()} - style={[ - tw( - "flex flex-row-reverse justify-between items-center mt-3 rounded-md px-3 py-3 mb-4" - ), - { - backgroundColor: Colors.theme1[theme].greenFF1 , - }, - ]} - > - - مشخصات محصول - - - - {list?.map((prop, index) => ( - - ))} - - - ); -}; - -const mapStateToProps = (state) => ({ - mobile: state.publicApi.mobile, - theme : state.publicApi.theme -}); - -export default connect(mapStateToProps)(ProductSpecifications); - -ProductSpecifications.defaultProps = { - list: { - display: "IPS LCD 4K Samsung backlight", - weight: "2 کیلوگرم", - proccessor: "Intel core I7 11700H", - graphic: "Nvidia 3090TI 6GB", - audio: "Sonic master", - keyboard: "جزیره ای", - accessories: "کیف + کابل تبدیل برق شهری", - }, -}; - -const persian = { - display: "صفحه نمایش", - weight: "وزن", - proccessor: "پردازنده", - graphic: "پردازنده گرافیکی", - audio: "کارت صدا", - keyboard: "کیبرد", - accessories: "متعلقات جعبه", -}; diff --git a/src/components/Drawer.js b/src/components/Drawer.js index dfbbdc8..fcbc975 100644 --- a/src/components/Drawer.js +++ b/src/components/Drawer.js @@ -9,12 +9,14 @@ import { TouchableOpacity, Image, LayoutAnimation, + StatusBar, } from "react-native"; import { useNavigation } from "@react-navigation/native"; -import {asyncAwesomeAlert} from "../utils/AsyncWrappers"; +import { asyncAwesomeAlert } from "../utils/AsyncWrappers"; import { connect } from "react-redux"; import { user } from "../redux/actions"; import Svg, { Path, G } from "react-native-svg"; +import { AntDesign } from "@expo/vector-icons"; //style import tw from "tailwind-rn"; @@ -37,214 +39,224 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => { const [dropdownHeight, setDropdownHeight] = useState(0); const navigation = useNavigation(); + const routes = React.useMemo(() => { + return [ + { + name: "صفحه اصلی", + route: "Home", + icon: ( + + + + + + + ), - const routes = [ - { - name: "صفحه اصلی", - route: "Home", - icon: ( - - - - - - - ), - toast: "", - message: "", - }, - { - name: "فعال سازی", - route: "Activation", - icon: ( - - + + + + + ), + + message: "", + }, + { + name: "واقعیت افزوده", + route: "AR", + icon: ( + - - - - - ), - toast: "", - message: "", - }, - { - name: "واقعیت افزوده", - route: "AR", - icon: ( - - + + + + + ), + + message: "", + }, + { + name: "سفارشات", + route: "Orders", + icon: ( + - - - - ), - toast: "", - message: "", - }, - { - name: "سفارشات", - route: "Orders", - icon: ( - - - - - ), - toast: "", - message: "", - }, - { - name: "سوالات متداول", - route: "Faq", - icon: ( - - - - - - - ), - toast: "", - message: "", - }, - { - name: "تماس با ما", - route: "Contact", - icon: ( - - - - - - ), - toast: "", - message: "", - }, - ]; + + ), + message: "", + }, + { + name: "سوالات متداول", + route: "Faq", + icon: ( + + + + + + + ), - const Route = ({ route }) => { - return ( - navigation.navigate(route.route)} - > - {route.icon} - + + + + + + ), + + message: "", + }, + ]; + }, [user]); + + const Route = React.useCallback( + ({ route }) => { + return ( + navigation.navigate(route.route)} > - {route.name} - - - ); - }; + {route.icon} + + {route.name} + + + ); + }, + [mobile, position] + ); - const onLayout = () => { + const onLayout = React.useCallback(() => { setHeight(Dimensions.get("window").height); setWidth(Dimensions.get("window").width); - }; + }, [mobile]); - const animateDropdown = () => { + const animateDropdown = React.useCallback(() => { LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut); setDropdown(() => !dropdown); setDropdownHeight(dropdownHeight === 0 ? fontSize.base + 30 : 0); - }; + }, [position]); return ( { { backgroundColor: Colors.theme1[theme].greenCF }, ]} > - {user?.picFileIds ? ( - + {user?.picFileIds ? ( + + ) : ( + + )} + setBoxPosition()} /> - ) : ( - - )} + + { const mapStateToProps = (state) => ({ user: state.user.status, mobile: state.publicApi.mobile, - theme: state.publicApi.theme + theme: state.publicApi.theme, }); const mapDispatchToProps = { diff --git a/src/redux/reducers/comment.js b/src/redux/reducers/comment.js index 88db226..6027197 100644 --- a/src/redux/reducers/comment.js +++ b/src/redux/reducers/comment.js @@ -25,7 +25,9 @@ export default function comment(state = initialState, action) { case "comment/loading": return { ...state, loading: true }; case "comment/error": - toast.error(data.message); + asyncAwesomeAlert("خطا", data.message, { + showCancelButton: false, + }); return { ...state, loading: false, error: data.message }; default: return state; diff --git a/src/redux/reducers/faq.js b/src/redux/reducers/faq.js index 4102b8d..f970c59 100644 --- a/src/redux/reducers/faq.js +++ b/src/redux/reducers/faq.js @@ -48,7 +48,6 @@ export default function faq(state = initialState, action) { case "faq/loading": return { ...state, loading: true }; case "faq/error": - // toast.error(data.message); return { ...state, loading: false, error: data.message }; default: return state; diff --git a/src/redux/reducers/userFactor.js b/src/redux/reducers/userFactor.js index 21c721e..020f153 100644 --- a/src/redux/reducers/userFactor.js +++ b/src/redux/reducers/userFactor.js @@ -37,12 +37,10 @@ export default function userFactor(state = initialState, action) { case "userFactor/info": return { ...state, loading: false, info: data, error: null }; case "userFactor/add": - // toast.success("درخواست شما با موفقیت انجام شد."); return { ...state, loading: false, error: null, sum: data.payPrice }; case "userFactor/delete": return { ...state, loading: false, error: null }; case "userFactor/payment": - // navigation.push(data); return { ...state, loading: false, error: null }; //vod case "userFactor/myList": @@ -52,7 +50,6 @@ export default function userFactor(state = initialState, action) { case "userFactor/deleteUserOffCode": return { ...state, loading: false, error: null }; case "userFactor/paymentVOD": - // navigation.push(data); return { ...state, loading: false, error: null, isVerified: false }; case "userFactor/verifyVOD": return { ...state, loading: false, error: null, isVerified: true }; @@ -62,7 +59,6 @@ export default function userFactor(state = initialState, action) { asyncAwesomeAlert("خطا", data.message, { showCancelButton: false, }); - // toast.error(data.message); return { ...state, loading: false, error: data.message }; default: return state; diff --git a/src/redux/reducers/userProduct.js b/src/redux/reducers/userProduct.js index 6a35dc1..b15f2b6 100644 --- a/src/redux/reducers/userProduct.js +++ b/src/redux/reducers/userProduct.js @@ -36,16 +36,12 @@ export default function userFactor(state = initialState, action) { case "userProduct/update": return { ...state, loading: false, error: null }; case "userProduct/add": - // if (window.location.pathname.indexOf("products") !== -1) { - // toast.success("درخواست شما با موفقیت انجام شد."); - // } return { ...state, loading: false, error: null, sum: data.payPrice }; case "userProduct/delete": return { ...state, loading: false, error: null }; case "userProduct/loading": return { ...state, loading: true }; case "userProduct/error": - // toast.error(data.message); asyncAwesomeAlert("خطا", data.message, { showCancelButton: false, }); diff --git a/src/redux/reducers/vote.js b/src/redux/reducers/vote.js index 47c6b85..ab23f45 100644 --- a/src/redux/reducers/vote.js +++ b/src/redux/reducers/vote.js @@ -16,7 +16,9 @@ export default function vote(state = initialState, action) { case "userVote/loading": return { ...state, loading: true }; case "userVote/error": - toast.error(data.message); + asyncAwesomeAlert("خطا", data.message, { + showCancelButton: false, + }); return { ...state, loading: false, error: data.message }; default: return state; diff --git a/src/screens/Product/components/Book.js b/src/screens/Product/components/Book.js index 6891ebc..5c46e27 100644 --- a/src/screens/Product/components/Book.js +++ b/src/screens/Product/components/Book.js @@ -19,9 +19,6 @@ import separate from "../../../utils/separate"; import Description from "./Description"; import LinkBox from "./LinkBox"; import Comments from "./Comments"; -import ProductSpecifications from "../../../components/BottomSheetComponents/ProductSpecifications"; -import ProductReview from "../../../components/BottomSheetComponents/ProductReview"; -import ProductQuestion from "../../../components/BottomSheetComponents/ProductQuestion"; import Blur from "../../../components/Blur"; import ImageSlider from "../../../components/ImageSlider"; import Rates from "./Rates"; @@ -43,7 +40,7 @@ function Book({ userFavoriteLoading, mobile, userProducts, - theme + theme, }) { const navigation = useNavigation(); const [type, setType] = useState(1); @@ -69,7 +66,6 @@ function Book({ )[0]; }, [userProducts, book]); - return ( {!mobile && } @@ -426,22 +422,29 @@ function Book({ + onPress={() => + navigation.push("Info", { + type: { name: "مشخصات محصول", value: "productSpecifications" }, + }) } - height={height / 2} /> } - height={height / 2} + onPress={() => + navigation.push("Info", { + type: { name: "نقد و بررسی", value: "productReview" }, + }) + } /> } - height={height / 2} + onPress={() => + navigation.push("Info", { + type: { name: "پرسش و پاسخ", value: "productQuestion" }, + }) + } /> {(product.rate || 4) && ( <> @@ -465,7 +468,10 @@ function Book({ - + )} @@ -478,7 +484,7 @@ const mapStateToProps = (state) => ({ userProductsLoading: state.userProduct.loading, userFavoriteLoading: state.userFavorite.loading, mobile: state.publicApi.mobile, - theme: state.publicApi.theme + theme: state.publicApi.theme, }); const mapDispatchToProps = { diff --git a/src/screens/Product/components/Comments.js b/src/screens/Product/components/Comments.js index 6855a32..c0d0bf7 100644 --- a/src/screens/Product/components/Comments.js +++ b/src/screens/Product/components/Comments.js @@ -163,15 +163,17 @@ const AddComment = ({ addComment, productId, ...props }) => { fontFamily: "light", borderWidth: 1, borderColor: Colors.theme1[colorScheme].grayE3, + height : fontSize.base + 30 }, ]} + value={comment.title} placeholder="عنوان نظر ..." onChangeText={(text) => setCommentForm({...commentForm, title : text})} /> { fontFamily: "light", borderWidth: 1, borderColor: Colors.theme1[colorScheme].grayE3, + }, ]} value={comment.text} multiline={true} + textAlignVertical="top" placeholder="متن نظر ..." onChangeText={(text) => setCommentForm({...commentForm, text})} /> diff --git a/src/screens/Product/components/Info.js b/src/screens/Product/components/Info.js new file mode 100644 index 0000000..a00f894 --- /dev/null +++ b/src/screens/Product/components/Info.js @@ -0,0 +1,344 @@ +import { + View, + Text, + ScrollView, + Appearance, + Platform, + StyleSheet, + SafeAreaView, + StatusBar, + Dimensions, +} from "react-native"; +import { connect } from "react-redux"; +import React from "react"; + +//components +import Navbar from "../../../components/Navbar"; + +//style +import fontSize from "../../../constants/fontSize"; +import tw from "tailwind-rn"; +import Colors from "../../../constants/Colors"; + +//variables +const ios = Platform.OS === "ios"; +const { width } = Dimensions.get("window"); + +const Info = ({ + route, + questionList = [ + { + question: + "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ؟", + answer: + "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ : ” ﭘﺴﺮﻡ ﺩﺭ ﺯﻧﺪﮔﯽ ﻫﺮﮔﺰ ﺩﺯﺩﯼ ﻧﮑﻦ ” ﭘﺴﺮ ﻣﺘﻌﺠﺐ ﻭ ﻣﺒﻬﻮﺕ ﺑﻪ ﭘﺪﺭ ﻧﮕﺎﻩ ﮐﺮﺩ ﺑﺪﯾﻦ ﻣﻌﻨﺎ ﮐﻪ ﺍﻭ ﻫﺮﮔﺰ ﺩﺳﺖ ﮐﺞ ﻧﺪﺍﺷﺘﻪ ﭘﺪﺭ ﺑﻪ ﻧﮕﺎﻩ ﻣﺘﻌﺠﺐ ﻓﺮﺯﻧﺪ ﻟﺒﺨﻨﺪﯼ ﺯﺩ ﻭ ﺍﺩﺍﻣﻪ ", + like: 10, + }, + { + question: + "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ؟", + answer: null, + like: 0, + }, + { + question: + "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ؟", + answer: + "خالد حسینی تو رمان باد بادک باز مینویسه : ﻣﺮﺩ ﺁﻫﺴﺘﻪ ﺩﺭ ﮔﻮﺵ ﻓﺮﺯﻧﺪ ﺗﺎﺯﻩ ﺑﻪ ﺑﻠﻮﻍ ﺭﺳﯿﺪﻩ ﺍﺵ ﺑﺮﺍﯼ ﭘﻨﺪ ﭼﻨﯿﻦ ﻧﺠﻮﺍ ﮐﺮﺩ : ” ﭘﺴﺮﻡ ﺩﺭ ﺯﻧﺪﮔﯽ ﻫﺮﮔﺰ ﺩﺯﺩﯼ ﻧﮑﻦ ” ﭘﺴﺮ ﻣﺘﻌﺠﺐ ﻭ ﻣﺒﻬﻮﺕ ﺑﻪ ﭘﺪﺭ ﻧﮕﺎﻩ ﮐﺮﺩ ﺑﺪﯾﻦ ﻣﻌﻨﺎ ﮐﻪ ﺍﻭ ﻫﺮﮔﺰ ﺩﺳﺖ ﮐﺞ ﻧﺪﺍﺷﺘﻪ ﭘﺪﺭ ﺑﻪ ﻧﮕﺎﻩ ﻣﺘﻌﺠﺐ ﻓﺮﺯﻧﺪ ﻟﺒﺨﻨﺪﯼ ﺯﺩ ﻭ ﺍﺩﺍﻣﻪ ", + like: 10, + }, + ], + reviewList = [ + { + title: "آیا ارزش خرید دارد یا خیر؟", + text: "هر نفسی که فرو می‌ بریم، مرگی را که مدام به ما دست‌ اندازی می‌کند پس می‌زند... در نهایت این مرگ است که باید پیروز شود، زیرا از هنگام تولد بخشی از سرنوشت ما شده و فقط مدت کوتاهی پیش از بلعیدن طعمه اش، با آن بازی می کند. با این همه، ما تا آنجا که ممکن است، با علاقه فراوان و دلواپسی زیاد به زندگی ادامه می دهیم، همان‌ طور که تا آنجا که ممکن است طولانی‌ تر در یک حباب صابون می‌ دمیم تا بزرگتر شود، گر چه با قطعیتی تمام می‌ دانیم که خواهد ترکید و ", + images: [0, 1], + }, + ], + specificationsList, + mobile, + theme, +}) => { + const { type } = route.params; + const components = React.useMemo(() => { + return { + productQuestion: ( + + ), + productReview: ( + + ), + productSpecifications: ( + + ), + }; + }, [type]); + + const styles = React.useMemo(() => { + return StyleSheet.create({ + contentContainerStyle: { + paddingBottom: 100, + }, + container: { + backgroundColor: "white", + flexDirection: "column", + paddingVertical: 5, + paddingHorizontal: 16, + }, + }); + }, [type]); + + return ( + + + + {components[type.value]} + + + ); +}; + +const ProductQuestion = ({ list, mobile, theme }) => { + return ( + + refRBSheet.current.open()} + style={[ + tw( + `flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 ${ + mobile ? "py-3" : "py-4" + } mb-4` + ), + { + backgroundColor: Colors.theme1[theme].greenFF1, + }, + ]} + > + + پرسش و پاسخ + + + + {/* {list?.map((question, index) => ( + + ))} */} + + + ); +}; + +const ProductReviews = ({ list, mobile, theme }) => { + const Property = React.useCallback( + ({ question }) => { + return ( + + refRBSheet.current.open()} + style={[ + tw( + `flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 ${ + mobile ? "py-3" : "py-4" + } mb-4` + ), + { + backgroundColor: Colors.theme1[theme].greenFF1 + "66", + }, + ]} + > + + {question.title} + + + + {question.text} + + + {question.images.map((image, index) => ( + + Pic + + ))} + + + ); + }, + [list, mobile, theme] + ); + + return ( + + refRBSheet.current.open()} + style={[ + tw( + "flex flex-row-reverse justify-between items-center mt-3 rounded-md px-2 py-3 mb-2" + ), + { + backgroundColor: Colors.theme1[theme].greenFF1, + }, + ]} + > + + نقد بررسی و توضیحات تکمیلی محصول + + + + {list?.map((question, index) => ( + + ))} + + + ); +}; + +const ProductSpecifications = ({ list, mobile, theme }) => { + const Property = ({ prop }) => { + return ( + + + + {prop?.description || "description"} + + + + + {prop?.value || "value"} + + + + ); + }; + + return ( + + refRBSheet.current.open()} + style={[ + tw( + "flex flex-row-reverse justify-between items-center mt-3 rounded-md px-3 py-3 mb-4" + ), + { + backgroundColor: Colors.theme1[theme].greenFF1, + }, + ]} + > + + مشخصات محصول + + + + {list?.map((prop, index) => ( + + ))} + + + ); +}; + +const mapStateToProps = (state) => ({ + mobile: state.publicApi.mobile, + theme: state.publicApi.theme, +}); + +export default connect(mapStateToProps)(Info); diff --git a/src/screens/Product/components/LinkBox.js b/src/screens/Product/components/LinkBox.js index 9c7c6ef..a6e194e 100644 --- a/src/screens/Product/components/LinkBox.js +++ b/src/screens/Product/components/LinkBox.js @@ -1,7 +1,6 @@ import React, { useRef } from "react"; import { Text, TouchableOpacity, Appearance } from "react-native"; import { connect } from "react-redux"; -import RBSheet from "react-native-raw-bottom-sheet"; import { Entypo } from "@expo/vector-icons"; //style @@ -9,65 +8,47 @@ import tw from "tailwind-rn"; import fontSize from "../../../constants/fontSize"; import Colors from "../../../constants/Colors"; -function Description({ title, component, height, mobile, theme }) { +function Description({ title, onPress, mobile, theme }) { const refRBSheet = useRef(); return ( - <> - refRBSheet.current.open()} + onPress()} + style={[ + tw( + `flex flex-row-reverse justify-between items-center mt-3 rounded-sm px-5 ${ + mobile ? "py-4" : "py-4" + }` + ), + { + backgroundColor: Colors.theme1[theme].greenCF + "15", + // borderWidth : 1, + }, + ]} + > + - - {title} - - - - - {component} - - + {title} + + + ); } const mapStateToProps = (state) => ({ mobile: state.publicApi.mobile, - theme: state.publicApi.theme + theme: state.publicApi.theme, }); export default connect(mapStateToProps)(Description); diff --git a/src/screens/Product/components/Sample.js b/src/screens/Product/components/Sample.js index a256f9b..25dbd1c 100644 --- a/src/screens/Product/components/Sample.js +++ b/src/screens/Product/components/Sample.js @@ -35,4 +35,4 @@ const Sample = ({route}) => { ); }; -export default Sample; +export default Sample; \ No newline at end of file diff --git a/src/utils/onInput.js b/src/utils/onInput.js index 5be91d8..da0670f 100644 --- a/src/utils/onInput.js +++ b/src/utils/onInput.js @@ -71,7 +71,6 @@ class onInput { newText = newText.replace(/M/g, ""); newText = newText.replace(/\?/g, ""); if (!newText && newText.length !== 0) { - // toast.info("از کاراکتر فارسی استفاده کنید"); } return newText; }; @@ -130,7 +129,6 @@ class onInput { newText = newText.replace(/ی/g, ""); newText = newText.replace(/\?/g, ""); if (!newText && newText.length !== 0) { - // toast.info("از کاراکتر انگلیسی واعداداستفاده کنید"); } return newText; }; @@ -247,14 +245,13 @@ class onInput { newText = newText.replace(/N/g, ""); newText = newText.replace(/M/g, ""); if (!newText && newText.length !== 0) { - toast.info("از اعداداستفاده کنید"); + } return newText; }; dayHandler = (num) => { let newNum = this.numberOnly(num); if (newNum > 31) { - // toast.error("روز نباید بزرگتر از 31 باشد."); return Math.floor(newNum / 10); } return newNum; @@ -262,7 +259,6 @@ class onInput { monthHandler = (num) => { let newNum = this.numberOnly(num); if (newNum > 12 || newNum < 0) { - // toast.error("ماه باید بین 1 تا 12 باشد."); return Math.floor(newNum / 10); } return newNum; @@ -270,7 +266,6 @@ class onInput { yearHandler = (num) => { let newNum = this.numberOnly(num); if (newNum > 1395) { - // toast.error("سال باید کوچک‌تر از 1395 باشد."); return Math.floor(newNum / 10); } return newNum;