import { cn } from "@follow/utils/utils" import { useState } from "react" import { useI18n } from "~/hooks/common" export const BoostProgress = ({ level, boostCount, remainingBoostsToLevelUp, lastValidBoost, }: { level: number boostCount: number remainingBoostsToLevelUp: number lastValidBoost: { hash: string | null expiresAt: string } | null }) => { const [numberFormater] = useState(() => new Intl.NumberFormat()) const t = useI18n() const rawPercentage = (boostCount / (boostCount + remainingBoostsToLevelUp)) * 100 const percentage = Math.max(rawPercentage, 2) const nextLevel = level + 1 return (
{numberFormater.format(boostCount)}
Lv. {level} Lv. {nextLevel}
{t("boost.remaining_boosts_to_level_up", { remainingBoostsToLevelUp: numberFormater.format(remainingBoostsToLevelUp), })} {lastValidBoost && ( {t("boost.expired_description", { expiredDate: new Date(lastValidBoost.expiresAt), interpolation: { escapeValue: false }, })} )}
) }