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