Merged in feat/membership-information (pull request #233)

Feat(WEB-307) Display correct membership information

* fix: fix typo

* chore: update fetch of user membership

* chore: update components to use api data

* chore: remove lang as static value

* fix: adapt to dev updates

* fix: adapt to code from dev

* fix: break out MembershipLevel into its a React component

* fix: add enum to zod validation

* refactor: rename tier to level

* refactor: remove unnecessary casts

* refactor: change toString() to hideEmpty=false

* refactor: remove toString()

* refactor: remove hideEmpty from title and subtitle

* fix: update currentLevel with data

* fix: fix from rebase


Approved-by: Michael Zetterberg
This commit is contained in:
Matilda Landström
2024-06-18 13:14:09 +00:00
committed by Michael Zetterberg
parent aca9221ea6
commit 9931d9edef
33 changed files with 473 additions and 357 deletions

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltyLevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltyLevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltyLevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltyLevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltyLevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltyLevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltyLevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltyLevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltyLevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltyLevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltyLevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltyLevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltyLevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltyLevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltyLevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltyLevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltyLevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltyLevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltyLevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltyLevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltyLevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltyLevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltyLevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltyLevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltylevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltylevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltylevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltylevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltylevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltylevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltylevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltylevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltylevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltylevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltylevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltylevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -37,7 +37,7 @@ export default function LoyaltyLevels() {
<div className={styles.cardContainer}>
{levels.map((level: Level) => (
<LevelCard
key={level.tier}
key={level.level}
formatMessage={formatMessage}
lang={lang}
level={level}
@@ -60,7 +60,7 @@ function LevelCard({ formatMessage, lang, level }: LevelCardProps) {
: pointsString
let Level = null
switch (level.tier) {
switch (level.level) {
case 1:
Level = NewFriend
break
@@ -86,7 +86,7 @@ function LevelCard({ formatMessage, lang, level }: LevelCardProps) {
return (
<article className={styles.card}>
<Title className={styles.tierHeading} level="h4">
{level.tier}
{level.level}
</Title>
{Level ? <Level color="primaryLightOnSurfaceAccent" /> : null}
<div className={styles.textContainer}>

View File

@@ -1,3 +1,4 @@
import { MembershipLevelEnum } from "@/constants/membershipLevels"
import { serverClient } from "@/lib/trpc/server"
import Header from "@/components/SectionHeader"
@@ -6,43 +7,58 @@ import Link from "@/components/TempDesignSystem/Link"
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import { getMembershipLevelObject } from "@/utils/membershipLevel"
import { getMembership } from "@/utils/user"
import styles from "./current.module.css"
import { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
import type { LangParams } from "@/types/params"
export default async function CurrentBenefitsBlock({
title,
subtitle,
link,
}: AccountPageComponentProps) {
lang,
}: AccountPageComponentProps & LangParams) {
const user = await serverClient().user.get()
const { formatMessage } = await getIntl()
// TODO: level should be fetched from the `user` object once available
// TAKE NOTE: we need clarification on how benefits stack from different levels
// in order to determine if a benefit is specific to a level or if it is a cumulative benefit
// we might have to add a new boolean property "exclusive" or similar
const userLevel = 1
if (!user) {
return null
}
const membership = getMembership(user.memberships)
if (!membership) {
// TODO: handle this case?
return null
}
const currentLevel = Array.of(...Array(3).keys())
const currentLevel = getMembershipLevelObject(
user.memberships[0].membershipLevel as MembershipLevelEnum,
lang
)
if (!currentLevel) {
// TODO: handle this case?
return null
}
return (
<section className={styles.container}>
<Header title={title} link={link} subtitle={subtitle} />
<Grids.Scrollable>
{currentLevel.map((benefit) => (
<Link className={styles.card} href="#" key={benefit}>
{currentLevel.benefits.map((benefit, idx) => (
<Link className={styles.card} href="#" key={`${currentLevel}-${idx}`}>
<BiroScript
className={styles.script}
color="primaryLightOnSurfaceAccent"
type="two"
>
{formatMessage({ id: "As our Close Friend" })}
{formatMessage({ id: "As our" })} {currentLevel.name}
</BiroScript>
<Title as="h5" level="h3" textAlign="center">
{formatMessage({
id: "Free soft drink voucher for the kids when staying",
})}
{benefit.title}
</Title>
</Link>
))}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltylevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltylevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltylevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltylevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltylevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltylevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltylevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltylevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltylevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltylevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltylevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltylevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltylevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltylevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltylevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltylevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltylevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltylevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltylevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltylevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltylevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltylevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltylevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltylevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltylevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltylevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltylevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltylevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltylevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltylevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -1,7 +1,7 @@
{
"levels": [
{
"tier": 1,
"level": 1,
"name": "New Friend",
"requiredPoints": 0,
"requiredNights": 0,
@@ -9,21 +9,21 @@
{
"title": "Friendly room rates",
"value": "Friendly room rates",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "10% off on food on weekends",
"value": "10% off",
"explaination": "on food on weekends",
"explanation": "on food on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
},
{
"title": "Free kids mocktail during stay",
"value": "Free kids mocktail",
"explaination": "during stay",
"explanation": "during stay",
"description": "",
"href": ""
}
@@ -31,7 +31,7 @@
"icon": "/_static/icons/loyaltylevels/new-friend.svg"
},
{
"tier": 2,
"level": 2,
"name": "Good Friend",
"requiredPoints": 5000,
"requiredNights": 0,
@@ -39,7 +39,7 @@
{
"title": "15% on food on weekends",
"value": "15% on food",
"explaination": "on weekends",
"explanation": "on weekends",
"description": "Go ahead use your friendly discount to grab a bite during weekends.",
"href": ""
}
@@ -47,7 +47,7 @@
"icon": "/_static/icons/loyaltylevels/good-friend.svg"
},
{
"tier": 3,
"level": 3,
"name": "Close Friend",
"requiredPoints": 10000,
"requiredNights": 0,
@@ -55,14 +55,14 @@
{
"title": "Late checkout - 1 hour when available",
"value": "Late checkout",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "50 SEK voucher",
"value": "50 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -70,7 +70,7 @@
"icon": "/_static/icons/loyaltylevels/close-friend.svg"
},
{
"tier": 4,
"level": 4,
"name": "Dear Friend",
"requiredPoints": 25000,
"requiredNights": 0,
@@ -78,21 +78,21 @@
{
"title": "25% earn rate",
"value": "25% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Early check-in - 1 hour when available",
"value": "Early check-in",
"explaination": "- 1 hour when available",
"explanation": "- 1 hour when available",
"description": "",
"href": ""
},
{
"title": "75 SEK voucher",
"value": "75 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
}
@@ -100,7 +100,7 @@
"icon": "/_static/icons/loyaltylevels/dear-friend.svg"
},
{
"tier": 5,
"level": 5,
"name": "Loyal Friend",
"requiredPoints": 100000,
"requiredNights": 0,
@@ -108,21 +108,21 @@
{
"title": "Free room upgrade when available",
"value": "Free room upgrade",
"explaination": "when available",
"explanation": "when available",
"description": "",
"href": ""
},
{
"title": "100 SEK voucher",
"value": "100 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "2-for-1 breakfast",
"value": "2-for-1 breakfast",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}
@@ -130,7 +130,7 @@
"icon": "/_static/icons/loyaltylevels/loyal-friend.svg"
},
{
"tier": 6,
"level": 6,
"name": "True Friend",
"requiredPoints": 250000,
"requiredNights": 0,
@@ -138,28 +138,28 @@
{
"title": "50% earn rate",
"value": "50% earn rate",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "150 SEK voucher",
"value": "150 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "48h room guarantee",
"value": "48h room guarantee",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Always free breakfast",
"value": "Always free breakfast",
"explaination": "Always free breakfast",
"explanation": "Always free breakfast",
"description": "",
"href": ""
}
@@ -167,7 +167,7 @@
"icon": "/_static/icons/loyaltylevels/true-friend.svg"
},
{
"tier": 7,
"level": 7,
"name": "Best Friend",
"requiredPoints": 400000,
"requiredNights": 100,
@@ -175,21 +175,21 @@
{
"title": "200 SEK voucher",
"value": "200 SEK voucher",
"explaination": "",
"explanation": "",
"description": "Yeah, thats right: for each friendship point-boosting night, you get a voucher to redeem when you dine or drink at our restaurants and bars.",
"href": ""
},
{
"title": "Yearly exclusive gift",
"value": "Yearly exclusive gift",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
},
{
"title": "Kid's boost",
"value": "Kid's boost",
"explaination": "",
"explanation": "",
"description": "",
"href": ""
}

View File

@@ -0,0 +1,36 @@
import { membershipLevels } from "@/constants/membershipLevels"
import {
BestFriend,
CloseFriend,
DearFriend,
GoodFriend,
LoyalFriend,
NewFriend,
TrueFriend,
} from "@/components/Levels"
import styles from "./membershipLevel.module.css"
import type { MembershipLevelProps } from "@/types/components/myPages/membershipLevel"
export default function MembershipLevel({ level }: MembershipLevelProps) {
switch (level) {
case membershipLevels.L1:
return <NewFriend className={styles.level} color="pale" />
case membershipLevels.L2:
return <GoodFriend className={styles.level} color="pale" />
case membershipLevels.L3:
return <CloseFriend className={styles.level} color="pale" />
case membershipLevels.L4:
return <DearFriend className={styles.level} color="pale" />
case membershipLevels.L5:
return <LoyalFriend className={styles.level} color="pale" />
case membershipLevels.L6:
return <TrueFriend className={styles.level} color="pale" />
case membershipLevels.L7:
return <BestFriend className={styles.level} color="pale" />
default:
return null
}
}

View File

@@ -0,0 +1,4 @@
.level {
height: 105px;
width: 219px;
}

View File

@@ -16,11 +16,6 @@
transform: rotate(-13deg) translate(0px, -15px);
}
.level {
height: 105px;
width: 219px;
}
.name {
text-align: center;
}

View File

@@ -1,9 +1,12 @@
import { GoodFriend } from "@/components/Levels"
import { membershipLevels } from "@/constants/membershipLevels"
import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import { getMembership } from "@/utils/user"
import MembershipLevel from "./MemberShipLevel"
import styles from "./friend.module.css"
import type { UserProps } from "@/types/components/myPages/user"
@@ -11,13 +14,21 @@ import type { UserProps } from "@/types/components/myPages/user"
export default async function Friend({ user }: UserProps) {
const { formatMessage } = await getIntl()
const membership = getMembership(user.memberships)
if (!membership?.membershipLevel) {
return null
}
return (
<section className={styles.friend}>
<header className={styles.header}>
<BiroScript className={styles.levelLabel} color="pale">
{formatMessage({ id: "Current level" })}:
</BiroScript>
<GoodFriend className={styles.level} color="pale" />
{membership ? (
<MembershipLevel
level={membershipLevels[membership.membershipLevel]}
/>
) : null}
</header>
<div className={styles.membership}>
<Title className={styles.name} color="pale" level="h3">

View File

@@ -2,18 +2,40 @@ import BiroScript from "@/components/TempDesignSystem/Text/BiroScript"
import Body from "@/components/TempDesignSystem/Text/Body"
import Title from "@/components/TempDesignSystem/Text/Title"
import { getIntl } from "@/i18n"
import { getMembershipLevelObject } from "@/utils/membershipLevel"
import { getMembership } from "@/utils/user"
import styles from "./nextLevel.module.css"
import type { UserProps } from "@/types/components/myPages/user"
import type { LangParams } from "@/types/params"
export default async function NextLevel({}: UserProps) {
export default async function NextLevel({
user,
lang,
}: UserProps & LangParams) {
const { formatMessage } = await getIntl()
const membership = getMembership(user.memberships)
if (!membership?.membershipLevel) {
// TODO: handle this case?
return null
}
const nextLevel = getMembershipLevelObject(
membership.membershipLevel,
lang,
"nextLevel"
)
if (!nextLevel) {
// TODO: already at top level, no next level exists
return null
}
return (
<section>
<Body color="pale">{formatMessage({ id: "Next level" })}:</Body>
<Title className={styles.nextLevel} color="pale" level="h3">
N/A
{nextLevel?.name || "N/A"}
<BiroScript>{formatMessage({ id: "Coming up" })}!</BiroScript>
</Title>
</section>

View File

@@ -14,15 +14,16 @@ export default async function Points({ user }: UserProps) {
<section className={styles.points}>
<article>
<Body color="pale">{formatMessage({ id: "Total Points" })}</Body>
<Title color="pale" hideEmpty={false} level="h2">
<Title color="pale" level="h2">
{membership ? membership.currentPoints : "N/A"}
</Title>
</article>
<article>
<Body color="pale">
{formatMessage({ id: "Points until next level" })}
{/* TODO */}
</Body>
<Title color="pale" hideEmpty={false} level="h2">
<Title color="pale" level="h2">
{membership ? membership.currentPoints : "N/A"}
</Title>
</article>

View File

@@ -6,13 +6,14 @@ import Points from "./Points"
import styles from "./stats.module.css"
import type { UserProps } from "@/types/components/myPages/user"
import type { LangParams } from "@/types/params"
export default function Stats({ user }: UserProps) {
export default function Stats({ user, lang }: UserProps & LangParams) {
return (
<section className={styles.stats}>
<Points user={user} />
<Divider variant="default" />
<NextLevel user={user} />
<NextLevel user={user} lang={lang} />
</section>
)
}

View File

@@ -9,12 +9,14 @@ import Stats from "./Stats"
import styles from "./overview.module.css"
import type { AccountPageComponentProps } from "@/types/components/myPages/myPage/accountPage"
import type { LangParams } from "@/types/params"
export default async function Overview({
link,
subtitle,
title,
}: AccountPageComponentProps) {
lang,
}: AccountPageComponentProps & LangParams) {
const user = await serverClient().user.get()
if (!user) {
return null
@@ -25,7 +27,7 @@ export default async function Overview({
<section className={styles.overview}>
<Friend user={user} />
<Divider className={styles.divider} />
<Stats user={user} />
<Stats user={user} lang={lang} />
</section>
</section>
)

View File

@@ -12,7 +12,6 @@ async function CurrentPointsBalance({
title,
subtitle,
link,
lang,
}: AccountPageComponentProps) {
const user = await serverClient().user.get()
const { formatMessage } = await getIntl()
@@ -23,11 +22,10 @@ async function CurrentPointsBalance({
return (
<div>
<Header title={title} link={link} subtitle={subtitle} />
<div className={styles.card}>
<h2>{`${formatMessage({ id: "Total Points" })}*`}</h2>
<p className={styles.points}>
{`${formatMessage({ id: "Points" })}: ${membership?.currentPoints || "N/A"}`}
{`${formatMessage({ id: "Points" })}: ${membership ? membership.currentPoints : "N/A"}`}
</p>
<p className={styles.disclaimer}>
{`*${formatMessage({ id: "Points may take up to 10 days to be displayed." })}`}

View File

@@ -9,12 +9,11 @@ export default function Subtitle({
asChild = false,
className = "",
color,
hideEmpty = true,
textAlign,
textTransform,
...props
}: SubtitleProps) {
if (hideEmpty && Children.count(props.children) === 0) {
if (Children.toArray(props.children).length === 0) {
return null
}
const Comp = asChild ? Slot : "p"

View File

@@ -6,5 +6,4 @@ export interface SubtitleProps
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
VariantProps<typeof subtitleVariants> {
asChild?: boolean
hideEmpty?: boolean
}

View File

@@ -9,12 +9,11 @@ export default function Title({
children,
className = "",
color,
hideEmpty = true,
level = "h1",
textAlign,
textTransform,
}: HeadingProps) {
if (hideEmpty && Children.count(children) === 0) {
if (Children.toArray(children).length === 0) {
return null
}
const Hx = level

View File

@@ -8,6 +8,5 @@ export interface HeadingProps
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
VariantProps<typeof headingVariants> {
as?: HeadingLevel
hideEmpty?: boolean
level?: HeadingLevel
}

View File

@@ -7,3 +7,13 @@ export enum membershipLevels {
L6 = 6,
L7 = 7,
}
export enum MembershipLevelEnum {
L1 = "L1",
L2 = "L2",
L3 = "L3",
L4 = "L4",
L5 = "L5",
L6 = "L6",
L7 = "L7",
}

View File

@@ -1,13 +1,13 @@
import { z } from "zod"
import { membershipLevels } from "@/constants/membershipLevels"
import { MembershipLevelEnum } from "@/constants/membershipLevels"
import { countriesMap } from "@/components/TempDesignSystem/Form/Country/countries"
export const getUserSchema = z.object({
address: z.object({
city: z.string().optional(),
country: z.nativeEnum(countriesMap).optional(),
countryCode: z.nativeEnum(countriesMap).optional(),
streetAddress: z.string().optional(),
zipCode: z.string(),
}),
@@ -21,9 +21,7 @@ export const getUserSchema = z.object({
currentPoints: z.number(),
expirationDate: z.string(),
membershipNumber: z.string(),
membershipLevel: z
.enum(["L1", "L2", "L3", "L4", "L5", "L6", "L7"])
.optional(),
membershipLevel: z.nativeEnum(MembershipLevelEnum).optional(),
memberSince: z.string(),
membershipType: z.string(),
})

View File

@@ -40,7 +40,7 @@ export type OverviewTableTitleProps = { texts: OverviewTableTitleTranslation[] }
export type OverviewTableProps = { user: User | null }
export type Level = {
tier: membershipLevels
level: membershipLevels
name: string
requiredPoints: number
requiredNights?: number

View File

@@ -0,0 +1,5 @@
import { membershipLevels } from "@/constants/membershipLevels"
export type MembershipLevelProps = {
level: membershipLevels
}

20
utils/membershipLevel.ts Normal file
View File

@@ -0,0 +1,20 @@
import { Lang } from "@/constants/languages"
import {
MembershipLevelEnum,
membershipLevels,
} from "@/constants/membershipLevels"
import levelsData from "@/components/Loyalty/Blocks/DynamicContent/LoyaltyLevels/data"
export function getMembershipLevelObject(
membershipLevel: MembershipLevelEnum,
lang: Lang,
level: "currentLevel" | "nextLevel" = "currentLevel"
) {
let levelNumber = membershipLevels[membershipLevel]
if (level === "nextLevel") {
levelNumber += 1
}
return levelsData[lang].levels.find((level) => level.level === levelNumber)
}

View File

@@ -2,6 +2,7 @@ import { User } from "@/types/user"
export function getMembership(memberships: User["memberships"]) {
return memberships?.find(
(membership) => membership.membershipType.toLowerCase() === "guestpr"
(membership) =>
membership.membershipType.toLowerCase() === "guestpr" || "scandicfriend's"
)
}