|
|
|
@ -18,7 +18,6 @@ import separate from "../../../utils/separate"; |
|
|
|
|
//components
|
|
|
|
|
import LinkBox from "./LinkBox"; |
|
|
|
|
import Comments from "./Comments"; |
|
|
|
|
import ImageSlider from "../../../components/ImageSlider"; |
|
|
|
|
import Rates from "./Rates"; |
|
|
|
|
|
|
|
|
|
//style
|
|
|
|
@ -39,20 +38,23 @@ function Book({ |
|
|
|
|
userProducts, |
|
|
|
|
theme, |
|
|
|
|
orientation, |
|
|
|
|
availableForSell, |
|
|
|
|
}) { |
|
|
|
|
const [width, setWidth] = React.useState(Dimensions.get("window").width); |
|
|
|
|
const navigation = useNavigation(); |
|
|
|
|
const [type, setType] = useState(1); |
|
|
|
|
const [whichTypeAdded, setWhichTypeAdded] = React.useState(null); |
|
|
|
|
const [pageLoading, setPageLoading] = useState(false); |
|
|
|
|
const [imageSlider, setImageSlider] = useState(false); |
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
setPageLoading(true); |
|
|
|
|
setTimeout(() => { |
|
|
|
|
setPageLoading(false); |
|
|
|
|
}, 500); |
|
|
|
|
}, [type]); |
|
|
|
|
const physicalAvailableForSell = React.useMemo(() => { |
|
|
|
|
return availableForSell?.filter((product) => product === 2)?.length; |
|
|
|
|
}, [availableForSell]); |
|
|
|
|
|
|
|
|
|
const digitalAvailableForSell = React.useMemo(() => { |
|
|
|
|
return availableForSell?.filter((product) => product === 1)?.length; |
|
|
|
|
}, [availableForSell]); |
|
|
|
|
|
|
|
|
|
const videoAvailableForSell = React.useMemo(() => { |
|
|
|
|
return availableForSell?.filter((product) => product === 4)?.length; |
|
|
|
|
}, [availableForSell]); |
|
|
|
|
|
|
|
|
|
const physicalProduct = React.useMemo(() => { |
|
|
|
|
return book?.product?.filter((product) => product?.productType === 2)[0]; |
|
|
|
@ -134,162 +136,18 @@ function Book({ |
|
|
|
|
} |
|
|
|
|
}, [userProducts]); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<View |
|
|
|
|
style={[tw("flex flex-1 relative")]} |
|
|
|
|
onLayout={() => setWidth(Dimensions.get("window").width)} |
|
|
|
|
> |
|
|
|
|
{!mobile ? <View style={tw("mt-5")}></View> : null} |
|
|
|
|
{/* {imageSlider ? <ImageSlider /> : null} */} |
|
|
|
|
<View style={[tw("flex flex-row-reverse")]}> |
|
|
|
|
<Image |
|
|
|
|
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }} |
|
|
|
|
resizeMode="contain" |
|
|
|
|
style={[ |
|
|
|
|
tw("rounded-sm"), |
|
|
|
|
{ |
|
|
|
|
height: mobile |
|
|
|
|
? ((width / 3) * 4) / 2.6 |
|
|
|
|
: orientation === "portrait" |
|
|
|
|
? ((width / 4) * 4) / 2.6 |
|
|
|
|
: ((width / 6) * 4) / 2.6, |
|
|
|
|
width: mobile |
|
|
|
|
? width / 3 |
|
|
|
|
: orientation === "portrait" |
|
|
|
|
? width / 4 |
|
|
|
|
: width / 6, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
/> |
|
|
|
|
<View |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-1 justify-between items-end"), |
|
|
|
|
{ |
|
|
|
|
paddingRight: 10, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
<View style={tw("flex items-end")}> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.white, |
|
|
|
|
fontSize: mobile ? fontSize.base : fontSize.lg, |
|
|
|
|
marginBottom: 5, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
textAlign: ios ? "right" : "auto", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{book?.name || ""} |
|
|
|
|
</Text> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.white, |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{"پایه" + " " + (grades[book?.gradeId] || " ")} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
style={tw("flex flex-row-reverse items-center justify-around py-8")} |
|
|
|
|
> |
|
|
|
|
<View> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, |
|
|
|
|
textAlign: "center", |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{" "} |
|
|
|
|
{(book?.pagesNum || " ") + "\n" + "صفحه"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
style={{ |
|
|
|
|
backgroundColor: Colors.theme1.green79 + "55", |
|
|
|
|
height: 20, |
|
|
|
|
width: 2, |
|
|
|
|
}} |
|
|
|
|
></View> |
|
|
|
|
<View> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, |
|
|
|
|
textAlign: "center", |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{" "} |
|
|
|
|
{`${ |
|
|
|
|
videoProduct |
|
|
|
|
? "ویدئو" |
|
|
|
|
: "" + physicalProduct |
|
|
|
|
? "فیزیکی" |
|
|
|
|
: "" + digitalProduct |
|
|
|
|
? "دیجیتال" |
|
|
|
|
: "" |
|
|
|
|
} \n در دسترس`}
|
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
style={{ |
|
|
|
|
backgroundColor: Colors.theme1.green79 + "55", |
|
|
|
|
height: 20, |
|
|
|
|
width: 2, |
|
|
|
|
}} |
|
|
|
|
></View> |
|
|
|
|
<View> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, |
|
|
|
|
textAlign: "center", |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{" "} |
|
|
|
|
{4.8 + "\n" + "امتیاز"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
{book?.product?.length > 1 ? ( |
|
|
|
|
<View style={"flex mt-8"}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("w-full text-right"), |
|
|
|
|
{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.white, |
|
|
|
|
|
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "demi", |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
نسخه محصول را انتخاب کنید |
|
|
|
|
</Text> |
|
|
|
|
<View style={tw("flex justify-between")}></View> |
|
|
|
|
</View> |
|
|
|
|
) : null} |
|
|
|
|
<View style={tw("flex flex-row-reverse justify-between flex-wrap py-3")}> |
|
|
|
|
{physicalProduct ? ( |
|
|
|
|
const ProductButton = ({ |
|
|
|
|
availableInCart, |
|
|
|
|
availableForSell, |
|
|
|
|
product, |
|
|
|
|
type, |
|
|
|
|
onLoad, |
|
|
|
|
title, |
|
|
|
|
sample, |
|
|
|
|
sampleAction, |
|
|
|
|
}) => { |
|
|
|
|
return product ? ( |
|
|
|
|
<View style={tw("w-full flex flex-row-reverse justify-between")}> |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1.greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
@ -303,7 +161,7 @@ function Book({ |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
onPress={() => |
|
|
|
|
physicalAvailabileInCart |
|
|
|
|
availableInCart |
|
|
|
|
? asyncAwesomeAlert( |
|
|
|
|
"", |
|
|
|
|
"این محصول قبلا به سبد خرید شما اضافه شده است.", |
|
|
|
@ -317,18 +175,20 @@ function Book({ |
|
|
|
|
cancelText: "باشه", |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: addToCart( |
|
|
|
|
: availableForSell |
|
|
|
|
? addToCart( |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: physicalProduct?.id, |
|
|
|
|
productId: product?.id, |
|
|
|
|
userId: userId, |
|
|
|
|
count: 1, |
|
|
|
|
}), |
|
|
|
|
"physical" |
|
|
|
|
type |
|
|
|
|
) |
|
|
|
|
: null |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "physical" && userProductsLoading ? ( |
|
|
|
|
{onLoad ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
theme === "light" |
|
|
|
@ -350,7 +210,7 @@ function Book({ |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه فیزیکی کتاب |
|
|
|
|
{title} |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
|
|
|
|
@ -371,14 +231,15 @@ function Book({ |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{(separate(physicalProduct?.price) || " ") + " " + "تومان"} |
|
|
|
|
{availableForSell |
|
|
|
|
? (separate(product?.price) || " ") + " " + "تومان" |
|
|
|
|
: "ناموجود"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
{physicalProduct ? ( |
|
|
|
|
{sample ? ( |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1.greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
@ -391,9 +252,7 @@ function Book({ |
|
|
|
|
width: fontSize.sm * 6 + 18, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
onPress={() => |
|
|
|
|
navigation.push("Sample", { id: book?.sampleFileId }) |
|
|
|
|
} |
|
|
|
|
onPress={() => sampleAction()} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
@ -411,212 +270,194 @@ function Book({ |
|
|
|
|
</Text> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
</View> |
|
|
|
|
) : null; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
{digitalProduct ? ( |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1.greenFF + "22"} |
|
|
|
|
return ( |
|
|
|
|
<View |
|
|
|
|
style={[tw("flex flex-1 relative")]} |
|
|
|
|
onLayout={() => setWidth(Dimensions.get("window").width)} |
|
|
|
|
> |
|
|
|
|
{!mobile ? <View style={tw("mt-5")}></View> : null} |
|
|
|
|
{/* {imageSlider ? <ImageSlider /> : null} */} |
|
|
|
|
<View style={[tw("flex flex-row-reverse")]}> |
|
|
|
|
<Image |
|
|
|
|
source={{ uri: `https://dnvn.ir/api/v1/file/${book?.fileIds}` }} |
|
|
|
|
resizeMode="contain" |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"), |
|
|
|
|
tw("rounded-sm"), |
|
|
|
|
{ |
|
|
|
|
borderWidth: 1, |
|
|
|
|
borderColor: Colors.theme1.greenCF, |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.greenFF + "0a" : null, |
|
|
|
|
width: width - 32 - 8 - (fontSize.sm * 6 + 18), |
|
|
|
|
height: mobile |
|
|
|
|
? ((width / 3) * 4) / 2.6 |
|
|
|
|
: orientation === "portrait" |
|
|
|
|
? ((width / 4) * 4) / 2.6 |
|
|
|
|
: ((width / 6) * 4) / 2.6, |
|
|
|
|
width: mobile |
|
|
|
|
? width / 3 |
|
|
|
|
: orientation === "portrait" |
|
|
|
|
? width / 4 |
|
|
|
|
: width / 6, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
onPress={() => |
|
|
|
|
digitalAvailabileInCart |
|
|
|
|
? asyncAwesomeAlert( |
|
|
|
|
"", |
|
|
|
|
"این محصول قبلا به سبد خرید شما اضافه شده است.", |
|
|
|
|
/> |
|
|
|
|
<View |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-1 justify-between items-end"), |
|
|
|
|
{ |
|
|
|
|
showCancelButton: true, |
|
|
|
|
onConfirm: () => |
|
|
|
|
navigation.navigate("Root", { |
|
|
|
|
screen: "ShoppingCartTab", |
|
|
|
|
}), |
|
|
|
|
confirmText: "مشاهده سبد خرید", |
|
|
|
|
cancelText: "باشه", |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: addToCart( |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: digitalProduct?.id, |
|
|
|
|
userId: userId, |
|
|
|
|
count: 1, |
|
|
|
|
}), |
|
|
|
|
"digital" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
paddingRight: 10, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "digital" && userProductsLoading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF |
|
|
|
|
} |
|
|
|
|
size={fontSize.sm} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<View style={tw("flex items-end")}> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
paddingVertical: 4, |
|
|
|
|
: Colors.theme1.white, |
|
|
|
|
fontSize: mobile ? fontSize.base : fontSize.lg, |
|
|
|
|
marginBottom: 5, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
textAlign: ios ? "right" : "auto", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه دیجیتال کتاب |
|
|
|
|
{book?.name || ""} |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
<View style={tw("flex")}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
|
{ |
|
|
|
|
borderRightWidth: 1, |
|
|
|
|
borderColor: Colors.theme1.greenCF, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
style={{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
: Colors.theme1.white, |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{(separate(digitalProduct?.price) || " ") + " " + "تومان"} |
|
|
|
|
{"پایه" + " " + (grades[book?.gradeId] || " ")} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
{digitalProduct ? ( |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1.greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-row-reverse justify-center px-2 py-3 mb-4"), |
|
|
|
|
{ |
|
|
|
|
borderWidth: 1, |
|
|
|
|
borderColor: Colors.theme1.greenCF, |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.greenFF + "0a" : null, |
|
|
|
|
width: fontSize.sm * 6 + 18, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
onPress={() => navigation.navigate("Video", { id: book?.id })} |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
style={tw("flex flex-row-reverse items-center justify-around py-8")} |
|
|
|
|
> |
|
|
|
|
<View> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.xs, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
paddingVertical: 4, |
|
|
|
|
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, |
|
|
|
|
textAlign: "center", |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
پیش نمایش |
|
|
|
|
{" "} |
|
|
|
|
{(book?.pagesNum || " ") + "\n" + "صفحه"} |
|
|
|
|
</Text> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
|
|
|
|
|
{videoProduct ? ( |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1.greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-row-reverse justify-between px-2 py-3 mb-4"), |
|
|
|
|
{ |
|
|
|
|
borderWidth: 1, |
|
|
|
|
borderColor: Colors.theme1.greenCF, |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.greenFF + "0a" : null, |
|
|
|
|
width: width - 32 - 8 - (fontSize.sm * 6 + 18), |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
onPress={() => |
|
|
|
|
videoAvailabileInCart |
|
|
|
|
? asyncAwesomeAlert( |
|
|
|
|
"", |
|
|
|
|
"این محصول قبلا به سبد خرید شما اضافه شده است.", |
|
|
|
|
{ |
|
|
|
|
showCancelButton: true, |
|
|
|
|
onConfirm: () => |
|
|
|
|
navigation.navigate("Root", { |
|
|
|
|
screen: "ShoppingCartTab", |
|
|
|
|
}), |
|
|
|
|
confirmText: "مشاهده سبد خرید", |
|
|
|
|
cancelText: "باشه", |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: addToCart( |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: videoProduct?.id, |
|
|
|
|
userId: userId, |
|
|
|
|
count: 1, |
|
|
|
|
}), |
|
|
|
|
"video" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
style={{ |
|
|
|
|
backgroundColor: Colors.theme1.green79 + "55", |
|
|
|
|
height: 20, |
|
|
|
|
width: 2, |
|
|
|
|
}} |
|
|
|
|
></View> |
|
|
|
|
<View> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, |
|
|
|
|
textAlign: "center", |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "video" && userProductsLoading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF |
|
|
|
|
} |
|
|
|
|
size={fontSize.sm} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
{" "} |
|
|
|
|
{`${ |
|
|
|
|
videoProduct |
|
|
|
|
? "ویدئو" |
|
|
|
|
: "" + physicalProduct |
|
|
|
|
? "فیزیکی" |
|
|
|
|
: "" + digitalProduct |
|
|
|
|
? "دیجیتال" |
|
|
|
|
: "" |
|
|
|
|
} \n در دسترس`}
|
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
|
style={{ |
|
|
|
|
backgroundColor: Colors.theme1.green79 + "55", |
|
|
|
|
height: 20, |
|
|
|
|
width: 2, |
|
|
|
|
}} |
|
|
|
|
></View> |
|
|
|
|
<View> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
paddingVertical: 4, |
|
|
|
|
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, |
|
|
|
|
textAlign: "center", |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "regular", |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید دوره ویدئویی کتاب |
|
|
|
|
{" "} |
|
|
|
|
{book?.rate || 4 + "\n" + "امتیاز"} |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
<View style={tw("flex flex-row-reverse")}> |
|
|
|
|
<View style={tw("w-px h-full bg-green-500")}></View> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
{book?.product?.length > 1 ? ( |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
|
tw("w-full text-right"), |
|
|
|
|
{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, |
|
|
|
|
|
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.base, |
|
|
|
|
fontFamily: "demi", |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{(separate(videoProduct?.price) || " ") + " " + "تومان"} |
|
|
|
|
نسخه محصول را انتخاب کنید |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
<View style={tw("mt-4")}> |
|
|
|
|
<ProductButton |
|
|
|
|
product={physicalProduct} |
|
|
|
|
availableForSell={physicalAvailableForSell} |
|
|
|
|
availableInCart={physicalAvailabileInCart} |
|
|
|
|
type="physical" |
|
|
|
|
onLoad={whichTypeAdded === "physical" && userProductsLoading} |
|
|
|
|
title="خرید نسخه فیزیکی کتاب" |
|
|
|
|
sample={true} |
|
|
|
|
sampleAction={() => |
|
|
|
|
navigation.push("Sample", { id: book?.sampleFileId }) |
|
|
|
|
} |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<ProductButton |
|
|
|
|
product={videoProduct} |
|
|
|
|
availableInCart={videoAvailabileInCart} |
|
|
|
|
availableForSell={videoAvailableForSell} |
|
|
|
|
type="video" |
|
|
|
|
onLoad={whichTypeAdded === "video" && userProductsLoading} |
|
|
|
|
title="خرید نسخه ویدئویی کتاب" |
|
|
|
|
sample={true} |
|
|
|
|
sampleAction={() => navigation.navigate("Video", { id: book?.id })} |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<ProductButton |
|
|
|
|
product={digitalProduct} |
|
|
|
|
availableInCart={digitalAvailabileInCart} |
|
|
|
|
availableForSell={digitalAvailableForSell} |
|
|
|
|
type="digital" |
|
|
|
|
onLoad={whichTypeAdded === "digital" && userProductsLoading} |
|
|
|
|
title="خرید نسخه دیجیتال کتاب" |
|
|
|
|
sample={false} |
|
|
|
|
sampleAction={() => {}} |
|
|
|
|
/> |
|
|
|
|
</View> |
|
|
|
|
{book?.text ? ( |
|
|
|
|
<LinkBox |
|
|
|
@ -699,6 +540,7 @@ const mapStateToProps = (state) => ({ |
|
|
|
|
mobile: state.publicApi.mobile, |
|
|
|
|
orientation: state.publicApi.orientation, |
|
|
|
|
theme: state.publicApi.theme, |
|
|
|
|
availableForSell: state.config.availableForSell, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
|