reza added some change

master
Reza_ashrafi 2 years ago
parent 76e10ae95b
commit b1eb6c81ea
  1. 1
      src/screens/Product/components/Book.js
  2. 20
      src/screens/Product/components/Comments.js
  3. 77
      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];
}, [userProducts, book]);
return (
<ScrollView style={[tw("flex flex-1 relative")]}>
{!mobile && <View style={tw("mt-5")}></View>}

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

@ -13,7 +13,6 @@ import {
} from "react-native";
import React from "react";
import { connect } from "react-redux";
import { useNavigation } from "@react-navigation/native";
import Svg, { Path } from "react-native-svg";
import { userFavorite } from "../../../../redux/actions";
@ -27,9 +26,6 @@ import tw from "tailwind-rn";
import Colors from "../../../../constants/Colors";
import fontSize from "../../../../constants/fontSize";
//assets
import bookImage from "../../..//OrdersFollowUp/assets/b1.png";
const { height, width } = Dimensions.get("window");
const ios = Platform.OS === "ios";
@ -81,7 +77,7 @@ const ProfileBookmark = ({
<Blur />
</View>
)}
{bookmarkList.length > 0 ? (
{bookmarkList.length ? (
<ScrollView
contentContainerStyle={styles.contentContainerStyle}
style={styles.container}
@ -109,6 +105,11 @@ const ProfileBookmark = ({
const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => {
const colorScheme = Appearance.getColorScheme();
const isContent = React.useMemo(() => {
return bookmark?.content;
});
return (
<Pressable
style={[
@ -123,35 +124,55 @@ const Bookmark = ({ bookmark, deleteItem, mobile, grades }) => {
<Image
resizeMode="contain"
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={{
width: mobile ? width / 5 : width / 7,
minWidth: 80,
height: ((mobile ? width / 5 : width / 7) * 4) / 2.7,
minHeight: (80 * 4) / 2.7,
width: mobile
? isContent
? width / 3
: 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
style={{
fontFamily: "bold",
fontSize: fontSize.lg,
color: Colors.theme1[colorScheme].gray20,
}}
>
{bookmark.product.book.name}
</Text>
<Text
style={{
marginTop: 5,
fontFamily: "regular",
fontSize: fontSize.base,
fontSize: fontSize.tiny,
color: Colors.theme1[colorScheme].gray20,
width: width / 3,
}}
>
{"پایه" + " " + grades[bookmark?.product?.book?.gradeId]}
{isContent ? bookmark?.content?.name : bookmark.product.book.name}
</Text>
{!isContent && (
<Text
style={{
marginTop: 5,
fontFamily: "regular",
fontSize: fontSize.base,
color: Colors.theme1[colorScheme].gray20,
}}
>
{"پایه" + " " + grades[bookmark?.product?.book?.gradeId]}
</Text>
)}
</View>
</View>
<Pressable onPress={() => deleteItem({ id: bookmark.id })}>
@ -207,13 +228,3 @@ const styles = StyleSheet.create({
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'}
/>
<Pressable
onClick={() => setOff()}
onPress={() => setOff()}
style={[
tw("py-3 px-5"),
{

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

Loading…
Cancel
Save