reza added some change

master
Reza_ashrafi 3 years ago
parent 76e10ae95b
commit b1eb6c81ea
  1. 1
      src/screens/Product/components/Book.js
  2. 20
      src/screens/Product/components/Comments.js
  3. 55
      src/screens/Profile/components/ProfileBookmark/index.js
  4. 2
      src/screens/ShoppingCart/components/Code.js
  5. 2
      src/screens/ShoppingCart/index.js

@ -70,6 +70,7 @@ function Book({
)[0]; )[0];
}, [userProducts, book]); }, [userProducts, 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>}

@ -37,7 +37,6 @@ function Commnets({
} }
}, []); }, []);
return ( return (
<View style={[tw("flex")]}> <View style={[tw("flex")]}>
<FlatList <FlatList
@ -52,7 +51,6 @@ function Commnets({
<AddComment <AddComment
addComment={addComment} addComment={addComment}
productId={productId} productId={productId}
isBuyed={null}
/> />
</View> </View>
); );
@ -127,7 +125,7 @@ const Comment = ({ comment }) => {
); );
}; };
const AddComment = ({ addComment, productId, isBuyed, ...props }) => { const AddComment = ({ addComment, productId, ...props }) => {
const [commentForm, setCommentForm] = React.useState({ const [commentForm, setCommentForm] = React.useState({
title: "", title: "",
text: "", text: "",
@ -169,7 +167,7 @@ const AddComment = ({ addComment, productId, isBuyed, ...props }) => {
]} ]}
value={comment.title} value={comment.title}
placeholder="عنوان نظر ..." placeholder="عنوان نظر ..."
onChangeText={(text) => setTitle(text)} onChangeText={(text) => setCommentForm({...commentForm, title : text})}
/> />
<TextInput <TextInput
style={[ style={[
@ -187,7 +185,7 @@ const AddComment = ({ addComment, productId, isBuyed, ...props }) => {
value={comment.text} value={comment.text}
multiline={true} multiline={true}
placeholder="متن نظر ..." placeholder="متن نظر ..."
onChangeText={(text) => setText(text)} onChangeText={(text) => setCommentForm({...commentForm, text})}
/> />
<View style={tw("w-full mt-4")}> <View style={tw("w-full mt-4")}>
<Pressable <Pressable
@ -196,17 +194,7 @@ const AddComment = ({ addComment, productId, isBuyed, ...props }) => {
color={Colors.theme1[colorScheme].white} color={Colors.theme1[colorScheme].white}
border={{ width: 0, color: null }} border={{ width: 0, color: null }}
width={"40%"} width={"40%"}
onPress={() => onPress={() => addComment(commentForm)}
isBuyed
? addComment(commentForm)
: asyncAwesomeAlert(
"خطا",
"شما این محصول رو خریداری نکرده اید.",
{
showCancelButton: false,
}
)
}
/> />
</View> </View>
</KeyboardAvoidingView> </KeyboardAvoidingView>

@ -13,7 +13,6 @@ import {
} from "react-native"; } from "react-native";
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { useNavigation } from "@react-navigation/native";
import Svg, { Path } from "react-native-svg"; import Svg, { Path } from "react-native-svg";
import { userFavorite } from "../../../../redux/actions"; import { userFavorite } from "../../../../redux/actions";
@ -27,9 +26,6 @@ import tw from "tailwind-rn";
import Colors from "../../../../constants/Colors"; import Colors from "../../../../constants/Colors";
import fontSize from "../../../../constants/fontSize"; import fontSize from "../../../../constants/fontSize";
//assets
import bookImage from "../../..//OrdersFollowUp/assets/b1.png";
const { height, width } = Dimensions.get("window"); const { height, width } = Dimensions.get("window");
const ios = Platform.OS === "ios"; const ios = Platform.OS === "ios";
@ -81,7 +77,7 @@ const ProfileBookmark = ({
<Blur /> <Blur />
</View> </View>
)} )}
{bookmarkList.length > 0 ? ( {bookmarkList.length ? (
<ScrollView <ScrollView
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
style={styles.container} style={styles.container}
@ -109,6 +105,11 @@ const ProfileBookmark = ({
const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => { const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => {
const colorScheme = Appearance.getColorScheme(); const colorScheme = Appearance.getColorScheme();
const isContent = React.useMemo(() => {
return bookmark?.content;
});
return ( return (
<Pressable <Pressable
style={[ style={[
@ -123,25 +124,44 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => {
<Image <Image
resizeMode="contain" resizeMode="contain"
source={{ source={{
uri: `https://dnvn.ir/api/v1/file/${bookmark?.product?.book?.fileIds}`, uri: `https://dnvn.ir/api/v1/file/${
isContent
? bookmark?.content?.fileIds
: bookmark?.product?.book?.fileIds
}`,
}} }}
style={{ style={{
width: mobile ? width / 5 : width / 7, width: mobile
minWidth: 80, ? isContent
height: ((mobile ? width / 5 : width / 7) * 4) / 2.7, ? width / 3
minHeight: (80 * 4) / 2.7, : width / 5
: isContent
? width / 5
: width / 7,
height:
((mobile
? isContent
? width / 7
: width / 5
: isContent
? width / 9
: width / 7) *
4) /
2.7,
}} }}
/> />
<View style={tw(`flex mr-2 ${ios ? "items-end" : ""}`)}> <View style={tw(`flex mr-2 ${ios ? "items-end" : ""}`)}>
<Text <Text
style={{ style={{
fontFamily: "bold", fontFamily: "bold",
fontSize: fontSize.lg, fontSize: fontSize.tiny,
color: Colors.theme1[colorScheme].gray20, color: Colors.theme1[colorScheme].gray20,
width: width / 3,
}} }}
> >
{bookmark.product.book.name} {isContent ? bookmark?.content?.name : bookmark.product.book.name}
</Text> </Text>
{!isContent && (
<Text <Text
style={{ style={{
marginTop: 5, marginTop: 5,
@ -152,6 +172,7 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => {
> >
{"پایه" + " " + grades[bookmark?.product?.book?.gradeId]} {"پایه" + " " + grades[bookmark?.product?.book?.gradeId]}
</Text> </Text>
)}
</View> </View>
</View> </View>
<Pressable onPress={() => deleteItem({ id: bookmark.id })}> <Pressable onPress={() => deleteItem({ id: bookmark.id })}>
@ -207,13 +228,3 @@ const styles = StyleSheet.create({
paddingHorizontal: 0, paddingHorizontal: 0,
}, },
}); });
// ProfileBookmark.defaultProps = {
// bookmarkList: [
// {
// name: "کتاب آموزشی علوم تجربی",
// grade: "پایه ششم ابتدایی",
// image: bookImage,
// },
// ],
// };

@ -45,7 +45,7 @@ function Code({ codeId, setCodeId, userId, factorId }) {
placeholderTextColor={Colors.theme1[colorScheme].gray20 + 'aa'} placeholderTextColor={Colors.theme1[colorScheme].gray20 + 'aa'}
/> />
<Pressable <Pressable
onClick={() => setOff()} onPress={() => setOff()}
style={[ style={[
tw("py-3 px-5"), tw("py-3 px-5"),
{ {

@ -136,7 +136,7 @@ function ShoppingCart({
}} }}
/> />
<Drawer setBoxPosition={setBoxPosition} position={position} /> <Drawer setBoxPosition={setBoxPosition} position={position} />
{list?.filter((product) => product.condition < 2)?.length > 0 ? ( {list?.filter((product) => product?.condition < 2)?.length ? (
<ScrollView <ScrollView
contentContainerStyle={styles.contentContainerStyle} contentContainerStyle={styles.contentContainerStyle}
style={styles.container} style={styles.container}

Loading…
Cancel
Save