Fix boursecu asset info modals with per-product copper breakdown.
Show total product wallet sum alongside the clicked product inventory in readable multi-line modals on mobile and desktop. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { computed, inject, onMounted, onUnmounted, provide, ref, type InjectionKey } from 'vue'
|
||||
import { computed, h, inject, onMounted, onUnmounted, provide, ref, type InjectionKey } from 'vue'
|
||||
import router from '@/router'
|
||||
import { loading, removeToken } from '@/utils'
|
||||
import { useUserStore } from '@/store/userStore'
|
||||
@@ -41,7 +41,12 @@ export interface HomePageContext {
|
||||
setChartMetal: (metal: ChartMetalType) => void
|
||||
isBoursecuHomeLayout: ReturnType<typeof computed<boolean>>
|
||||
handleBannerClick: (banner: { typeClick?: string; modalText?: string; link?: string }) => void
|
||||
openGoldModal: (metal: WalletMetalTotal, modalText?: string) => void
|
||||
openGoldModal: (
|
||||
metal: WalletMetalTotal,
|
||||
modalText?: string,
|
||||
modalTitle?: string,
|
||||
modalContent?: string
|
||||
) => void
|
||||
openRialModal: () => void
|
||||
}
|
||||
|
||||
@@ -147,8 +152,32 @@ export function useHomePage() {
|
||||
window.location.reload()
|
||||
}
|
||||
|
||||
function openGoldModal(metal: WalletMetalTotal, modalText?: string) {
|
||||
function renderModalLines(text?: string) {
|
||||
if (!text) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return h(
|
||||
'div',
|
||||
{ style: { lineHeight: '1.9' } },
|
||||
text.split('\n').map((line, index) =>
|
||||
h(
|
||||
'div',
|
||||
{ key: index, style: index > 0 ? { marginTop: '6px' } : undefined },
|
||||
line
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
function openGoldModal(
|
||||
metal: WalletMetalTotal,
|
||||
modalText?: string,
|
||||
modalTitle?: string,
|
||||
modalContent?: string
|
||||
) {
|
||||
const title =
|
||||
modalTitle ??
|
||||
modalText ??
|
||||
(isBoursecuHomeLayout.value
|
||||
? formatBoursecuMetalModalText(metal)
|
||||
@@ -156,6 +185,7 @@ export function useHomePage() {
|
||||
|
||||
Modal.confirm({
|
||||
title,
|
||||
content: renderModalLines(modalContent),
|
||||
okText: 'متوجه شدم',
|
||||
centered: true,
|
||||
cancelButtonProps: { style: { display: 'none' } },
|
||||
@@ -168,7 +198,7 @@ export function useHomePage() {
|
||||
const metalRial = resolveAssetsRialValue(summary, getTradeBuyPrice(lastPrice.value))
|
||||
Modal.confirm({
|
||||
title: 'دارایی ریالی',
|
||||
content: formatRialAssetsInfoText(cash, metalRial),
|
||||
content: renderModalLines(formatRialAssetsInfoText(cash, metalRial)),
|
||||
okText: 'متوجه شدم',
|
||||
centered: true,
|
||||
cancelButtonProps: { style: { display: 'none' } },
|
||||
|
||||
Reference in New Issue
Block a user