"use client" import { useIntl } from "react-intl" import { Progress } from "@scandic-hotels/design-system/Progress" import { Typography } from "@scandic-hotels/design-system/Typography" import styles from "./progressLevelCard.module.css" import type { ProgressLevelCardProps } from "../types" export default function ProgressLevelCard({ pointsEarned, pointsToNextLevel, pointsNeededToKeepLevel, }: ProgressLevelCardProps) { const intl = useIntl() // TODO: Awaiting proper UX/UI specs on missing point data scenarios. if ( typeof pointsEarned !== "number" || typeof pointsToNextLevel !== "number" ) { return null } const totalPointsForCurrentLevel = pointsEarned + pointsToNextLevel const progressPercentage = (pointsEarned / totalPointsForCurrentLevel) * 100 // Calculate marker position (minimum threshold to keep current level) const markerPosition = pointsNeededToKeepLevel ? ((pointsEarned + pointsNeededToKeepLevel) / totalPointsForCurrentLevel) * 100 : null return (