|
@@ -1,7 +1,9 @@
|
|
|
import { CashbackTypes } from "@/api/cashback";
|
|
|
import { UserVipInfo } from "@/api/user";
|
|
|
import Box from "@/components/Box";
|
|
|
+import { percentage } from "@/utils/methods";
|
|
|
import { server } from "@/utils/server";
|
|
|
+import { getTranslations } from "next-intl/server";
|
|
|
import CashbackTable from "./CashbackTable";
|
|
|
import Progress from "./components/Progress";
|
|
|
import Week from "./Week";
|
|
@@ -14,7 +16,12 @@ const getVipInfoApi = async () => {
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.code === 200) return res.data;
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ vip_exp: 0,
|
|
|
+ vip_level: 0,
|
|
|
+ vip_next_level: 0,
|
|
|
+ vip_score_exp: 0,
|
|
|
+ };
|
|
|
});
|
|
|
};
|
|
|
|
|
@@ -34,6 +41,9 @@ const CashbackInfo = async () => {
|
|
|
|
|
|
const currentGrade = cashbackInfo.rules.find((item) => item.level === (vipInfo.vip_level || 1));
|
|
|
const maxGrade = cashbackInfo.rules.at(-1);
|
|
|
+
|
|
|
+ const t = await getTranslations();
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
<Box className={"w-full rounded-[10px] bg-gradient-to-b from-[#ffaa30] to-[#ffe6be]"}>
|
|
@@ -47,7 +57,9 @@ const CashbackInfo = async () => {
|
|
|
<span className={"mr-[0.06rem] text-[0.25rem] font-bold"}>
|
|
|
{currentGrade?.cashback}%
|
|
|
</span>
|
|
|
- <span className={"mr-[0.06rem] text-[0.25rem] font-bold"}>Cashback</span>
|
|
|
+ <span className={"mr-[0.06rem] text-[0.25rem] font-bold"}>
|
|
|
+ {t("cashback.cashbackTitle")}
|
|
|
+ </span>
|
|
|
<span className={"align-text-bottom text-[0.1rem] text-[#383838]"}>
|
|
|
Max {maxGrade?.cashback}%
|
|
|
</span>
|
|
@@ -60,14 +72,15 @@ const CashbackInfo = async () => {
|
|
|
" ml-[0.06rem] rounded-[0.03rem] text-[0.1rem]"
|
|
|
}
|
|
|
>
|
|
|
- v{vipInfo.vip_exp}
|
|
|
+ v{vipInfo.vip_level}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div className={"mt-[0.1rem]"}>
|
|
|
- <Progress num={vipInfo.vip_exp ?? 0} />
|
|
|
+ <Progress num={percentage(vipInfo?.vip_exp, vipInfo.vip_score_exp)} />
|
|
|
<div className={"font-lightl mt-[0.04rem] text-right text-[0.1rem]"}>
|
|
|
- {vipInfo.vip_level} Apostas to VIP{vipInfo.vip_next_level}
|
|
|
+ {t("ProfilePage.expTips", { exp: vipInfo.vip_score_exp - vipInfo.vip_exp })}
|
|
|
+ VIP{vipInfo.vip_next_level}
|
|
|
</div>
|
|
|
</div>
|
|
|
</Box>
|