Unify store-closed messaging when the market is closed or has no quote.

Treat missing quotes as closed across home and products, show only the admin closed_message as hint, and block trading with consistent notices.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-11 12:42:56 +02:00
co-authored by Cursor
parent 1000df5931
commit 0109f3a744
12 changed files with 99 additions and 82 deletions
@@ -13,7 +13,7 @@
/>
</div>
<div class="status-box__title">{{ statusTitle }}</div>
<div class="status-box__hint">{{ statusHint }}</div>
<div v-if="statusHint" class="status-box__hint">{{ statusHint }}</div>
</div>
</template>
@@ -55,8 +55,9 @@ import { useUserStore } from '@/store/userStore'
import { getTradeBuyPrice, lastPrice, percentPriceChanged, price } from '@/utils/price'
import {
NO_QUOTE_MESSAGE,
STORE_CLOSED_TITLE,
getPriceDisplayState,
getStoreClosedMessage,
getStoreClosedHint,
} from '@/utils/storeHours'
import Vue3Odometer from 'vue3-odometer'
import 'odometer/themes/odometer-theme-default.css'
@@ -67,16 +68,12 @@ const userStore = useUserStore()
const displayState = computed(() => getPriceDisplayState())
const statusTitle = computed(() =>
displayState.value === 'closed' ? 'فروشگاه بسته است' : NO_QUOTE_MESSAGE
displayState.value === 'closed' ? STORE_CLOSED_TITLE : NO_QUOTE_MESSAGE
)
const statusHint = computed(() => {
if (displayState.value === 'closed') {
const custom = userStore.getValueByKey('closed_message')
if (typeof custom === 'string' && custom.trim()) {
return custom.replace(/<[^>]*>/g, '').trim()
}
return getStoreClosedMessage()
return getStoreClosedHint(userStore.getValueByKey('closed_message'))
}
return 'در حال حاضر مظنه‌ای برای نمایش وجود ندارد.'
})
@@ -12,7 +12,7 @@ import {
} from '@/utils/productAssets'
import { useSettingsStore } from '@/store/settingsStore'
import { getTradeBuyPrice, lastPrice, stopLastPricePolling } from '@/utils/price'
import { getStoreClosedMessage, isStoreClosed } from '@/utils/storeHours'
import { isStoreClosed } from '@/utils/storeHours'
import { message, Modal } from 'ant-design-vue'
import { useBanners } from './useBanners'
import { usePriceChart, type ChartMetalType } from './usePriceChart'
@@ -74,7 +74,7 @@ export function useHomePage() {
const closedMessage = computed(() => userStore.getValueByKey('closed_message'))
const marketClosedText = computed(() => {
if (!isStoreClosed()) return ''
// فقط پیام سفارشی ادمین رو نشون بده — پیام ساعت کاری در CurrentPrice نمایش داده میشه
// فقط پیام سفارشی ادمین — در CurrentPrice نمایش داده می‌شود
const custom = typeof closedMessage.value === 'string' ? closedMessage.value.trim() : ''
return custom || ''
})
@@ -16,7 +16,7 @@
/>
</div>
<p class="dhome-hero-price__closed-title">{{ statusTitle }}</p>
<p class="dhome-hero-price__closed-hint">{{ statusHint }}</p>
<p v-if="statusHint" class="dhome-hero-price__closed-hint">{{ statusHint }}</p>
</div>
</template>
@@ -55,8 +55,9 @@ import { useUserStore } from '@/store/userStore'
import { getTradeBuyPrice, lastPrice, percentPriceChanged } from '@/utils/price'
import {
NO_QUOTE_MESSAGE,
STORE_CLOSED_TITLE,
getPriceDisplayState,
getStoreClosedMessage,
getStoreClosedHint,
} from '@/utils/storeHours'
import { formatSignedPercentChange } from '@/utils/usePrice'
@@ -65,16 +66,12 @@ const userStore = useUserStore()
const displayState = computed(() => getPriceDisplayState())
const statusTitle = computed(() =>
displayState.value === 'closed' ? 'فروشگاه بسته است' : NO_QUOTE_MESSAGE
displayState.value === 'closed' ? STORE_CLOSED_TITLE : NO_QUOTE_MESSAGE
)
const statusHint = computed(() => {
if (displayState.value === 'closed') {
const custom = userStore.getValueByKey('closed_message')
if (typeof custom === 'string' && custom.trim()) {
return custom.replace(/<[^>]*>/g, '').trim()
}
return getStoreClosedMessage()
return getStoreClosedHint(userStore.getValueByKey('closed_message'))
}
return 'در حال حاضر مظنه‌ای برای نمایش وجود ندارد.'
})