|
|
@ -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,35 +124,55 @@ 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, |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{bookmark.product.book.name} |
|
|
|
|
|
|
|
</Text> |
|
|
|
|
|
|
|
<Text |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
marginTop: 5, |
|
|
|
|
|
|
|
fontFamily: "regular", |
|
|
|
|
|
|
|
fontSize: fontSize.base, |
|
|
|
|
|
|
|
color: Colors.theme1[colorScheme].gray20, |
|
|
|
color: Colors.theme1[colorScheme].gray20, |
|
|
|
|
|
|
|
width: width / 3, |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{"پایه" + " " + grades[bookmark?.product?.book?.gradeId]} |
|
|
|
{isContent ? bookmark?.content?.name : bookmark.product.book.name} |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
|
|
|
|
{!isContent && ( |
|
|
|
|
|
|
|
<Text |
|
|
|
|
|
|
|
style={{ |
|
|
|
|
|
|
|
marginTop: 5, |
|
|
|
|
|
|
|
fontFamily: "regular", |
|
|
|
|
|
|
|
fontSize: fontSize.base, |
|
|
|
|
|
|
|
color: Colors.theme1[colorScheme].gray20, |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
{"پایه" + " " + grades[bookmark?.product?.book?.gradeId]} |
|
|
|
|
|
|
|
</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,
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// };
|
|
|
|
|
|
|
|