|
|
|
@ -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,
|
|
|
|
|
// },
|
|
|
|
|
// ],
|
|
|
|
|
// };
|
|
|
|
|