Polish boursecu UX: branding logos, home price stats, assets, and desktop footer.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 10:32:10 +03:30
co-authored by Cursor
parent 033e31e7a9
commit 31caa8cca7
29 changed files with 384 additions and 197 deletions
+36 -5
View File
@@ -1,5 +1,5 @@
import { toPersianDigits } from '@/utils/persianDigits'
import type { Product } from '@/models/products'
import { usePriceWithoutType } from '@/utils/usePrice'
import type { UserWalletLine } from '@/models/wallet'
import type { ProductFile } from '@/utils/file'
import type { WalletInventoryCard, WalletMetalTotal } from '@/models/walletAssets'
@@ -87,7 +87,7 @@ export function resolveMetalAssetsDisplayLabel(
case METAL_COPPER:
return 'دارایی مس'
case METAL_GOLD:
return 'دارایی طلایی'
return 'دارایی شمش مس'
case METAL_SILVER:
return 'دارایی نقره'
default:
@@ -103,16 +103,44 @@ export interface HomeAssetRow {
value: string
metal?: WalletMetalTotal
info: HomeAssetRowInfo
/** boursecu — متن مودال توضیحات (info) */
modalText?: string
}
function formatInventoryCardProductLabel(card: WalletInventoryCard): string {
return `دارایی ${card.title}`
}
function formatBoursecuProductModalText(card: WalletInventoryCard): string {
return `${formatInventoryCardProductLabel(card)} = موجودی ${card.title}`
}
/** boursecu — متن مودال برای ردیف‌های metal_totals */
export function formatBoursecuMetalModalText(metal: WalletMetalTotal): string {
switch (metal.metal_id) {
case METAL_COPPER:
return 'مجموع دارایی مس = جمع کاتد و مفتول و شمش'
case METAL_GOLD:
return 'دارایی شمش مس = موجودی شمش مس'
case METAL_SILVER:
return 'دارایی نقره = موجودی نقره'
default:
return `${resolveMetalAssetsDisplayLabel(metal, true)} = موجودی ${metal.label}`
}
}
function findMetalTotalById(metalTotals: WalletMetalTotal[], metalId: number) {
return metalTotals.find((metal) => metal.metal_id === metalId)
}
function formatBoursecuMetalRowValue(metal: WalletMetalTotal): string {
const amount = usePriceWithoutType(Number(metal.total_weight ?? 0), false)
if (metal.metal_id === METAL_GOLD) {
return `${amount} عدد`
}
return `${amount}${metal.unit ?? ''}`
}
/** boursecu home — هر محصول / فلز / ریال از customer/wallet/assets جدا نمایش داده می‌شود */
export function buildBoursecuHomeAssetRows(
summary: {
@@ -142,6 +170,7 @@ export function buildBoursecuHomeAssetRows(
value: formatInventoryCardValue(card),
metal: findMetalTotalById(metalTotals, card.metal_id),
info: 'metal',
modalText: formatBoursecuProductModalText(card),
})
}
@@ -153,9 +182,10 @@ export function buildBoursecuHomeAssetRows(
rows.push({
id: `metal-${metal.metal_id}`,
label: resolveMetalAssetsDisplayLabel(metal, true),
value: `${Number(metal.total_weight ?? 0)}${metal.unit ?? ''}`,
value: formatBoursecuMetalRowValue(metal),
metal,
info: 'metal',
modalText: formatBoursecuMetalModalText(metal),
})
}
@@ -166,6 +196,7 @@ export function buildBoursecuHomeAssetRows(
value: formatInventoryCardValue(card),
metal: findMetalTotalById(metalTotals, card.metal_id),
info: 'metal',
modalText: formatBoursecuProductModalText(card),
})
}
@@ -223,7 +254,7 @@ export function formatMetalAssetsInfoText(metal: WalletMetalTotal): string {
}
function formatRialNumber(value: number): string {
return Math.round(value).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
return usePriceWithoutType(Math.round(value))
}
/** متن توضیح مودال دارایی ریالی */
@@ -276,7 +307,7 @@ export function formatInventoryCardValue(card: {
}): string {
const quantity = Number(card.quantity ?? 0)
const unit = card.unit ?? (card.display_type === 'count' ? 'عدد' : 'گرم')
return `${quantity} ${unit}`
return `${usePriceWithoutType(quantity, false)} ${unit}`
}
export function findProductInventoryCard(