|
|
|
@ -4,12 +4,12 @@ import { |
|
|
|
|
Text, |
|
|
|
|
Image, |
|
|
|
|
ScrollView, |
|
|
|
|
TouchableOpacity, |
|
|
|
|
TouchableHighlight, |
|
|
|
|
Dimensions, |
|
|
|
|
Appearance, |
|
|
|
|
Pressable, |
|
|
|
|
Platform, |
|
|
|
|
ActivityIndicator |
|
|
|
|
ActivityIndicator, |
|
|
|
|
} from "react-native"; |
|
|
|
|
import { useNavigation } from "@react-navigation/native"; |
|
|
|
|
import { product, userProduct } from "../../../redux/actions"; |
|
|
|
@ -85,12 +85,13 @@ function Book({ |
|
|
|
|
</Pressable> |
|
|
|
|
)} |
|
|
|
|
{imageSlider && <ImageSlider />} |
|
|
|
|
<View style={tw("flex flex-row-reverse")}> |
|
|
|
|
<View style={[tw("flex flex-row-reverse")]}> |
|
|
|
|
<Image |
|
|
|
|
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }} |
|
|
|
|
resizeMode="contain" |
|
|
|
|
style={[ |
|
|
|
|
tw("rounded-md"), |
|
|
|
|
{ height: height / 4, width: ((height / 4) * 3) / 4 }, |
|
|
|
|
tw("rounded-sm bg-red-400"), |
|
|
|
|
{ height: ((width / 3) * 4) / 2.6, width: width / 3 }, |
|
|
|
|
]} |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
@ -106,9 +107,9 @@ function Book({ |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontSize: mobile ? fontSize.lg : fontSize.xl3, |
|
|
|
|
fontSize: mobile ? fontSize.base : fontSize.xl3, |
|
|
|
|
marginBottom: 5, |
|
|
|
|
fontFamily: "demi", |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
textAlign: ios ? "right" : "auto", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
@ -117,7 +118,7 @@ function Book({ |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontSize: mobile ? fontSize.base : fontSize.xl, |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.xl, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
@ -135,7 +136,7 @@ function Book({ |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
style={tw("flex flex-row-reverse items-center justify-around py-6")} |
|
|
|
|
style={tw("flex flex-row-reverse items-center justify-around py-8")} |
|
|
|
|
> |
|
|
|
|
<View> |
|
|
|
|
<Text |
|
|
|
@ -191,7 +192,7 @@ function Book({ |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
<View style={"flex flex-col mt-6"}> |
|
|
|
|
<View style={"flex flex-col mt-8"}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("w-full text-right"), |
|
|
|
@ -207,11 +208,10 @@ function Book({ |
|
|
|
|
<View style={tw("flex justify-between")}></View> |
|
|
|
|
</View> |
|
|
|
|
<View style={tw("flex flex-row-reverse justify-between flex-wrap py-3")}> |
|
|
|
|
<Pressable |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1[colorScheme].greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
|
tw( |
|
|
|
|
"flex flex-row-reverse w-full justify-between px-2 py-3 mb-4" |
|
|
|
|
), |
|
|
|
|
tw("flex flex-row-reverse w-full justify-between px-2 py-3 mb-4"), |
|
|
|
|
{ |
|
|
|
|
borderWidth: 1, |
|
|
|
|
borderColor: Colors.theme1[colorScheme].greenCF, |
|
|
|
@ -226,126 +226,129 @@ function Book({ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه فیزیکی کتاب |
|
|
|
|
</Text> |
|
|
|
|
<View style={tw("flex flex-row-reverse items-center")}> |
|
|
|
|
<View style={tw("w-px h-full bg-green-300")}></View> |
|
|
|
|
<View style={tw("flex")}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
|
{ |
|
|
|
|
borderLeftWidth: 1, |
|
|
|
|
borderColor: Colors.theme1[colorScheme].greenCF, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{separate(book?.product[1]?.price) + " " + "تومان"} |
|
|
|
|
</Text> |
|
|
|
|
{physicalAvailabileInCart && ( |
|
|
|
|
<View |
|
|
|
|
style={tw( |
|
|
|
|
`flex items-center pl-3 ${ |
|
|
|
|
ios ? "flex-row-reverse" : "flex-row-reverse" |
|
|
|
|
}` |
|
|
|
|
)} |
|
|
|
|
<> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه فیزیکی کتاب |
|
|
|
|
</Text> |
|
|
|
|
<View style={tw("flex flex-row-reverse items-center")}> |
|
|
|
|
<View style={tw("w-px h-full bg-green-300")}></View> |
|
|
|
|
<View style={tw("flex")}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
|
{ |
|
|
|
|
borderLeftWidth: 1, |
|
|
|
|
borderColor: Colors.theme1[colorScheme].greenCF, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
<Pressable |
|
|
|
|
onPress={() => |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: physicalAvailabileInCart?.productId, |
|
|
|
|
userId: physicalAvailabileInCart.userId, |
|
|
|
|
count: 1, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
style={[ |
|
|
|
|
tw( |
|
|
|
|
`rounded-md py-0 flex flex-row justify-center items-center border ${ |
|
|
|
|
mobile ? "px-1.5" : "px-3" |
|
|
|
|
}` |
|
|
|
|
), |
|
|
|
|
{ |
|
|
|
|
borderColor: Colors.theme1[colorScheme].green79, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
{separate(book?.product[1]?.price) + " " + "تومان"} |
|
|
|
|
</Text> |
|
|
|
|
{physicalAvailabileInCart && ( |
|
|
|
|
<View |
|
|
|
|
style={tw( |
|
|
|
|
`flex items-center pl-3 ${ |
|
|
|
|
ios ? "flex-row-reverse" : "flex-row-reverse" |
|
|
|
|
}` |
|
|
|
|
)} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.xl4, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
+ |
|
|
|
|
</Text> |
|
|
|
|
</Pressable> |
|
|
|
|
{loading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
style={tw("mx-1.5 my-3")} |
|
|
|
|
size="small" |
|
|
|
|
color={Colors.theme1[colorScheme].greenBA} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Text |
|
|
|
|
<Pressable |
|
|
|
|
onPress={() => |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: physicalAvailabileInCart?.productId, |
|
|
|
|
userId: physicalAvailabileInCart.userId, |
|
|
|
|
count: 1, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
style={[ |
|
|
|
|
tw("mx-1.5"), |
|
|
|
|
tw( |
|
|
|
|
`rounded-md py-0 flex flex-row justify-center items-center border ${ |
|
|
|
|
mobile ? "px-1.5" : "px-3" |
|
|
|
|
}` |
|
|
|
|
), |
|
|
|
|
{ |
|
|
|
|
fontSize: fontSize.xl6, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
borderColor: Colors.theme1[colorScheme].green79, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{physicalAvailabileInCart?.count} |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.xl4, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
+ |
|
|
|
|
</Text> |
|
|
|
|
</Pressable> |
|
|
|
|
{loading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
style={tw("mx-1.5 my-3")} |
|
|
|
|
size="small" |
|
|
|
|
color={Colors.theme1[colorScheme].greenBA} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("mx-1.5"), |
|
|
|
|
{ |
|
|
|
|
fontSize: fontSize.xl6, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{physicalAvailabileInCart?.count} |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
|
<Pressable |
|
|
|
|
onPress={() => |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: physicalAvailabileInCart?.productId, |
|
|
|
|
userId: physicalAvailabileInCart?.userId, |
|
|
|
|
count: -1, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
style={[ |
|
|
|
|
tw( |
|
|
|
|
`rounded-md flex flex-row justify-center items-center border ${ |
|
|
|
|
mobile ? "px-2" : "px-3.5" |
|
|
|
|
}` |
|
|
|
|
), |
|
|
|
|
{ |
|
|
|
|
borderColor: Colors.theme1[colorScheme].green79, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.xl4, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontFamily: "demi", |
|
|
|
|
}} |
|
|
|
|
<Pressable |
|
|
|
|
onPress={() => |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: physicalAvailabileInCart?.productId, |
|
|
|
|
userId: physicalAvailabileInCart?.userId, |
|
|
|
|
count: -1, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
style={[ |
|
|
|
|
tw( |
|
|
|
|
`rounded-md flex flex-row justify-center items-center border ${ |
|
|
|
|
mobile ? "px-2" : "px-3.5" |
|
|
|
|
}` |
|
|
|
|
), |
|
|
|
|
{ |
|
|
|
|
borderColor: Colors.theme1[colorScheme].green79, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
- |
|
|
|
|
</Text> |
|
|
|
|
</Pressable> |
|
|
|
|
</View> |
|
|
|
|
)} |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.xl4, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontFamily: "demi", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
- |
|
|
|
|
</Text> |
|
|
|
|
</Pressable> |
|
|
|
|
</View> |
|
|
|
|
)} |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</Pressable> |
|
|
|
|
<Pressable |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1[colorScheme].greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"), |
|
|
|
|
{ |
|
|
|
@ -363,17 +366,18 @@ function Book({ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه دیجیتال کتاب |
|
|
|
|
</Text> |
|
|
|
|
<View style={tw("flex")}> |
|
|
|
|
<> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه دیجیتال کتاب |
|
|
|
|
</Text> |
|
|
|
|
<View style={tw("flex")}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
@ -478,8 +482,10 @@ function Book({ |
|
|
|
|
</View> |
|
|
|
|
)} |
|
|
|
|
</View> |
|
|
|
|
</Pressable> |
|
|
|
|
<Pressable |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1[colorScheme].greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"), |
|
|
|
|
{ |
|
|
|
@ -501,8 +507,9 @@ function Book({ |
|
|
|
|
> |
|
|
|
|
مشاهده نمونه |
|
|
|
|
</Text> |
|
|
|
|
</Pressable> |
|
|
|
|
<Pressable |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1[colorScheme].greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"), |
|
|
|
|
{ |
|
|
|
@ -520,35 +527,38 @@ function Book({ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید دوره ویدئویی کتاب |
|
|
|
|
</Text> |
|
|
|
|
<View style={tw("flex flex-row-reverse")}> |
|
|
|
|
<View style={tw("w-px h-full bg-green-500")}></View> |
|
|
|
|
<> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
|
{ |
|
|
|
|
borderLeftWidth: 1, |
|
|
|
|
borderColor: Colors.theme1[colorScheme].greenCF, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{separate(book?.product[2]?.price) + " " + "تومان"} |
|
|
|
|
خرید دوره ویدئویی کتاب |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</Pressable> |
|
|
|
|
<Pressable |
|
|
|
|
<View style={tw("flex flex-row-reverse")}> |
|
|
|
|
<View style={tw("w-px h-full bg-green-500")}></View> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
|
{ |
|
|
|
|
borderLeftWidth: 1, |
|
|
|
|
borderColor: Colors.theme1[colorScheme].greenCF, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: Colors.theme1[colorScheme].green79, |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{separate(book?.product[2]?.price) + " " + "تومان"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1[colorScheme].greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"), |
|
|
|
|
{ |
|
|
|
@ -570,7 +580,7 @@ function Book({ |
|
|
|
|
> |
|
|
|
|
پیش نمایش |
|
|
|
|
</Text> |
|
|
|
|
</Pressable> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
</View> |
|
|
|
|
{book?.product[type]?.description && ( |
|
|
|
|
<Description description={book?.description} /> |
|
|
|
|