|
|
@ -2,7 +2,6 @@ import { |
|
|
|
View, |
|
|
|
View, |
|
|
|
Text, |
|
|
|
Text, |
|
|
|
Pressable, |
|
|
|
Pressable, |
|
|
|
Appearance, |
|
|
|
|
|
|
|
SafeAreaView, |
|
|
|
SafeAreaView, |
|
|
|
ScrollView, |
|
|
|
ScrollView, |
|
|
|
StyleSheet, |
|
|
|
StyleSheet, |
|
|
@ -10,7 +9,7 @@ import { |
|
|
|
Dimensions, |
|
|
|
Dimensions, |
|
|
|
StatusBar, |
|
|
|
StatusBar, |
|
|
|
Image, |
|
|
|
Image, |
|
|
|
mobile, |
|
|
|
Appearance |
|
|
|
} from "react-native"; |
|
|
|
} from "react-native"; |
|
|
|
import React from "react"; |
|
|
|
import React from "react"; |
|
|
|
import { connect } from "react-redux"; |
|
|
|
import { connect } from "react-redux"; |
|
|
@ -21,6 +20,7 @@ import { userFavorite } from "../../../../redux/actions"; |
|
|
|
//components
|
|
|
|
//components
|
|
|
|
import Navbar from "../../../../components/Navbar"; |
|
|
|
import Navbar from "../../../../components/Navbar"; |
|
|
|
import Empty from "../../../../components/Empty"; |
|
|
|
import Empty from "../../../../components/Empty"; |
|
|
|
|
|
|
|
import Blur from "../../../../components/Blur"; |
|
|
|
|
|
|
|
|
|
|
|
//style
|
|
|
|
//style
|
|
|
|
import tw from "tailwind-rn"; |
|
|
|
import tw from "tailwind-rn"; |
|
|
@ -33,7 +33,9 @@ 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"; |
|
|
|
|
|
|
|
|
|
|
|
const ProfileBookmark = ({ bookmarkList, getList }) => { |
|
|
|
const ProfileBookmark = ({ bookmarkList, getList, deleteItem, loading, mobile }) => { |
|
|
|
|
|
|
|
const colorScheme = Appearance.getColorScheme(); |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
React.useEffect(() => { |
|
|
|
getList(); |
|
|
|
getList(); |
|
|
|
}, []); |
|
|
|
}, []); |
|
|
@ -57,7 +59,22 @@ const ProfileBookmark = ({ bookmarkList, getList }) => { |
|
|
|
back: true, |
|
|
|
back: true, |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
{bookmarkList?.length > 0 ? ( |
|
|
|
{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[colorScheme].white + "60", |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
]} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<Blur /> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
{bookmarkList.length > 0 ? ( |
|
|
|
<ScrollView |
|
|
|
<ScrollView |
|
|
|
contentContainerStyle={styles.contentContainerStyle} |
|
|
|
contentContainerStyle={styles.contentContainerStyle} |
|
|
|
style={styles.container} |
|
|
|
style={styles.container} |
|
|
@ -65,7 +82,12 @@ const ProfileBookmark = ({ bookmarkList, getList }) => { |
|
|
|
<View style={tw("w-full mt-2 px-4")}> |
|
|
|
<View style={tw("w-full mt-2 px-4")}> |
|
|
|
<View style={tw("p-0 m-0 flex")}> |
|
|
|
<View style={tw("p-0 m-0 flex")}> |
|
|
|
{bookmarkList?.map((bookmark, index) => ( |
|
|
|
{bookmarkList?.map((bookmark, index) => ( |
|
|
|
<Bookmark key={index} bookmark={bookmark} /> |
|
|
|
<Bookmark |
|
|
|
|
|
|
|
key={index} |
|
|
|
|
|
|
|
bookmark={bookmark} |
|
|
|
|
|
|
|
deleteItem={deleteItem} |
|
|
|
|
|
|
|
mobile={mobile} |
|
|
|
|
|
|
|
/> |
|
|
|
))} |
|
|
|
))} |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
@ -77,13 +99,13 @@ const ProfileBookmark = ({ bookmarkList, getList }) => { |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
const Bookmark = ({ bookmark }) => { |
|
|
|
const Bookmark = ({ bookmark, deleteItem, mobile }) => { |
|
|
|
const colorScheme = Appearance.getColorScheme(); |
|
|
|
const colorScheme = Appearance.getColorScheme(); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<Pressable |
|
|
|
<Pressable |
|
|
|
style={[ |
|
|
|
style={[ |
|
|
|
tw("flex flex-row-reverse rounded-md justify-between px-3.5 py-2 bg-red-100"), |
|
|
|
tw("flex flex-row-reverse rounded-md justify-between px-3.5 py-2 mb-4"), |
|
|
|
{ |
|
|
|
{ |
|
|
|
borderWidth: 1.5, |
|
|
|
borderWidth: 1.5, |
|
|
|
borderColor: Colors.theme1[colorScheme].greenCF, |
|
|
|
borderColor: Colors.theme1[colorScheme].greenCF, |
|
|
@ -92,7 +114,7 @@ const Bookmark = ({ bookmark }) => { |
|
|
|
> |
|
|
|
> |
|
|
|
<View style={tw("flex flex-row-reverse items-end")}> |
|
|
|
<View style={tw("flex flex-row-reverse items-end")}> |
|
|
|
<Image |
|
|
|
<Image |
|
|
|
source={bookmark.image} |
|
|
|
source={bookmark?.image} |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
width: mobile ? width / 5 : width / 7, |
|
|
|
width: mobile ? width / 5 : width / 7, |
|
|
|
minWidth: 80, |
|
|
|
minWidth: 80, |
|
|
@ -118,10 +140,11 @@ const Bookmark = ({ bookmark }) => { |
|
|
|
color: Colors.theme1[colorScheme].gray20, |
|
|
|
color: Colors.theme1[colorScheme].gray20, |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
{bookmark.grade} |
|
|
|
{bookmark?.grade} |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
|
|
|
|
<Pressable onPress={() => 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" |
|
|
@ -143,6 +166,7 @@ const Bookmark = ({ bookmark }) => { |
|
|
|
/> |
|
|
|
/> |
|
|
|
</Svg> |
|
|
|
</Svg> |
|
|
|
</Pressable> |
|
|
|
</Pressable> |
|
|
|
|
|
|
|
</Pressable> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -150,10 +174,12 @@ const mapStateToProps = (state) => ({ |
|
|
|
loading: state.userFactor.loading, |
|
|
|
loading: state.userFactor.loading, |
|
|
|
mobile: state.publicApi.mobile, |
|
|
|
mobile: state.publicApi.mobile, |
|
|
|
bookmarkList: state.userFavorite.list, |
|
|
|
bookmarkList: state.userFavorite.list, |
|
|
|
|
|
|
|
loading: state.userFavorite.loading, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
const mapDispatchToProps = { |
|
|
|
getList: userFavorite.list, |
|
|
|
getList: userFavorite.list, |
|
|
|
|
|
|
|
deleteItem: userFavorite.del, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ProfileBookmark); |
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(ProfileBookmark); |
|
|
|