reza fixed one toxmi bug

master
Reza_ashrafi 3 years ago
parent 9b2b46d3dc
commit 5e1bece2f3
  1. 2
      navigation/index.js
  2. 13
      src/components/BottomSheet.js
  3. 38
      src/components/CustomTextInput.js
  4. 14
      src/components/Drawer.js
  5. 6
      src/components/Empty.js
  6. 35
      src/components/Navbar.js
  7. 14
      src/components/Scanner.js
  8. 1
      src/redux/reducers/activation.js
  9. 1
      src/redux/reducers/book.js
  10. 2
      src/redux/reducers/comment.js
  11. 1
      src/redux/reducers/product.js
  12. 1
      src/redux/reducers/user.js
  13. 1
      src/redux/reducers/userFavorite.js
  14. 1
      src/redux/reducers/userProduct.js
  15. 1
      src/redux/reducers/vote.js
  16. 7
      src/screens/AR/index.js
  17. 6
      src/screens/Address/index.js
  18. 26
      src/screens/Blog/index.js
  19. 8
      src/screens/Contact/layouts/Ticket.js
  20. 26
      src/screens/DeliveryForm/Address/index.js
  21. 4
      src/screens/Faq/components/Instance.js
  22. 5
      src/screens/Faq/index.js
  23. 4
      src/screens/Home/components/MyBooks.js
  24. 2
      src/screens/Home/index.js
  25. 2
      src/screens/Login/index.js
  26. 16
      src/screens/Product/components/Book.js
  27. 26
      src/screens/Products/components/Main.js
  28. 8
      src/screens/Profile/components/ProfileAddress/index.js
  29. 69
      src/screens/Profile/components/ProfileBookmark/index.js
  30. 5
      src/screens/Profile/components/User.js
  31. 35
      src/screens/QRContent/Tab/index.js
  32. 2
      src/screens/QRContent/index.js
  33. 10
      src/screens/ShoppingCart/components/Code.js
  34. 65
      src/screens/ShoppingCart/components/Product.js
  35. 7
      src/screens/ShoppingCart/index.js
  36. 18
      src/screens/Video/components/Season.js
  37. 6
      src/screens/Video/index.js
  38. 6
      src/screens/VideoDisplay/index.js
  39. 8
      src/screens/Videos/index.js

@ -446,6 +446,8 @@ const PROFILEStackScreen = () => {
<PROFILEStack.Screen name="ProfileBookmark" component={ProfileBookmark} /> <PROFILEStack.Screen name="ProfileBookmark" component={ProfileBookmark} />
<ProductsStack.Screen name="Products" component={Products} /> <ProductsStack.Screen name="Products" component={Products} />
<PROFILEStack.Screen name="Product" component={Product} /> <PROFILEStack.Screen name="Product" component={Product} />
<HomeStack.Screen name="Blogs" component={Blogs} />
<HomeStack.Screen name="Blog" component={Blog} />
<PROFILEStack.Screen name="MyCourses" component={MyCourses} /> <PROFILEStack.Screen name="MyCourses" component={MyCourses} />
</PROFILEStack.Navigator> </PROFILEStack.Navigator>
); );

@ -1,13 +0,0 @@
import { View, Text } from 'react-native';
import React from 'react';
const BottomSheet = () => {
return (
<View>
<Text></Text>
</View>
);
};
export default BottomSheet;

