|
|
|
@ -53,6 +53,18 @@ function Book({ |
|
|
|
|
}, 500); |
|
|
|
|
}, [type]); |
|
|
|
|
|
|
|
|
|
const physicalProduct = React.useMemo(() => { |
|
|
|
|
return book?.product?.filter((product) => product?.productType === 2)[0]; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const digitalProduct = React.useMemo(() => { |
|
|
|
|
return book?.product?.filter((product) => product?.productType === 1)[0]; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const videoProduct = React.useMemo(() => { |
|
|
|
|
return book?.product?.filter((product) => product?.productType === 4)[0]; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const physicalAvailabileInCart = React.useMemo(() => { |
|
|
|
|
return userProducts?.filter( |
|
|
|
|
(product) => product?.productId === book?.product[1]?.id |
|
|
|
@ -206,7 +218,15 @@ function Book({ |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
{" "} |
|
|
|
|
{"فیزیکی- دیجیتالی - ویدئو" + "\n" + "در دسترس"} |
|
|
|
|
{`${ |
|
|
|
|
videoProduct |
|
|
|
|
? "ویدئو" |
|
|
|
|
: "" + physicalProduct |
|
|
|
|
? "فیزیکی" |
|
|
|
|
: "" + digitalProduct |
|
|
|
|
? "دیجیتال" |
|
|
|
|
: "" |
|
|
|
|
} \n در دسترس`}
|
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
<View |
|
|
|
@ -231,94 +251,222 @@ function Book({ |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
<View style={"flex mt-8"}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("w-full text-right"), |
|
|
|
|
{ |
|
|
|
|
color: |
|
|
|
|
theme === "light" ? Colors.theme1.green79 : Colors.theme1.white, |
|
|
|
|
{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.lg, |
|
|
|
|
fontFamily: "demi", |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
نسخه محصول را انتخاب کنید |
|
|
|
|
</Text> |
|
|
|
|
<View style={tw("flex justify-between")}></View> |
|
|
|
|
</View> |
|
|
|
|
fontSize: mobile ? fontSize.tiny : fontSize.lg, |
|
|
|
|
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")}> |
|
|
|
|
<TouchableHighlight |
|
|
|
|
underlayColor={Colors.theme1.greenFF + "22"} |
|
|
|
|
style={[ |
|
|
|
|
tw("flex flex-row-reverse w-full justify-between px-2 py-3 mb-4"), |
|
|
|
|
{ |
|
|
|
|
borderWidth: 1, |
|
|
|
|
borderColor: Colors.theme1.greenCF, |
|
|
|
|
backgroundColor: |
|
|
|
|
theme === "light" ? Colors.theme1.greenFF + "0a" : null, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
onPress={() => |
|
|
|
|
physicalAvailabileInCart |
|
|
|
|
? asyncAwesomeAlert( |
|
|
|
|
"", |
|
|
|
|
"این محصول قبلا به سبد خرید شما اضافه شده است.", |
|
|
|
|
{ |
|
|
|
|
showCancelButton: true, |
|
|
|
|
onConfirm: () => |
|
|
|
|
navigation.navigate("Root", { |
|
|
|
|
screen: "ShoppingCartTab", |
|
|
|
|
}), |
|
|
|
|
confirmText: "مشاهده سبد خرید", |
|
|
|
|
cancelText: "باشه", |
|
|
|
|
{physicalProduct ? ( |
|
|
|
|
<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={() => |
|
|
|
|
physicalAvailabileInCart |
|
|
|
|
? asyncAwesomeAlert( |
|
|
|
|
"", |
|
|
|
|
"این محصول قبلا به سبد خرید شما اضافه شده است.", |
|
|
|
|
{ |
|
|
|
|
showCancelButton: true, |
|
|
|
|
onConfirm: () => |
|
|
|
|
navigation.navigate("Root", { |
|
|
|
|
screen: "ShoppingCartTab", |
|
|
|
|
}), |
|
|
|
|
confirmText: "مشاهده سبد خرید", |
|
|
|
|
cancelText: "باشه", |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: addToCart( |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: physicalProduct?.id, |
|
|
|
|
userId: userId, |
|
|
|
|
count: 1, |
|
|
|
|
}), |
|
|
|
|
"physical" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "physical" && userProductsLoading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: addToCart( |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: book?.product[1]?.id, |
|
|
|
|
userId: userId, |
|
|
|
|
count: 1, |
|
|
|
|
}), |
|
|
|
|
"physical" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "physical" && userProductsLoading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
size={fontSize.sm} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
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"), |
|
|
|
|
{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{(separate(physicalProduct?.price) || " ") + " " + "تومان"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
{physicalProduct ? ( |
|
|
|
|
<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.push("Sample", { id: book?.sampleFileId }) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.xs, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF |
|
|
|
|
} |
|
|
|
|
size={fontSize.sm} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
مشاهده نمونه |
|
|
|
|
</Text> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
|
|
|
|
|
{digitalProduct ? ( |
|
|
|
|
<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={() => |
|
|
|
|
digitalAvailabileInCart |
|
|
|
|
? asyncAwesomeAlert( |
|
|
|
|
"", |
|
|
|
|
"این محصول قبلا به سبد خرید شما اضافه شده است.", |
|
|
|
|
{ |
|
|
|
|
showCancelButton: true, |
|
|
|
|
onConfirm: () => |
|
|
|
|
navigation.navigate("Root", { |
|
|
|
|
screen: "ShoppingCartTab", |
|
|
|
|
}), |
|
|
|
|
confirmText: "مشاهده سبد خرید", |
|
|
|
|
cancelText: "باشه", |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: addToCart( |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: digitalProduct?.id, |
|
|
|
|
userId: userId, |
|
|
|
|
count: 1, |
|
|
|
|
}), |
|
|
|
|
"digital" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "digital" && userProductsLoading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه فیزیکی کتاب |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
: Colors.theme1.greenCF |
|
|
|
|
} |
|
|
|
|
size={fontSize.sm} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
<View style={tw("flex flex-row-reverse items-center")}> |
|
|
|
|
<View style={tw("w-px h-full bg-green-300")}></View> |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه دیجیتال کتاب |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
<View style={tw("flex")}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
|
{ |
|
|
|
|
borderRightWidth: 1, |
|
|
|
|
borderColor: Colors.theme1.greenCF, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
@ -329,241 +477,131 @@ function Book({ |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{(separate(book?.product[1]?.price) || " ") + " " + "تومان"} |
|
|
|
|
{(separate(digitalProduct?.price) || " ") + " " + "تومان"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
<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={() => |
|
|
|
|
digitalAvailabileInCart |
|
|
|
|
? asyncAwesomeAlert( |
|
|
|
|
"", |
|
|
|
|
"این محصول قبلا به سبد خرید شما اضافه شده است.", |
|
|
|
|
{ |
|
|
|
|
showCancelButton: true, |
|
|
|
|
onConfirm: () => |
|
|
|
|
navigation.navigate("Root", { |
|
|
|
|
screen: "ShoppingCartTab", |
|
|
|
|
}), |
|
|
|
|
confirmText: "مشاهده سبد خرید", |
|
|
|
|
cancelText: "باشه", |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
: addToCart( |
|
|
|
|
pushToCart({ |
|
|
|
|
productId: book?.product[0]?.id, |
|
|
|
|
userId: userId, |
|
|
|
|
count: 1, |
|
|
|
|
}), |
|
|
|
|
"digital" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "digital" && userProductsLoading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
</> |
|
|
|
|
</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 })} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.xs, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF |
|
|
|
|
} |
|
|
|
|
size={fontSize.sm} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
خرید نسخه دیجیتال کتاب |
|
|
|
|
</Text> |
|
|
|
|
)} |
|
|
|
|
<View style={tw("flex")}> |
|
|
|
|
<Text |
|
|
|
|
style={[ |
|
|
|
|
tw("py-1 pr-2"), |
|
|
|
|
{ |
|
|
|
|
borderRightWidth: 1, |
|
|
|
|
borderColor: Colors.theme1.greenCF, |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{(separate(book?.product[0]?.price) || " ") + " " + "تومان"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
<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.push("Sample", { id: book?.sampleFileId })} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.xs, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
پیش نمایش |
|
|
|
|
</Text> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
|
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
{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" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
مشاهده نمونه |
|
|
|
|
</Text> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
<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: book?.product[2]?.id, |
|
|
|
|
userId: userId, |
|
|
|
|
count: 1, |
|
|
|
|
}), |
|
|
|
|
"video" |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
> |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "video" && userProductsLoading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF |
|
|
|
|
} |
|
|
|
|
size={fontSize.sm} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: |
|
|
|
|
<> |
|
|
|
|
{whichTypeAdded === "video" && userProductsLoading ? ( |
|
|
|
|
<ActivityIndicator |
|
|
|
|
color={ |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
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"), |
|
|
|
|
{ |
|
|
|
|
: Colors.theme1.greenCF |
|
|
|
|
} |
|
|
|
|
size={fontSize.sm} |
|
|
|
|
/> |
|
|
|
|
) : ( |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{(separate(book?.product[2]?.price) || " ") + " " + "تومان"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
<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 })} |
|
|
|
|
> |
|
|
|
|
<Text |
|
|
|
|
style={{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
fontSize: fontSize.xs, |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
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"), |
|
|
|
|
{ |
|
|
|
|
fontFamily: "bold", |
|
|
|
|
color: |
|
|
|
|
theme === "light" |
|
|
|
|
? Colors.theme1.green79 |
|
|
|
|
: Colors.theme1.greenCF, |
|
|
|
|
|
|
|
|
|
paddingVertical: 4, |
|
|
|
|
}} |
|
|
|
|
> |
|
|
|
|
پیش نمایش |
|
|
|
|
</Text> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
fontSize: fontSize.sm, |
|
|
|
|
}, |
|
|
|
|
]} |
|
|
|
|
> |
|
|
|
|
{(separate(videoProduct?.price) || " ") + " " + "تومان"} |
|
|
|
|
</Text> |
|
|
|
|
</View> |
|
|
|
|
</> |
|
|
|
|
</TouchableHighlight> |
|
|
|
|
) : null} |
|
|
|
|
</View> |
|
|
|
|
{console.log(book?.text)} |
|
|
|
|
{book?.text ? ( |
|
|
|
|
<LinkBox |
|
|
|
|
title="توضیحات" |
|
|
|
|