Merge origin/modular into feature/responsive-layout-refactor.
Keep the responsive layout refactor while bringing in modular updates for support UI, pricing, categories, and config loading. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -335,17 +335,32 @@ export function getTotalMetalWeight(
|
||||
return Number(walletInfo?.treasure ?? walletInfo?.gold_sum ?? walletInfo?.count_gold ?? 0)
|
||||
}
|
||||
|
||||
/** فقط موجودی نقدی کیف اصلی — فیلد gold (مثل 0.3 کیلوگرم) جزو دارایی ریالی نیست */
|
||||
/** موجودی ریالی کیف اصلی — با main_wallet_products فیلد cash ممکن است کیف محصول باشد */
|
||||
export function getRialCashAmount(
|
||||
walletInfo?: Record<string, unknown> | null,
|
||||
wallets?: UserWalletLine[] | null
|
||||
): number {
|
||||
const aggregated = walletInfo?.count_cash_wallet ?? walletInfo?.count_cash
|
||||
if (aggregated != null && aggregated !== '') {
|
||||
const parsed = Number(aggregated)
|
||||
if (!Number.isNaN(parsed)) {
|
||||
return parsed
|
||||
}
|
||||
}
|
||||
|
||||
const mainCash = getMainWalletCash(wallets)
|
||||
if (mainCash > 0) {
|
||||
return mainCash
|
||||
}
|
||||
|
||||
return Number(walletInfo?.count_cash ?? walletInfo?.cash ?? 0)
|
||||
return Number(walletInfo?.cash ?? 0)
|
||||
}
|
||||
|
||||
export function getCashWalletBalance(
|
||||
walletInfo?: Record<string, unknown> | null,
|
||||
wallets?: UserWalletLine[] | null
|
||||
): number {
|
||||
return getRialCashAmount(walletInfo, wallets)
|
||||
}
|
||||
|
||||
export function getTotalRialEquivalent(walletInfo?: Record<string, unknown> | null): number {
|
||||
|
||||
Reference in New Issue
Block a user