Feat/lokalise rebuild * chore(lokalise): update translation ids * chore(lokalise): easier to switch between projects * chore(lokalise): update translation ids * . * . * . * . * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * . * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * . * . * chore(lokalise): update translation ids * chore(lokalise): update translation ids * chore(lokalise): new translations * merge * switch to errors for missing id's * merge * sync translations Approved-by: Linus Flood
57 lines
1.7 KiB
TypeScript
57 lines
1.7 KiB
TypeScript
import { MembershipLevelEnum } from "@scandic-hotels/common/constants/membershipLevels"
|
|
import Body from "@scandic-hotels/design-system/Body"
|
|
import Title from "@scandic-hotels/design-system/Title"
|
|
|
|
import { membershipLevels } from "@/constants/membershipLevels"
|
|
|
|
import MembershipLevelIcon from "@/components/Levels/Icon"
|
|
import { getIntl } from "@/i18n"
|
|
import { isHighestMembership } from "@/utils/user"
|
|
|
|
import styles from "./friend.module.css"
|
|
|
|
import type { FriendProps } from "@/types/components/myPages/friend"
|
|
|
|
export default async function Friend({
|
|
children,
|
|
membership,
|
|
name,
|
|
}: FriendProps) {
|
|
const intl = await getIntl()
|
|
if (!membership?.membershipLevel) {
|
|
return null
|
|
}
|
|
const isHighestLevel = isHighestMembership(membership.membershipLevel)
|
|
|
|
const lvlMessageHighest = intl.formatMessage({
|
|
id: "overview.friend.highestLevel",
|
|
defaultMessage: "Highest level",
|
|
})
|
|
|
|
const lvlMessageLevel = intl.formatMessage(
|
|
{ id: "common.membershipLevelWithValue", defaultMessage: "Level {level}" },
|
|
{ level: membershipLevels[membership.membershipLevel] }
|
|
)
|
|
|
|
return (
|
|
<section className={styles.friend}>
|
|
<header className={styles.header}>
|
|
<Body color="white" textTransform="bold" textAlign="center">
|
|
{isHighestLevel ? lvlMessageHighest : lvlMessageLevel}
|
|
</Body>
|
|
<MembershipLevelIcon
|
|
level={MembershipLevelEnum[membership.membershipLevel]}
|
|
height="110"
|
|
width="220"
|
|
/>
|
|
</header>
|
|
<div className={styles.membership}>
|
|
<Title data-hj-suppress className={styles.name} color="pale" level="h3">
|
|
{name}
|
|
</Title>
|
|
{children}
|
|
</div>
|
|
</section>
|
|
)
|
|
}
|