@ -1,12 +1,6 @@
import React, { useState } from "react"; import React from "react";
import { import { TextInput, View, Text, StyleSheet } from "react-native";
TextInput, import { connect } from "react-redux";
View,
Text,
Dimensions,
StyleSheet,
} from "react-native";
import {connect} from 'react-redux';
import tw from "tailwind-rn"; import tw from "tailwind-rn";
import Colors from "../constants/Colors"; import Colors from "../constants/Colors";
@ -20,7 +14,7 @@ const FloatingLabelInput = ({
onChange, onChange,
name, name,
value, value,
color, textColor,
placeholder, placeholder,
maxLength, maxLength,
autoFocus, autoFocus,
@ -31,7 +25,10 @@ const FloatingLabelInput = ({
theme, theme,
...props ...props
}) => { }) => {
const [isFocused, setIsFocused] = useState(false); const [isFocused, setIsFocused] = React.useState(false);
const color = React.useMemo(() => {
return Colors.theme1[theme];
}, [theme]);
const styles = StyleSheet.create({ const styles = StyleSheet.create({
labelStyle: { labelStyle: {
@ -47,17 +44,13 @@ const FloatingLabelInput = ({
: -Math.floor(fontSize.sm), : -Math.floor(fontSize.sm),
}, },
], ],
color: !isFocused color: !isFocused ? color.gray2077 : color.green79,
? Colors.theme1[theme].gray2077
: Colors.theme1[theme].green79,
}, },
inputStyle: { inputStyle: {
fontSize: fontSize.lg, fontSize: fontSize.lg,
color: Colors.theme1[theme].black, color: color.black,
borderWidth: 1, borderWidth: 1,
borderColor: isFocused borderColor: isFocused ? color.greenC8 : color.gray2077 + "66",
? Colors.theme1[theme].greenC8
: Colors.theme1[theme].gray2077 + "66",
textAlign: textAlign, textAlign: textAlign,
fontFamily: "regular", fontFamily: "regular",
direction: direction ? direction : "rtl", direction: direction ? direction : "rtl",
@ -83,7 +76,10 @@ const FloatingLabelInput = ({
{label} {label}
</Text> </Text>
<TextInput <TextInput
style={[styles.inputStyle, tw(`rounded-sm ${mobile ? "py-2" : "py-3"} px-4`)]} style={[
styles.inputStyle,
tw(`rounded-sm ${mobile ? "py-2" : "py-3"} px-4`),
]}
onChangeText={(text) => onChange(name, (text = regex(text)))} onChangeText={(text) => onChange(name, (text = regex(text)))}
placeholder={placeholder} placeholder={placeholder}
onFocus={() => setIsFocused(true)} onFocus={() => setIsFocused(true)}
@ -101,7 +97,7 @@ const FloatingLabelInput = ({
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
mobile: state.publicApi.mobile, mobile: state.publicApi.mobile,
theme: state.publicApi.theme theme: state.publicApi.theme,
}) });
export default connect(mapStateToProps)(FloatingLabelInput); export default connect(mapStateToProps)(FloatingLabelInput);

@ -44,6 +44,10 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
const [dropdownHeight, setDropdownHeight] = useState(0); const [dropdownHeight, setDropdownHeight] = useState(0);
const navigation = useNavigation(); const navigation = useNavigation();
const color = React.useMemo(() => {
return Colors.theme1[theme];
}, [theme]);
const routes = React.useMemo(() => { const routes = React.useMemo(() => {
return [ return [
{ {
@ -338,7 +342,7 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
<View <View
style={[ style={[
tw("flex items-end pt-12 px-4"), tw("flex items-end pt-12 px-4"),
{ backgroundColor: Colors.theme1[theme].greenCF }, { backgroundColor: color.greenCF },
]} ]}
> >
<View style={tw("flex flex-row-reverse w-full justify-between")}> <View style={tw("flex flex-row-reverse w-full justify-between")}>
@ -346,7 +350,7 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
<AntDesign <AntDesign
name="close" name="close"
size={mobile ? 20 : 30} size={mobile ? 20 : 30}
color={Colors.theme1[theme].white} color={color.white}
onPress={() => setBoxPosition()} onPress={() => setBoxPosition()}
/> />
</View> </View>
@ -409,7 +413,7 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
), ),
{ {
borderBottomWidth: 1, borderBottomWidth: 1,
borderColor: Colors.theme1[theme].grayE3, borderColor: color.grayE3,
height: dropdownHeight, height: dropdownHeight,
}, },
]} ]}
@ -424,7 +428,7 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
style={{ style={{
fontSize: mobile ? fontSize.base : fontSize.xl, fontSize: mobile ? fontSize.base : fontSize.xl,
fontFamily: "regular", fontFamily: "regular",
color: Colors.theme1[theme].gray20, color: color.gray20,
}} }}
> >
افزودن حساب کاربری جدید افزودن حساب کاربری جدید
@ -435,7 +439,7 @@ const Drawer = ({ position, setBoxPosition, user, mobile, theme }) => {
marginTop: 3, marginTop: 3,
fontSize: fontSize.xl4, fontSize: fontSize.xl4,
fontFamily: "bold", fontFamily: "bold",
color: Colors.theme1[theme].gray20 + "77", color: color.gray20 + "77",
}} }}
> >
+ +

@ -16,13 +16,13 @@ const Empty = ({ text, buttonText, buttonAction, theme }) => {
fontFamily: "regular", fontFamily: "regular",
fontSize: fontSize.tiny, fontSize: fontSize.tiny,
transform: [{ translateY: -50 }], transform: [{ translateY: -50 }],
color : Colors.theme1[theme].gray20 color: Colors.theme1[theme].gray20,
}, },
]} ]}
> >
{text + " " + ":("} {text + " " + ":("}
</Text> </Text>
{buttonText && ( {buttonText ? (
<Pressable <Pressable
style={[ style={[
tw("py-2 px-5 rounded-sm"), tw("py-2 px-5 rounded-sm"),
@ -42,7 +42,7 @@ const Empty = ({ text, buttonText, buttonAction, theme }) => {
{buttonText} {buttonText}
</Text> </Text>
</Pressable> </Pressable>
)} ) : null}
</View> </View>
); );
}; };

@ -81,7 +81,8 @@ const Navbar = ({
}, },
]} ]}
> >
{!headerOptions?.title && headerOptions?.back ? ( {!headerOptions?.title ? (
headerOptions?.back ? (
<Ionicons <Ionicons
name="arrow-forward" name="arrow-forward"
style={tw("mr-2")} style={tw("mr-2")}
@ -89,6 +90,7 @@ const Navbar = ({
color={"#52796F"} color={"#52796F"}
onPress={() => navigation.goBack()} onPress={() => navigation.goBack()}
/> />
) : null
) : null} ) : null}
{headerOptions?.title ? ( {headerOptions?.title ? (
<Text <Text
@ -102,7 +104,7 @@ const Navbar = ({
{headerOptions?.title} {headerOptions?.title}
</Text> </Text>
) : null} ) : null}
{headerOptions?.hamburgerMenu && ( {headerOptions?.hamburgerMenu ? (
<Pressable style={tw("relative mr-4")} onPress={() => setBoxPosition()}> <Pressable style={tw("relative mr-4")} onPress={() => setBoxPosition()}>
<Svg <Svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -123,15 +125,15 @@ const Navbar = ({
/> />
</G> </G>
</Svg> </Svg>
{notification && ( {notification ? (
<View <View
style={tw("h-2.5 w-2.5 absolute -left-1 -top-1 rounded-full")} style={tw("h-2.5 w-2.5 absolute -left-1 -top-1 rounded-full")}
></View> ></View>
)} ) : null}
</Pressable> </Pressable>
)} ) : null}
{headerOptions?.logo && ( {headerOptions?.logo ? (
<Pressable <Pressable
onPress={() => navigation.navigate("Home")} onPress={() => navigation.navigate("Home")}
style={tw("absolute right-1/2 top-1/2")} style={tw("absolute right-1/2 top-1/2")}
@ -161,10 +163,11 @@ const Navbar = ({
<Path fill="url(#a)" d="M0 0h19.644v28.908H0z" /> <Path fill="url(#a)" d="M0 0h19.644v28.908H0z" />
</Svg> </Svg>
</Pressable> </Pressable>
)} ) : null}
<View style={tw("flex flex-row items-center ml-4")}> <View style={tw("flex flex-row items-center ml-4")}>
{headerOptions?.back && headerOptions?.title ? ( {headerOptions?.back ? (
headerOptions?.title ? (
<Ionicons <Ionicons
name="arrow-back" name="arrow-back"
style={tw("mr-2")} style={tw("mr-2")}
@ -172,8 +175,9 @@ const Navbar = ({
color={"#52796F"} color={"#52796F"}
onPress={() => navigation.goBack()} onPress={() => navigation.goBack()}
/> />
) : null
) : null} ) : null}
{headerOptions?.qr && ( {headerOptions?.qr ? (
<> <>
<Button <Button
icon={ icon={
@ -393,9 +397,9 @@ const Navbar = ({
state={"AR"} state={"AR"}
/> />
</> </>
)} ) : null}
{headerOptions?.bookmark && {headerOptions?.bookmark ? (
(bookmarkLoading ? ( bookmarkLoading ? (
<ActivityIndicator size={20} color={Color.theme1[theme].green79} /> <ActivityIndicator size={20} color={Color.theme1[theme].green79} />
) : isActiveBookmark ? ( ) : isActiveBookmark ? (
<Ionicons <Ionicons
@ -437,10 +441,11 @@ const Navbar = ({
}) })
} }
/> />
))} )
{headerOptions?.menu && ( ) : null}
{headerOptions?.menu ? (
<Entypo name="dots-three-vertical" size={24} color="#52796F" /> <Entypo name="dots-three-vertical" size={24} color="#52796F" />
)} ) : null}
</View> </View>
</View> </View>
); );

@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from "react";
import { Text, View, StyleSheet, Button } from 'react-native'; import { Text, View, StyleSheet, Button } from "react-native";
import { BarCodeScanner } from 'expo-barcode-scanner'; import { BarCodeScanner } from "expo-barcode-scanner";
export default function App() { export default function App() {
const [hasPermission, setHasPermission] = useState(null); const [hasPermission, setHasPermission] = useState(null);
@ -9,7 +9,7 @@ export default function App() {
useEffect(() => { useEffect(() => {
(async () => { (async () => {
const { status } = await BarCodeScanner.requestPermissionsAsync(); const { status } = await BarCodeScanner.requestPermissionsAsync();
setHasPermission(status === 'granted'); setHasPermission(status === "granted");
})(); })();
}, []); }, []);
@ -29,9 +29,11 @@ export default function App() {
<> <>
<BarCodeScanner <BarCodeScanner
onBarCodeScanned={scanned ? undefined : handleBarCodeScanned} onBarCodeScanned={scanned ? undefined : handleBarCodeScanned}
style={{width : '100%', height : 300}} style={{ width: "100%", height: 300 }}
/> />
{scanned && <Button title={'Tap to Scan Again'} onPress={() => setScanned(false)} />} {scanned ? (
<Button title={"Tap to Scan Again"} onPress={() => setScanned(false)} />
) : null}
</> </>
); );
} }

@ -25,6 +25,7 @@ export default function activation(state = initialState, action) {
case "error": case "error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه"
}); });
return { return {
...state, ...state,

@ -87,6 +87,7 @@ export default function book(state = initialState, action) {
case "book/error": case "book/error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه"
}); });
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:

@ -27,6 +27,8 @@ export default function comment(state = initialState, action) {
case "comment/error": case "comment/error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه"
}); });
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:

@ -22,6 +22,7 @@ export default function product(state = initialState, action) {
case "product/error": case "product/error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه"
}); });
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:

