diff --git a/src/api/finance-api.ts b/src/api/finance-api.ts
index 7c54f68..f21466b 100644
--- a/src/api/finance-api.ts
+++ b/src/api/finance-api.ts
@@ -266,6 +266,7 @@ function normalizeFinanceOrderItem(dto: FinanceOrderItemDto) {
amount: String(dto.amount ?? ''),
bonusAmount: String(dto.bonus_amount ?? ''),
orderNo: dto.order_no,
+ status: String(dto.status ?? ''),
}
}
diff --git a/src/features/game/components/desktop/desktop-topup.tsx b/src/features/game/components/desktop/desktop-topup.tsx
index ecd9022..d023d83 100644
--- a/src/features/game/components/desktop/desktop-topup.tsx
+++ b/src/features/game/components/desktop/desktop-topup.tsx
@@ -334,7 +334,7 @@ function DesktopTopup() {
{tier.title}
- {formatNumber(tier.payAmount)}
+ {formatNumber(tier.amount)}
diff --git a/src/features/game/components/mobile/mobile-topup.tsx b/src/features/game/components/mobile/mobile-topup.tsx
index 270a11b..0eedf5b 100644
--- a/src/features/game/components/mobile/mobile-topup.tsx
+++ b/src/features/game/components/mobile/mobile-topup.tsx
@@ -334,7 +334,7 @@ function MobileTopup() {
{tier.title}
- {formatNumber(tier.payAmount)}
+ {formatNumber(tier.amount)}
diff --git a/src/hooks/use-finance-records-vm.ts b/src/hooks/use-finance-records-vm.ts
index edab0d1..59a6d7e 100644
--- a/src/hooks/use-finance-records-vm.ts
+++ b/src/hooks/use-finance-records-vm.ts
@@ -31,6 +31,31 @@ function formatFinanceAmount(value: string, locale: string) {
}).format(numberValue)
}
+function getFinanceStatusTone(status: string) {
+ if (status === 'approved') {
+ return 'approved'
+ }
+
+ if (status === 'rejected' || status === 'failed') {
+ return 'rejected'
+ }
+
+ return 'pending'
+}
+
+function getFinanceStatusLabel(status: string, t: (key: string) => string) {
+ if (
+ status === 'pending_review' ||
+ status === 'approved' ||
+ status === 'rejected' ||
+ status === 'failed'
+ ) {
+ return t(`game.modals.userInfo.financeRecords.statuses.${status}`)
+ }
+
+ return '--'
+}
+
export function useFinanceRecordsVm({ enabled }: { enabled: boolean }) {
const { i18n, t } = useTranslation()
const locale = i18n.resolvedLanguage ?? i18n.language ?? 'en-US'
@@ -80,9 +105,11 @@ export function useFinanceRecordsVm({ enabled }: { enabled: boolean }) {
bonusAmountLabel: formatFinanceAmount(item.bonusAmount, locale),
id: item.orderNo || `${page.pagination.page}-${index}`,
orderNoLabel: item.orderNo || '--',
+ statusLabel: getFinanceStatusLabel(item.status, t),
+ statusTone: getFinanceStatusTone(item.status),
})),
),
- [locale, query.data?.pages],
+ [locale, query.data?.pages, t],
)
const selectRecordType = useCallback((type: FinanceRecordType) => {
@@ -103,6 +130,7 @@ export function useFinanceRecordsVm({ enabled }: { enabled: boolean }) {
amount: t('game.modals.userInfo.financeRecords.amount'),
bonusAmount: t('game.modals.userInfo.financeRecords.bonusAmount'),
orderNo: t('game.modals.userInfo.financeRecords.orderNo'),
+ status: t('game.modals.userInfo.financeRecords.status'),
},
isError: query.isError,
isFetchingNextPage: query.isFetchingNextPage,
diff --git a/src/hooks/use-withdraw-vm.ts b/src/hooks/use-withdraw-vm.ts
index f0e0ec8..0df18b0 100644
--- a/src/hooks/use-withdraw-vm.ts
+++ b/src/hooks/use-withdraw-vm.ts
@@ -16,7 +16,7 @@ function formatNumber(locale: string, value: number) {
}
function getInitialWithdrawAmount(
- selectedRate: number,
+ selectedExchangeRate: number,
maxWithdrawAmount: number,
) {
if (maxWithdrawAmount <= 0) {
@@ -25,10 +25,22 @@ function getInitialWithdrawAmount(
return Math.min(
maxWithdrawAmount,
- Math.max(1, Math.round(selectedRate * QUICK_FIAT_AMOUNTS[0])),
+ Math.max(1, Math.round(QUICK_FIAT_AMOUNTS[0] / selectedExchangeRate)),
)
}
+function getCurrencyExchangeRate(
+ config: DepositWithdrawConfig,
+ currencyCode: string,
+ fallbackRate: number,
+) {
+ const configuredRate = config.rates.find(
+ (rate) => rate.currency === currencyCode,
+ )?.diamondsPerFiatUnitValue
+
+ return configuredRate && configuredRate > 0 ? configuredRate : fallbackRate
+}
+
function getActiveCurrencyCode(
currencies: DepositWithdrawConfig['currencies'],
selectedCurrencyCode: string,
@@ -108,9 +120,11 @@ export function useWithdrawVm() {
currencyCode,
)
const selectedRate = selectedCurrency.withdrawCoinsPerFiatValue || 1
- const selectedExchangeRate =
- config.rates.find((rate) => rate.currency === selectedCurrency.code)
- ?.diamondsPerFiatUnitValue || selectedRate
+ const selectedExchangeRate = getCurrencyExchangeRate(
+ config,
+ selectedCurrency.code,
+ selectedRate,
+ )
const sortedPayChannels = useMemo(
() =>
[
@@ -200,11 +214,13 @@ export function useWithdrawVm() {
}, [bankCode, sortedBanks])
useEffect(() => {
- if (!hasInitializedAmount && selectedRate > 0) {
- setAmount(getInitialWithdrawAmount(selectedRate, maxWithdrawAmount))
+ if (!hasInitializedAmount && selectedExchangeRate > 0) {
+ setAmount(
+ getInitialWithdrawAmount(selectedExchangeRate, maxWithdrawAmount),
+ )
setHasInitializedAmount(true)
}
- }, [hasInitializedAmount, maxWithdrawAmount, selectedRate, setAmount])
+ }, [hasInitializedAmount, maxWithdrawAmount, selectedExchangeRate, setAmount])
useEffect(() => {
if (amount > maxWithdrawAmount) {
@@ -216,12 +232,12 @@ export function useWithdrawVm() {
return QUICK_FIAT_AMOUNTS.map((fiatAmount) => ({
diamonds: Math.min(
maxWithdrawAmount,
- Math.max(1, Math.round(selectedRate * fiatAmount)),
+ Math.max(1, Math.round(fiatAmount / selectedExchangeRate)),
),
id: `quick-${selectedCurrency.code}-${fiatAmount}`,
preview: `${selectedCurrency.code} ${formatNumber(locale, fiatAmount)}`,
}))
- }, [locale, maxWithdrawAmount, selectedCurrency.code, selectedRate])
+ }, [locale, maxWithdrawAmount, selectedCurrency.code, selectedExchangeRate])
const resetForm = useCallback(() => {
const nextCurrencyCode = config.currencies[0]?.code ?? DEFAULT_CURRENCY_CODE
@@ -229,9 +245,15 @@ export function useWithdrawVm() {
config.currencies,
nextCurrencyCode,
)
- const nextRate = nextCurrency.withdrawCoinsPerFiatValue || 1
+ const nextExchangeRate = getCurrencyExchangeRate(
+ config,
+ nextCurrency.code,
+ nextCurrency.withdrawCoinsPerFiatValue || 1,
+ )
- setAmountState(getInitialWithdrawAmount(nextRate, maxWithdrawAmount))
+ setAmountState(
+ getInitialWithdrawAmount(nextExchangeRate, maxWithdrawAmount),
+ )
setHasInitializedAmount(true)
setCurrencyCode(nextCurrencyCode)
setPaymentChannelCode(sortedPayChannels[0]?.code ?? '')
@@ -240,7 +262,7 @@ export function useWithdrawVm() {
setBankAccount('')
setReceiverEmail('')
setReceiverPhone('')
- }, [config.currencies, maxWithdrawAmount, sortedPayChannels])
+ }, [config, maxWithdrawAmount, sortedPayChannels])
const selectedCurrencyPreview = useMemo(
() => ({
@@ -255,7 +277,7 @@ export function useWithdrawVm() {
}),
convertibleValue: `${formatNumber(
locale,
- selectedRate > 0 ? amount / selectedRate : 0,
+ selectedExchangeRate > 0 ? amount * selectedExchangeRate : 0,
)} ${selectedCurrency.code}`,
}),
[
@@ -264,7 +286,6 @@ export function useWithdrawVm() {
selectedCurrency.code,
selectedCurrency.label,
selectedExchangeRate,
- selectedRate,
t,
],
)
diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts
index cb28a86..fce8051 100644
--- a/src/locales/en-US.ts
+++ b/src/locales/en-US.ts
@@ -270,6 +270,13 @@ export default {
orderNo: 'Order No.',
amount: 'Amount',
bonusAmount: 'Bonus Amount',
+ status: 'Status',
+ statuses: {
+ pending_review: 'Pending Review',
+ approved: 'Approved',
+ rejected: 'Rejected',
+ failed: 'Failed',
+ },
loading: 'Loading records...',
loadFailed: 'Failed to load records. Please try again later.',
empty: 'No records yet',
diff --git a/src/locales/id-ID.ts b/src/locales/id-ID.ts
index c5c6573..e9f7135 100644
--- a/src/locales/id-ID.ts
+++ b/src/locales/id-ID.ts
@@ -269,6 +269,13 @@ export default {
orderNo: 'No. Pesanan',
amount: 'Jumlah',
bonusAmount: 'Jumlah Bonus',
+ status: 'Status',
+ statuses: {
+ pending_review: 'Menunggu Tinjauan',
+ approved: 'Disetujui',
+ rejected: 'Ditolak',
+ failed: 'Gagal',
+ },
loading: 'Memuat riwayat...',
loadFailed: 'Gagal memuat riwayat. Silakan coba lagi nanti.',
empty: 'Belum ada riwayat',
diff --git a/src/locales/ms-MY.ts b/src/locales/ms-MY.ts
index c297084..e5b6247 100644
--- a/src/locales/ms-MY.ts
+++ b/src/locales/ms-MY.ts
@@ -272,6 +272,13 @@ export default {
orderNo: 'No. Pesanan',
amount: 'Jumlah',
bonusAmount: 'Jumlah Bonus',
+ status: 'Status',
+ statuses: {
+ pending_review: 'Menunggu Semakan',
+ approved: 'Diluluskan',
+ rejected: 'Ditolak',
+ failed: 'Gagal',
+ },
loading: 'Memuatkan rekod...',
loadFailed: 'Gagal memuatkan rekod. Sila cuba lagi kemudian.',
empty: 'Belum ada rekod',
diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts
index 6fe1a3a..38c3139 100644
--- a/src/locales/zh-CN.ts
+++ b/src/locales/zh-CN.ts
@@ -264,6 +264,13 @@ export default {
orderNo: '订单号',
amount: '金额',
bonusAmount: '赠送金额',
+ status: '状态',
+ statuses: {
+ pending_review: '待审核',
+ approved: '通过',
+ rejected: '拒绝',
+ failed: '失败',
+ },
loading: '记录加载中...',
loadFailed: '记录加载失败,请稍后重试',
empty: '暂无记录',
diff --git a/src/modal/desktop/desktop-finance-records-tab.tsx b/src/modal/desktop/desktop-finance-records-tab.tsx
index 7a5e7c7..0222b0f 100644
--- a/src/modal/desktop/desktop-finance-records-tab.tsx
+++ b/src/modal/desktop/desktop-finance-records-tab.tsx
@@ -94,12 +94,13 @@ function DesktopFinanceRecordsTab({ enabled }: { enabled: boolean }) {
{vm.headers.orderNo}
{vm.headers.amount}
{vm.headers.bonusAmount}
+
{vm.headers.status}
{item.bonusAmountLabel}
+
+
+ {item.statusLabel}
+
+
) : (
-
-
+
+
{vm.headers.orderNo}
{vm.headers.amount}
{vm.headers.bonusAmount}
+
{vm.headers.status}
{item ? (
{item.bonusAmountLabel}
+
+
+
+ {item.statusLabel}
+
+
+
) : (