loyalty: enhance card texts
This commit is contained in:
@@ -130,7 +130,7 @@
|
|||||||
"payDescription": "الدفع",
|
"payDescription": "الدفع",
|
||||||
"rating": "التقييم ",
|
"rating": "التقييم ",
|
||||||
"loyaltyPoints": "نقاط الولاء",
|
"loyaltyPoints": "نقاط الولاء",
|
||||||
"loyaltyDescription": "اشترى {{value}} وجبات واحصل على وجبة مجانية",
|
"loyaltyDescription": "اشترى {{value}} وجبات واحصل على وجبة مجانية!",
|
||||||
"youMightAlsoLike": "قد تعجبك أيضاً..",
|
"youMightAlsoLike": "قد تعجبك أيضاً..",
|
||||||
"choose1": "اختر 1",
|
"choose1": "اختر 1",
|
||||||
"specialRequest": "طلب خاص",
|
"specialRequest": "طلب خاص",
|
||||||
@@ -165,7 +165,8 @@
|
|||||||
"restaurantIsClosed": "المطعم مغلق",
|
"restaurantIsClosed": "المطعم مغلق",
|
||||||
"address": "العنوان",
|
"address": "العنوان",
|
||||||
"openingTimes": "ساعات العمل",
|
"openingTimes": "ساعات العمل",
|
||||||
"customizable": "قابل للتخصيص"
|
"customizable": "قابل للتخصيص",
|
||||||
|
"youHaveXEarnedRewardsReadyToRedeem": "🎉 لديك {{rewards}} مكافأة مستحقة للاستخدام!"
|
||||||
},
|
},
|
||||||
"cart": {
|
"cart": {
|
||||||
"addSpecialRequestOptional": "إضافة طلب خاص (اختياري)",
|
"addSpecialRequestOptional": "إضافة طلب خاص (اختياري)",
|
||||||
|
|||||||
@@ -144,7 +144,7 @@
|
|||||||
"close": "Close",
|
"close": "Close",
|
||||||
"rating": "Rating ",
|
"rating": "Rating ",
|
||||||
"loyaltyPoints": "Loyalty Points",
|
"loyaltyPoints": "Loyalty Points",
|
||||||
"loyaltyDescription": "Buy {{value}} meals and get 1 FREE",
|
"loyaltyDescription": "Buy {{value}} meals and get 1 FREE!",
|
||||||
"choose1": "Choose 1",
|
"choose1": "Choose 1",
|
||||||
"youMightAlsoLike": "You might also like..",
|
"youMightAlsoLike": "You might also like..",
|
||||||
"specialRequest": "Special Request",
|
"specialRequest": "Special Request",
|
||||||
@@ -177,7 +177,8 @@
|
|||||||
"payDescription": "Pay for your order",
|
"payDescription": "Pay for your order",
|
||||||
"address": "Address",
|
"address": "Address",
|
||||||
"openingTimes": "Opening Times",
|
"openingTimes": "Opening Times",
|
||||||
"customizable": "Customizable"
|
"customizable": "Customizable",
|
||||||
|
"youHaveXEarnedRewardsReadyToRedeem": "🎉 You have {{rewards}} rewards ready to redeem!"
|
||||||
},
|
},
|
||||||
"cart": {
|
"cart": {
|
||||||
"remainingToPay": "Remaining to Pay",
|
"remainingToPay": "Remaining to Pay",
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ const LoyaltyCard = () => {
|
|||||||
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain);
|
const { data: restaurant } = useGetRestaurantDetailsQuery(subdomain);
|
||||||
const { isRTL } = useAppSelector((state) => state.locale);
|
const { isRTL } = useAppSelector((state) => state.locale);
|
||||||
const token = localStorage.getItem(ACCESS_TOKEN);
|
const token = localStorage.getItem(ACCESS_TOKEN);
|
||||||
const isHasLoyaltyGift =
|
const loyaltyStamps = restaurant?.loyalty_stamps ?? 0;
|
||||||
(restaurant?.loyalty_stamps || 0) -
|
const customerLoyaltyPoints = restaurant?.customer_loyalty_points ?? 0;
|
||||||
(restaurant?.customer_loyalty_points || 0) <=
|
const remainingToNextReward =
|
||||||
0;
|
loyaltyStamps - (customerLoyaltyPoints % loyaltyStamps);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.loyaltyContainer}>
|
<div className={styles.loyaltyContainer}>
|
||||||
@@ -62,8 +62,14 @@ const LoyaltyCard = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{token &&
|
{token &&
|
||||||
|
customerLoyaltyPoints < loyaltyStamps &&
|
||||||
t("menu.loyaltyDescription", {
|
t("menu.loyaltyDescription", {
|
||||||
value: restaurant?.loyalty_stamps ?? 0,
|
value: loyaltyStamps,
|
||||||
|
})}
|
||||||
|
{token &&
|
||||||
|
customerLoyaltyPoints >= loyaltyStamps &&
|
||||||
|
t("menu.youHaveXEarnedRewardsReadyToRedeem", {
|
||||||
|
rewards: Math.floor(customerLoyaltyPoints / loyaltyStamps),
|
||||||
})}
|
})}
|
||||||
{!token && (
|
{!token && (
|
||||||
<div style={{ paddingTop: 4 }}>
|
<div style={{ paddingTop: 4 }}>
|
||||||
@@ -95,21 +101,23 @@ const LoyaltyCard = () => {
|
|||||||
)}
|
)}
|
||||||
</ProText>
|
</ProText>
|
||||||
</Col>
|
</Col>
|
||||||
<Col> {isHasLoyaltyGift && <PresentIcon />}</Col>
|
{/* <Col> {isHasLoyaltyGift && <PresentIcon />}</Col> */}
|
||||||
</Row>
|
</Row>
|
||||||
{token && (
|
{token && (
|
||||||
|
<>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
gap: 12,
|
gap: 12,
|
||||||
overflow: "hidden",
|
overflow: "auto",
|
||||||
scrollbarWidth: "none",
|
scrollbarWidth: "none",
|
||||||
|
paddingBottom: 12,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Array.from({ length: restaurant?.loyalty_stamps || 0 }).map(
|
{Array.from({ length: loyaltyStamps }).map(
|
||||||
(_, index) => {
|
(_, index) => {
|
||||||
const currentPoints = restaurant?.customer_loyalty_points || 0;
|
const currentPoints = customerLoyaltyPoints % loyaltyStamps;
|
||||||
const isCollected = index < currentPoints;
|
const isCollected = index < currentPoints;
|
||||||
return (
|
return (
|
||||||
<Col key={index}>
|
<Col key={index}>
|
||||||
@@ -129,6 +137,28 @@ const LoyaltyCard = () => {
|
|||||||
},
|
},
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
<ProText
|
||||||
|
strong
|
||||||
|
style={{
|
||||||
|
fontWeight: 400,
|
||||||
|
fontStyle: "Regular",
|
||||||
|
fontSize: "12px",
|
||||||
|
lineHeight: "140%",
|
||||||
|
letterSpacing: "0%",
|
||||||
|
color:
|
||||||
|
customerLoyaltyPoints < loyaltyStamps ? "#777580" : "#32AD6D",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{customerLoyaltyPoints < loyaltyStamps &&
|
||||||
|
t("rewardsAndLoyalty.youreJustXCupsAwayFromYourNextReward", {
|
||||||
|
cups: remainingToNextReward,
|
||||||
|
})}
|
||||||
|
{customerLoyaltyPoints >= loyaltyStamps &&
|
||||||
|
t("rewardsAndLoyalty.youreJustXCupsAwayFromYourNextReward", {
|
||||||
|
cups: remainingToNextReward,
|
||||||
|
})}
|
||||||
|
</ProText>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user