@ -64,6 +64,7 @@ const user = (state = initialState, action) => {
case "user/error": case "user/error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه"
}); });
return { ...state, error : true }; return { ...state, error : true };
default: default:

@ -32,6 +32,7 @@ export default function userFavorite(state = initialState, action) {
case "userFavorite/error": case "userFavorite/error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه"
}); });
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:

@ -50,6 +50,7 @@ export default function userFactor(state = initialState, action) {
case "userProduct/error": case "userProduct/error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه"
}); });
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:

@ -18,6 +18,7 @@ export default function vote(state = initialState, action) {
case "userVote/error": case "userVote/error":
asyncAwesomeAlert("خطا", data.message, { asyncAwesomeAlert("خطا", data.message, {
showCancelButton: false, showCancelButton: false,
confirmText: "باشه"
}); });
return { ...state, loading: false, error: data.message }; return { ...state, loading: false, error: data.message };
default: default:

@ -38,7 +38,7 @@ function AR({ getArList, arList, mobile }) {
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
position: "relative", position: "relative",
backgroundColor: "white", backgroundColor: "white",
flex : 1 flex: 1,
}} }}
> >
<Navbar <Navbar
@ -69,8 +69,9 @@ function AR({ getArList, arList, mobile }) {
}` }`
)} )}
> >
{arList.length > 0 && {arList.length
arList.map((book, index) => <Book book={book} key={index} />)} ? arList.map((book, index) => <Book book={book} key={index} />)
: null}
</View> </View>
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>

@ -273,7 +273,7 @@ const Address = ({
title="اطلاعات هویتی" title="اطلاعات هویتی"
text="( لطفا نام و نام خانوادگی خود را به طور کامل وارد نمایید )" text="( لطفا نام و نام خانوادگی خود را به طور کامل وارد نمایید )"
/> />
{!profilePage && <MapSelector />} {!profilePage ? <MapSelector /> : null}
<CustomTextInput <CustomTextInput
label="نام" label="نام"
placeholder="" placeholder=""
@ -310,7 +310,7 @@ const Address = ({
autoFocus={false} autoFocus={false}
regex={(val) => val} regex={(val) => val}
/> />
{profilePage && ( {profilePage ? (
<CustomTextInput <CustomTextInput
keyboardType="numeric" keyboardType="numeric"
label="کد ملی" label="کد ملی"
@ -325,7 +325,7 @@ const Address = ({
autoFocus={false} autoFocus={false}
regex={(text) => onInput.numberOnly(text)} regex={(text) => onInput.numberOnly(text)}
/> />
)} ) : null}
<View style={tw("mt-4")}></View> <View style={tw("mt-4")}></View>
<Header <Header
title="شماره تماس" title="شماره تماس"

@ -44,8 +44,6 @@ const renderNode = (node, index, siblings, parent, defaultRenderer) => {
} }
}; };
export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => { export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
useEffect(() => { useEffect(() => {
getInfo({ id: route.params.id }); getInfo({ id: route.params.id });
@ -54,8 +52,6 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
} }
}, []); }, []);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
@ -170,10 +166,22 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
> >
{blog?.title} {blog?.title}
</Text> </Text>
<HTMLView value={blog?.text} renderNode={renderNode} /> <View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
}}
>
<HTMLView
value={blog?.text}
renderNode={renderNode}
stylesheet={styles.font}
/>
</View>
</View> </View>
<Header title={"پیشنهادی "} /> <Header title={"پیشنهادی "} />
{blogs.length && ( {blogs.length ? (
<FlatList <FlatList
showsHorizontalScrollIndicator={false} showsHorizontalScrollIndicator={false}
horizontal={true} horizontal={true}
@ -185,7 +193,7 @@ export const Blog = ({ getInfo, blog, getList, blogs, route, theme }) => {
return item.id; return item.id;
}} }}
/> />
)} ) : null}
</View> </View>
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
@ -220,4 +228,8 @@ const styles = StyleSheet.create({
paddingVertical: 0, paddingVertical: 0,
paddingHorizontal: 0, paddingHorizontal: 0,
}, },
font: {
textAlign: "center",
fontFamily: "render",
},
}); });

@ -93,7 +93,7 @@ export const Ticket = ({
}} }}
/> />
<ScrollView style={tw("flex-1 px-4")}> <ScrollView style={tw("flex-1 px-4")}>
{!status && ( {!status ? (
<> <>
<CustomTextInput <CustomTextInput
label="نام و نام خانوادگی" label="نام و نام خانوادگی"
@ -111,7 +111,7 @@ export const Ticket = ({
maxLength={11} maxLength={11}
/> />
</> </>
)} ) : null}
<Select <Select
defaultValue={ticket?.unit || opt[0]} defaultValue={ticket?.unit || opt[0]}
options={myProductList.length ? opt : opt.slice(0, 3)} options={myProductList.length ? opt : opt.slice(0, 3)}
@ -119,7 +119,7 @@ export const Ticket = ({
onChange={(name, value) => setTicket({ name, value })} onChange={(name, value) => setTicket({ name, value })}
width={"100%"} width={"100%"}
/> />
{ticket?.unit === "واحد محتوایی" && ( {ticket?.unit === "واحد محتوایی" ? (
<Select <Select
name="bookId" name="bookId"
defaultValue={ticket?.subject} defaultValue={ticket?.subject}
@ -136,7 +136,7 @@ export const Ticket = ({
onChange={(name, value) => setTicket({ name, value })} onChange={(name, value) => setTicket({ name, value })}
width={"100%"} width={"100%"}
/> />
)} ) : null}
<CustomTextInput <CustomTextInput
name="subject" name="subject"
onChange={(name, value) => setTicket({ name, value })} onChange={(name, value) => setTicket({ name, value })}

@ -4,7 +4,7 @@ import {
Pressable, Pressable,
TouchableOpacity, TouchableOpacity,
ActivityIndicator, ActivityIndicator,
Platform Platform,
} from "react-native"; } from "react-native";
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -18,7 +18,15 @@ import fontSize from "../../../constants/fontSize";
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
const Address = ({ addresses, update, userId, userAddressId, loading, mobile, theme }) => { const Address = ({
addresses,
update,
userId,
userAddressId,
loading,
mobile,
theme,
}) => {
const navigation = useNavigation(); const navigation = useNavigation();
const Location = ({ address, active }) => { const Location = ({ address, active }) => {
@ -37,7 +45,9 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile, th
: Colors.theme1[theme].grayE3, : Colors.theme1[theme].grayE3,
}, },
tw( tw(
`flex flex-row-reverse items-center w-full px-3 rounded-sm mt-2 ${mobile ? "py-2" : "py-4"}` `flex flex-row-reverse items-center w-full px-3 rounded-sm mt-2 ${
mobile ? "py-2" : "py-4"
}`
), ),
]} ]}
onPress={() => onPress={() =>
@ -46,7 +56,8 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile, th
: update({ userAddressId: address.id, userId }) : update({ userAddressId: address.id, userId })
} }
> >
{loading && userAddressId !== address?.id ? ( {loading ? (
userAddressId !== address?.id ? (
<ActivityIndicator <ActivityIndicator
size="small" size="small"
color={Colors.theme1[theme].greenC8} color={Colors.theme1[theme].greenC8}
@ -67,7 +78,8 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile, th
}, },
]} ]}
></View> ></View>
)} )
) : null}
<View style={tw(`flex flex-1 ${mobile ? "mr-2" : "mr-5"}`)}> <View style={tw(`flex flex-1 ${mobile ? "mr-2" : "mr-5"}`)}>
<Text <Text
style={[ style={[
@ -101,7 +113,7 @@ const Address = ({ addresses, update, userId, userAddressId, loading, mobile, th
style={[ style={[
{ {
backgroundColor: Colors.theme1[theme].grayE3 + "44", backgroundColor: Colors.theme1[theme].grayE3 + "44",
borderColor: Colors.theme1[theme].gray2077 + '55', borderColor: Colors.theme1[theme].gray2077 + "55",
borderWidth: 1.5, borderWidth: 1.5,
}, },
tw( tw(
@ -138,7 +150,7 @@ const mapStateToProps = (state) => ({
userAddressId: state.userFactor.info?.userAddressId, userAddressId: state.userFactor.info?.userAddressId,
loading: state.userFactor.loading, loading: state.userFactor.loading,
mobile: state.publicApi.mobile, mobile: state.publicApi.mobile,
theme: state.publicApi.theme theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -43,7 +43,7 @@ function Instance({ question, selectFaq, mobile, theme }) {
<Entypo name="plus" size={18} color={Colors.theme1[theme].green79} /> <Entypo name="plus" size={18} color={Colors.theme1[theme].green79} />
)} )}
</View> </View>
{question.active && ( {question.active ? (
<View style={tw("w-full flex flex-row-reverse pt-2")}> <View style={tw("w-full flex flex-row-reverse pt-2")}>
<Text <Text
style={[ style={[
@ -58,7 +58,7 @@ function Instance({ question, selectFaq, mobile, theme }) {
{question.description} {question.description}
</Text> </Text>
</View> </View>
)} ) : null}
</TouchableOpacity> </TouchableOpacity>
); );
} }

@ -27,7 +27,7 @@ import bgFaq from "./assets/faq.png";
const { width, height } = Dimensions.get("window"); const { width, height } = Dimensions.get("window");
function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) { function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq, theme }) {
useEffect(() => { useEffect(() => {
if (list.length === 0) { if (list.length === 0) {
getFaq(); getFaq();
@ -85,7 +85,7 @@ function Faq({ list, getFaq, searchResult, search, selectFaq, searchFaq }) {
<Text <Text
style={[ style={[
tw("w-full px-4 mt-10 text-center"), tw("w-full px-4 mt-10 text-center"),
{ fontFamily: "bold" }, { fontFamily: "bold", color : Colors.theme1[theme].gray20 + '77' },
]} ]}
> >
موردی یافت نشد. موردی یافت نشد.
@ -113,6 +113,7 @@ const mapStateToProps = (state) => ({
list: state.faq.list, list: state.faq.list,
searchResult: state.faq.searchResult, searchResult: state.faq.searchResult,
search: state.faq.search, search: state.faq.search,
theme : state.publicApi.theme
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -12,7 +12,7 @@ import fontSize from "../../../constants/fontSize";
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
function MyBooks({ books, grades, theme }) { function MyBooks({ books, grades, theme }) {
return books.length && ( return books.length ? (
<View style={[tw("flex w-full mb-5")]}> <View style={[tw("flex w-full mb-5")]}>
<View <View
style={[ style={[
@ -50,7 +50,7 @@ function MyBooks({ books, grades, theme }) {
/> />
</View> </View>
</View> </View>
); ) : null;
} }
const Book = ({ book, grades, theme }) => { const Book = ({ book, grades, theme }) => {

@ -61,7 +61,7 @@ const Home = ({ route, blogs, books, userProducts, mobile }) => {
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
style={[styles.container]} style={[styles.container]}
> >
{!mobile && <View style={tw("mt-5")}></View>} {!mobile ? <View style={tw("mt-5")}></View> : null}
<MyBooks books={userProducts} /> <MyBooks books={userProducts} />
<View style={tw("px-4 w-full")}> <View style={tw("px-4 w-full")}>
<Header title={"فروشگاه"} route={"Products"} /> <Header title={"فروشگاه"} route={"Products"} />

@ -143,7 +143,7 @@ function Login(props) {
regex={(text) => onInput.phonenumber(text)} regex={(text) => onInput.phonenumber(text)}
/> />
</View> </View>
{!props.mobile && <View style={tw("mt-10")}></View>} {!props.mobile ? <View style={tw("mt-10")}></View> : null}
<TouchableHighlight <TouchableHighlight
disabled={loading} disabled={loading}
underlayColor={Colors.theme1[props.theme].greenC8} underlayColor={Colors.theme1[props.theme].greenC8}

@ -113,8 +113,8 @@ function Book({
return ( return (
<ScrollView style={[tw("flex flex-1 relative")]}> <ScrollView style={[tw("flex flex-1 relative")]}>
{!mobile && <View style={tw("mt-5")}></View>} {!mobile ? <View style={tw("mt-5")}></View> : null}
{(!book) && ( {!book ? (
<View <View
style={[ style={[
tw("absolute left-0 top-0 rounded-md overflow-hidden"), tw("absolute left-0 top-0 rounded-md overflow-hidden"),
@ -128,8 +128,8 @@ function Book({
> >
<Blur /> <Blur />
</View> </View>
)} ) : null}
{imageSlider && <ImageSlider />} {imageSlider ? <ImageSlider /> : null}
<View style={[tw("flex flex-row-reverse")]}> <View style={[tw("flex flex-row-reverse")]}>
<Image <Image
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }} source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }}
@ -487,9 +487,9 @@ function Book({
</Text> </Text>
</TouchableHighlight> </TouchableHighlight>
</View> </View>
{book?.product[type]?.description && ( {book?.product[type]?.description ? (
<Description description={book?.description} /> <Description description={book?.description} />
)} ) : null}
<LinkBox <LinkBox
title="مشخصات محصول" title="مشخصات محصول"
key={"0"} key={"0"}
@ -517,7 +517,7 @@ function Book({
}) })
} }
/> />
{(product.rate || 4) && ( {product.rate || 4 ? (
<> <>
<View <View
style={tw( style={tw(
@ -543,7 +543,7 @@ function Book({
productId={book?.product[1]?.id} productId={book?.product[1]?.id}
/> />
</> </>
)} ) : null}
</ScrollView> </ScrollView>
); );
} }

@ -133,9 +133,11 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
)) ))
: bySearchFilter?.map((product, index) => ( : bySearchFilter?.map((product, index) => (
<React.Fragment key={index}> <React.Fragment key={index}>
{(productType {(
productType
? productType === ("کتاب دیجیتال" || "همه محصولات") ? productType === ("کتاب دیجیتال" || "همه محصولات")
: true) && ( : true
) ? (
<Pressable <Pressable
key={product?.product[0]?.id} key={product?.product[0]?.id}
style={[ style={[
@ -223,10 +225,12 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
</Text> </Text>
</View> </View>
</Pressable> </Pressable>
)} ) : null}
{(productType {(
productType
? productType === ("کتاب فیزیکی" || "همه محصولات") ? productType === ("کتاب فیزیکی" || "همه محصولات")
: true) && ( : true
) ? (
<Pressable <Pressable
key={product?.product[1]?.id} key={product?.product[1]?.id}
style={[ style={[
@ -314,7 +318,7 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
</Text> </Text>
</View> </View>
</Pressable> </Pressable>
)} ) : null}
</React.Fragment> </React.Fragment>
)); ));
}; };
@ -330,10 +334,10 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
), ),
]} ]}
> >
{filterOptions?.productType === "دوره ویدئویی" && Items(2)} {filterOptions?.productType === "دوره ویدئویی" ? Items(2) : null}
{filterOptions?.productType === "کتاب دیجیتال" && Items(0)} {filterOptions?.productType === "کتاب دیجیتال" ? Items(0) : null}
{filterOptions?.productType === "کتاب فیزیکی" && Items(1)} {filterOptions?.productType === "کتاب فیزیکی" ? Items(1) : null}
{!filterOptions?.productType && Items(0)} {!filterOptions?.productType ? Items(0) : null}
{/* {filterLoading && ( {/* {filterLoading && (
<View style="w-full h-screen flex justify-center items-center bg-white bg-opacity-20 backdrop-filter backdrop-blur-xl fixed left-0 top-0"> <View style="w-full h-screen flex justify-center items-center bg-white bg-opacity-20 backdrop-filter backdrop-blur-xl fixed left-0 top-0">
<Loading size={4} color="bg-green-400" /> <Loading size={4} color="bg-green-400" />
@ -346,7 +350,7 @@ const Main = ({ books, filterOptions, grades, mobile, theme }) => {
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
filterOptions: state.book.filterOptions, filterOptions: state.book.filterOptions,
mobile: state.publicApi.mobile, mobile: state.publicApi.mobile,
theme: state.publicApi.theme theme: state.publicApi.theme,
}); });
const mapDispatchToProps = {}; const mapDispatchToProps = {};

@ -66,7 +66,7 @@ const ProfileAddress = ({
} }
> >
<View style={tw("flex flex-1 mr-2")}> <View style={tw("flex flex-1 mr-2")}>
{active && ( {active ? (
<View <View
style={tw("w-full flex flex-row-reverse justify-between mb-3")} style={tw("w-full flex flex-row-reverse justify-between mb-3")}
> >
@ -101,7 +101,7 @@ const ProfileAddress = ({
</G> </G>
</Svg> </Svg>
</View> </View>
)} ) : null}
<View style={tw(`flex w-full ${active ? "" : "flex-row-reverse"}`)}> <View style={tw(`flex w-full ${active ? "" : "flex-row-reverse"}`)}>
<View style={tw("flex flex-1 mb-4")}> <View style={tw("flex flex-1 mb-4")}>
<Text <Text
@ -156,7 +156,7 @@ const ProfileAddress = ({
{"شماره تماس:" + " " + address.cellphone} {"شماره تماس:" + " " + address.cellphone}
</Text> </Text>
</View> </View>
{!active && ( {!active ? (
<Svg xmlns="http://www.w3.org/2000/svg" width={24} height={24}> <Svg xmlns="http://www.w3.org/2000/svg" width={24} height={24}>
<G <G
fill={Colors.theme1[theme].gray20} fill={Colors.theme1[theme].gray20}
@ -169,7 +169,7 @@ const ProfileAddress = ({
/> />
</G> </G>
</Svg> </Svg>
)} ) : null}
</View> </View>
<CustomPressable <CustomPressable

@ -9,7 +9,7 @@ import {
Dimensions, Dimensions,
StatusBar, StatusBar,
Image, Image,
Appearance, ActivityIndicator,
} from "react-native"; } from "react-native";
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
@ -32,24 +32,19 @@ const ios = Platform.OS === "ios";
const ProfileBookmark = ({ const ProfileBookmark = ({
bookmarkList, bookmarkList,
getList,
deleteItem, deleteItem,
loading, loading,
mobile, mobile,
grades, grades,
theme theme,
}) => { }) => {
React.useEffect(() => {
getList();
}, []);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0, paddingTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
position: "relative", position: "relative",
backgroundColor: "white", backgroundColor: "white",
flex: 1,
}} }}
> >
<Navbar <Navbar
@ -63,21 +58,6 @@ const ProfileBookmark = ({
back: true, back: true,
}} }}
/> />
{loading && (
<View
style={[
tw("absolute left-0 top-0 rounded-md overflow-hidden"),
{
width: Dimensions.get("window").width,
height: height,
zIndex: 1,
backgroundColor: Colors.theme1[theme].white + "60",
},
]}
>
<Blur />
</View>
)}
{bookmarkList.length ? ( {bookmarkList.length ? (
<ScrollView <ScrollView
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
@ -93,25 +73,38 @@ const ProfileBookmark = ({
mobile={mobile} mobile={mobile}
grades={grades} grades={grades}
theme={theme} theme={theme}
loading={loading}
/> />
))} ))}
</View> </View>
</View> </View>
</ScrollView> </ScrollView>
) : ( ) : (
<Empty text="لیست علاقهمندیها خالی است." /> <Empty text="هیچ موردی برای شما یافت نشد." />
)} )}
</SafeAreaView> </SafeAreaView>
); );
}; };
const Bookmark = ({ bookmark, deleteItem, mobile, grades, theme }) => { const Bookmark = ({ bookmark, deleteItem, mobile, grades, theme, loading }) => {
const navigation = useNavigation(); const navigation = useNavigation();
const [selectedBookmark, setSelectedBookmark] = React.useState(null);
const isContent = React.useMemo(() => { const isContent = React.useMemo(() => {
return bookmark?.content; return bookmark?.contentId;
}, [bookmark]); }, [bookmark]);
const deleteAction = async (action) => {
setSelectedBookmark(bookmark);
await action();
};
React.useEffect(() => {
if (!loading) {
setSelectedBookmark(null);
}
}, [loading]);
return ( return (
<Pressable <Pressable
style={[ style={[
@ -123,7 +116,7 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades, theme }) => {
]} ]}
onPress={() => onPress={() =>
navigation.push(isContent ? "Blog" : "Product", { navigation.push(isContent ? "Blog" : "Product", {
id: isContent ? bookmark?.id : bookmark?.id, id: isContent ? bookmark?.contentId : bookmark?.product?.bookId,
}) })
} }
> >
@ -164,25 +157,33 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades, theme }) => {
fontSize: fontSize.tiny, fontSize: fontSize.tiny,
color: Colors.theme1[theme].gray20, color: Colors.theme1[theme].gray20,
width: width / 3, width: width / 3,
textAlign: "right",
}} }}
> >
{isContent ? bookmark?.content?.name : bookmark.product.book.name} {isContent
? bookmark?.content?.name
: bookmark?.product?.book?.name}
</Text> </Text>
{!isContent && ( {!isContent ? (
<Text <Text
style={{ style={{
marginTop: 5, marginTop: 5,
fontFamily: "regular", fontFamily: "regular",
fontSize: fontSize.base, fontSize: fontSize.sm,
color: Colors.theme1[theme].gray20, color: Colors.theme1[theme].gray20,
}} }}
> >
{"پایه" + " " + grades[bookmark?.product?.book?.gradeId]} {"پایه" + " " + grades[bookmark?.product?.book?.gradeId]}
</Text> </Text>
)} ) : null}
</View> </View>
</View> </View>
<Pressable onPress={() => deleteItem({ id: bookmark.id })}> {selectedBookmark === bookmark ? (
<ActivityIndicator color={Colors.theme1[theme].greenCF} size={30} />
) : (
<Pressable
onPress={() => deleteAction(deleteItem({ id: bookmark.id }))}
>
<Svg <Svg
data-name="vuesax/linear/archive-add" data-name="vuesax/linear/archive-add"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@ -204,6 +205,7 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades, theme }) => {
/> />
</Svg> </Svg>
</Pressable> </Pressable>
)}
</Pressable> </Pressable>
); );
}; };
@ -214,11 +216,10 @@ const mapStateToProps = (state) => ({
bookmarkList: state.userFavorite.list, bookmarkList: state.userFavorite.list,
loading: state.userFavorite.loading, loading: state.userFavorite.loading,
grades: state.publicApi.grades, grades: state.publicApi.grades,
theme: state.publicApi.theme theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {
getList: userFavorite.list,
deleteItem: userFavorite.del, deleteItem: userFavorite.del,
}; };

@ -18,7 +18,6 @@ import Colors from "../../../constants/Colors";
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
const User = ({ user, mobile, theme }) => { const User = ({ user, mobile, theme }) => {
const [dropdown, setDropdown] = React.useState(true); const [dropdown, setDropdown] = React.useState(true);
const navigation = useNavigation(); const navigation = useNavigation();
@ -75,7 +74,7 @@ const User = ({ user, mobile, theme }) => {
/> />
</Svg> </Svg>
</Pressable> </Pressable>
{dropdown && ( {dropdown ? (
<View style={tw(`flex flex-col pr-16 ${ios ? "items-end" : " "}`)}> <View style={tw(`flex flex-col pr-16 ${ios ? "items-end" : " "}`)}>
<Pressable <Pressable
style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)} style={tw(`flex w-full ${mobile ? "mt-0" : "mt-4"}`)}
@ -117,7 +116,7 @@ const User = ({ user, mobile, theme }) => {
</View> </View>
</Pressable> </Pressable>
</View> </View>
)} ) : null}
</View> </View>
); );
}; };

@ -15,7 +15,6 @@ import Colors from "../../../constants/Colors";
const { width } = Dimensions.get("window"); const { width } = Dimensions.get("window");
function Tab({ data, theme }) { function Tab({ data, theme }) {
const [dataType, setDataType] = useState("all"); const [dataType, setDataType] = useState("all");
@ -185,16 +184,16 @@ function Tab({ data, theme }) {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<View style={tw("flex w-full p-4")}> <View style={tw("flex w-full p-4")}>
{dataType === "all" && ( {dataType === "all" ? (
<> <>
{data.voice && <Voice data={data.voice} />} {data.voice ? <Voice data={data.voice} /> : null}
{data.video && <Video data={data.video} />} {data.video ? <Video data={data.video} /> : null}
{data.ppt && <PPT data={data.ppt} />} {data.ppt ? <PPT data={data.ppt} /> : null}
{data.pdf && <PDF data={data.pdf} />} {data.pdf ? <PDF data={data.pdf} /> : null}
{data.links && <Links data={data.links} />} {data.links ? <Links data={data.links} /> : null}
</> </>
)} ) : null}
{dataType === "voice" && ( {dataType === "voice" ? (
<> <>
{data.voice ? ( {data.voice ? (
<Voice data={data.voice} /> <Voice data={data.voice} />
@ -210,8 +209,8 @@ function Tab({ data, theme }) {
</Text> </Text>
)} )}
</> </>
)} ) : null}
{dataType === "video" && ( {dataType === "video" ? (
<> <>
{data.video ? ( {data.video ? (
<Video data={data.video} /> <Video data={data.video} />
@ -227,8 +226,8 @@ function Tab({ data, theme }) {
</Text> </Text>
)} )}
</> </>
)} ) : null}
{dataType === "ppt" && ( {dataType === "ppt" ? (
<> <>
{data.ppt ? ( {data.ppt ? (
<PPT data={data.ppt} /> <PPT data={data.ppt} />
@ -244,8 +243,8 @@ function Tab({ data, theme }) {
</Text> </Text>
)} )}
</> </>
)} ) : null}
{dataType === "pdf" && ( {dataType === "pdf" ? (
<> <>
{data.pdf ? ( {data.pdf ? (
<PDF data={data.pdf} /> <PDF data={data.pdf} />
@ -261,8 +260,8 @@ function Tab({ data, theme }) {
</Text> </Text>
)} )}
</> </>
)} ) : null}
{dataType === "links" && ( {dataType === "links" ? (
<> <>
{data.links ? ( {data.links ? (
<Links data={data.links} /> <Links data={data.links} />
@ -278,7 +277,7 @@ function Tab({ data, theme }) {
</Text> </Text>
)} )}
</> </>
)} ) : null}
</View> </View>
</View> </View>
); );

@ -45,7 +45,7 @@ function QRContent({ route, getQrData, data, grades }) {
/> />
<ScrollView <ScrollView
> >
{data && <Content data={data} grades={grades} />} {data ? <Content data={data} grades={grades} /> : null}
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );

@ -20,10 +20,10 @@ function Code({ codeId, setCodeId, theme, loading }) {
const [value, setValue] = React.useState(codeId || ""); const [value, setValue] = React.useState(codeId || "");
const [requestFlag, setRequestFlag] = React.useState(false); const [requestFlag, setRequestFlag] = React.useState(false);
const setOff = () => { const setOff = React.useCallback(() => {
setRequestFlag(true); setRequestFlag(true);
setCodeId({ offCodeValue: value }); setCodeId({ offCodeValue: value });
}; }, [requestFlag, value]);
React.useEffect(() => { React.useEffect(() => {
if (!loading) { if (!loading) {
@ -43,7 +43,9 @@ function Code({ codeId, setCodeId, theme, loading }) {
]} ]}
> >
<TextInput <TextInput
onChangeText={(text) => setValue(text = onInput.englishAndNumberWithoutSpace(text))} onChangeText={(text) =>
setValue((text = onInput.englishAndNumberWithoutSpace(text)))
}
style={[ style={[
tw("border-0 flex-1 text-right pr-3"), tw("border-0 flex-1 text-right pr-3"),
{ fontSize: fontSize.tiny, fontFamily: "regular" }, { fontSize: fontSize.tiny, fontFamily: "regular" },
@ -67,7 +69,7 @@ function Code({ codeId, setCodeId, theme, loading }) {
<ActivityIndicator <ActivityIndicator
size={fontSize.tiny} size={fontSize.tiny}
color={Colors.theme1[theme].white} color={Colors.theme1[theme].white}
style={tw('px-2')} style={tw("px-2")}
/> />
) : ( ) : (
<Text <Text

@ -21,9 +21,24 @@ import tw from "tailwind-rn";
const width = Dimensions.get("window").width; const width = Dimensions.get("window").width;
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
function Product({ product, grades, pushToCart, loading, mobile, theme, addActionFlag, getList }) { function Product({
product,
grades,
pushToCart,
loading,
mobile,
theme,
addActionFlag,
getList,
}) {
const [selectedProduct, setSelectedProduct] = React.useState(null); const [selectedProduct, setSelectedProduct] = React.useState(null);
const types = {
0: "نسخه دیجیتال",
1: "نسخه فیزیکی",
2: "نسخه ویدئویی",
};
const submit = async (action) => { const submit = async (action) => {
setSelectedProduct(product?.productId); setSelectedProduct(product?.productId);
await action(); await action();
@ -35,8 +50,7 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
} }
}, [loading]); }, [loading]);
return ( return product ? (
product && (
<View <View
style={[ style={[
tw( tw(
@ -53,7 +67,7 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
<Image <Image
source={{ source={{
uri: uri:
"https://dnvn.ir/api/v1/file/" + product.product.book.fileIds, "https://dnvn.ir/api/v1/file/" + product?.product?.book?.fileIds,
}} }}
style={[ style={[
tw(""), tw(""),
@ -74,7 +88,7 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
fontFamily: "bold", fontFamily: "bold",
}} }}
> >
{product.product.book.name || " "} {product?.product?.book?.name || " "}
</Text> </Text>
<Text <Text
style={{ style={{
@ -84,7 +98,7 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
fontFamily: "regular", fontFamily: "regular",
}} }}
> >
{"پایه" + " " + grades[product.product.book.gradeId] || " "} {"پایه" + " " + grades[product?.product?.book?.gradeId] || " "}
</Text> </Text>
<Text <Text
style={{ style={{
@ -93,7 +107,7 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
fontFamily: "regular", fontFamily: "regular",
}} }}
> >
{product.productType || 1 === 2 ? "نسخه فیزیکی" : "نسخه دیجیتال"} {types[product?.productType]}
</Text> </Text>
<View <View
style={tw( style={tw(
@ -120,15 +134,13 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
}, },
]} ]}
> >
{separate(product.product.price) || " "} {separate(product?.product?.price) || " "}
</Text> </Text>
</View> </View>
</View> </View>
</View> </View>
<View <View
style={tw( style={tw(`flex justify-between ${ios ? "items-end" : "items-start"}`)}
`flex justify-between ${ios ? "items-end" : "items-start"}`
)}
> >
<AntDesign <AntDesign
name="close" name="close"
@ -138,12 +150,12 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
submit( submit(
pushToCart( pushToCart(
{ {
productId: product.productId, productId: product?.productId,
userId: product.userId, userId: product?.userId,
count: product.productType === 1 ? -1 : -product?.count, count: product?.productType === 1 ? -1 : -product?.count,
}, },
{}, {},
{ id: product.factorId } { id: product?.factorId }
) )
) )
} }
@ -151,17 +163,15 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
<View style={tw("flex items-center mt-2")}> <View style={tw("flex items-center mt-2")}>
<View <View
style={tw( style={tw(
`flex items-center mb-3 ${ `flex items-center mb-3 ${ios ? "flex-row" : "flex-row-reverse"}`
ios ? "flex-row" : "flex-row-reverse"
}`
)} )}
> >
<Pressable <Pressable
onPress={() => onPress={() =>
submit( submit(
pushToCart({ pushToCart({
productId: product.productId, productId: product?.productId,
userId: product.userId, userId: product?.userId,
count: 1, count: 1,
}) })
) )
@ -187,7 +197,7 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
+ +
</Text> </Text>
</Pressable> </Pressable>
{(loading && selectedProduct === product.productId) ? ( {loading && selectedProduct === product?.productId ? (
<ActivityIndicator <ActivityIndicator
style={tw("mx-2")} style={tw("mx-2")}
size="small" size="small"
@ -204,7 +214,7 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
}, },
]} ]}
> >
{product.count} {product?.count}
</Text> </Text>
)} )}
@ -212,8 +222,8 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
onPress={() => onPress={() =>
submit( submit(
pushToCart({ pushToCart({
productId: product.productId, productId: product?.productId,
userId: product.userId, userId: product?.userId,
count: -1, count: -1,
}) })
) )
@ -258,14 +268,13 @@ function Product({ product, grades, pushToCart, loading, mobile, theme, addActio
}, },
]} ]}
> >
{separate(product.product.price * product.count) || " "} {separate(product?.product?.price * product?.count) || " "}
</Text> </Text>
</View> </View>
</View> </View>
</View> </View>
</View> </View>
) ) : null;
);
} }
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
@ -277,7 +286,7 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = { const mapDispatchToProps = {
pushToCart: userProduct.add, pushToCart: userProduct.add,
getList: userProduct.list getList: userProduct.list,
}; };
export default connect(mapStateToProps, mapDispatchToProps)(Product); export default connect(mapStateToProps, mapDispatchToProps)(Product);

@ -146,11 +146,10 @@ function ShoppingCart({
> >
{list {list
?.sort((a, b) => a?.id - b?.id) ?.sort((a, b) => a?.id - b?.id)
?.map( ?.map((product, index) =>
(product, index) => product.condition < 2 ? (
product.condition < 2 && (
<Product key={index} product={product} loading={loading} /> <Product key={index} product={product} loading={loading} />
) ) : null
)} )}
<Code /> <Code />
<View <View

@ -29,7 +29,7 @@ const Season = ({
realSeasons, realSeasons,
seasonName, seasonName,
mobile, mobile,
theme theme,
}) => { }) => {
// const [selectedSeason, setSelectedSeason] = useState(null); // const [selectedSeason, setSelectedSeason] = useState(null);
const navigation = useNavigation(); const navigation = useNavigation();
@ -138,10 +138,11 @@ const Season = ({
}, },
]} ]}
> >
{realSeasons?.length > 0 && {realSeasons?.length
realSeasons?.filter( ? realSeasons?.filter(
(item) => item?.id === season[0]?.categoryId (item) => item?.id === season[0]?.categoryId
)[0]?.name} )[0]?.name
: null}
</Text> </Text>
<SimpleLineIcons <SimpleLineIcons
name={ name={
@ -151,10 +152,11 @@ const Season = ({
color={Colors.theme1[theme].green79} color={Colors.theme1[theme].green79}
/> />
</View> </View>
{season[0]?.categoryId === activeSeason && {season[0]?.categoryId === activeSeason
season?.map((unit, index) => ( ? season?.map((unit, index) => (
<Unit unit={unit} key={index} index={index} /> <Unit unit={unit} key={index} index={index} />
))} ))
: null}
</Pressable> </Pressable>
</View> </View>
); );
@ -165,7 +167,7 @@ const mapStateToProps = (state) => ({
realSeasons: state.publicApi.bookInfo?.categories, realSeasons: state.publicApi.bookInfo?.categories,
vodDuration: state.publicApi.bookInfo?.vodDuration, vodDuration: state.publicApi.bookInfo?.vodDuration,
mobile: state.publicApi.mobile, mobile: state.publicApi.mobile,
theme: state.publicApi.theme theme: state.publicApi.theme,
}); });
const mapDispatchToProps = { const mapDispatchToProps = {

@ -106,7 +106,7 @@ function Product({
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
style={styles.container} style={styles.container}
> >
{!mobile && <View style={tw("mt-5")}></View>} {!mobile ? <View style={tw("mt-5")}></View> : null}
<View style={[tw(" w-full flex ")]}> <View style={[tw(" w-full flex ")]}>
<View <View
style={[ style={[
@ -161,7 +161,9 @@ function Product({
<Divider type={"vertical"} /> <Divider type={"vertical"} />
</View> </View>
<CustomPressable <CustomPressable
title={`خرید با قیمت ${separate(book?.product[2]?.price || ' ')} تومان`} title={`خرید با قیمت ${separate(
book?.product[2]?.price || " "
)} تومان`}
backgroundColor={Colors.theme1[theme].greenCF} backgroundColor={Colors.theme1[theme].greenCF}
color={"white"} color={"white"}
border={{ color: "#196EC0", width: 0 }} border={{ color: "#196EC0", width: 0 }}

@ -63,8 +63,7 @@ function VideoDisplay({ route, mobile, theme }) {
style={styles.container} style={styles.container}
onLayout={() => setWidth(Dimensions.get("window").width)} onLayout={() => setWidth(Dimensions.get("window").width)}
> >
{!mobile && <View style={tw("mt-5")}></View>} {!mobile ? <View style={tw("mt-5")}></View> : null}
<View style={tw("flex ")}> <View style={tw("flex ")}>
<Video <Video
ref={video} ref={video}
@ -74,7 +73,6 @@ function VideoDisplay({ route, mobile, theme }) {
}} }}
useNativeControls useNativeControls
resizeMode="cover" resizeMode="cover"
/> />
<Text <Text
style={{ style={{
@ -123,7 +121,7 @@ const styles = StyleSheet.create({
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({
grades: state.publicApi.grades, grades: state.publicApi.grades,
mobile: state.publicApi.mobile, mobile: state.publicApi.mobile,
theme: state.publicApi.theme theme: state.publicApi.theme,
}); });
export default connect(mapStateToProps)(VideoDisplay); export default connect(mapStateToProps)(VideoDisplay);

@ -22,7 +22,7 @@ import NewestVideo from "./components/NewestVideo";
//assets //assets
import tw from 'tailwind-rn'; import tw from "tailwind-rn";
function Videos({ grades, videos, getVideos, mobile }) { function Videos({ grades, videos, getVideos, mobile }) {
const [search, setSearch] = useState(""); const [search, setSearch] = useState("");
@ -61,14 +61,14 @@ function Videos({ grades, videos, getVideos, mobile }) {
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
style={[styles.container]} style={[styles.container]}
> >
{!mobile && <View style={tw("mt-5")}></View>} {!mobile ? <View style={tw("mt-5")}></View> : null}
<Search <Search
value={search} value={search}
onChange={setSearch} onChange={setSearch}
placeholder={"نام کتاب یا دوره را جستجو کنید"} placeholder={"نام کتاب یا دوره را جستجو کنید"}
/> />
{/* <Divider type={"vertical"} /> */} {/* <Divider type={"vertical"} /> */}
{videos.length > 0 && ( {videos.length ? (
<> <>
<MostViewedVideo videos={videos} grades={grades} /> <MostViewedVideo videos={videos} grades={grades} />
<Divider type={"vertical"} /> <Divider type={"vertical"} />
@ -79,7 +79,7 @@ function Videos({ grades, videos, getVideos, mobile }) {
grades={grades} grades={grades}
/> />
</> </>
)} ) : null}
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );

Loading…
Cancel
Save