This commit is contained in:
2026-08-22 21:50:39 +03:30
parent 444178df05
commit be59cca162
5 changed files with 215 additions and 43 deletions
+24 -2
View File
@@ -28,7 +28,7 @@ function productText(product: Product) {
function isShowOnTv(product: Product) {
const value = product.show_on_tv as unknown
return value === true || value === 1 || value === '1'
return value === true || value === 1 || value === '1' || value === 'true'
}
function isParsianCoin(product: Product) {
@@ -79,7 +79,13 @@ export function useTvMonitorPage() {
)
const brandLogo = computed(() => String(getConfigApp('avatar') || logoFallback))
const catalogProducts = computed(() => products.value.filter(isShowOnTv))
// API فقط show_on_tv می‌دهد؛ فیلتر کلاینت برای دادهٔ ناقص است
const catalogProducts = computed(() => {
const list = products.value
if (!list.length) return list
const marked = list.filter(isShowOnTv)
return marked.length ? marked : list
})
const parsianCoins = computed(() =>
catalogProducts.value
@@ -108,6 +114,20 @@ export function useTvMonitorPage() {
.sort((a, b) => Number(a.amount ?? 0) - Number(b.amount ?? 0)),
)
/** آبشده، شمش، … — هر چیزی غیر از سکه/سیمرغ */
const otherProducts = computed(() =>
catalogProducts.value.filter(
(p) => !isParsianCoin(p) && !isBankCoin(p) && !isSimorghBar(p),
),
)
const hasBoardContent = computed(
() =>
hasCoinBoard.value
|| otherProducts.value.length > 0
|| simorghBars.value.length > 0,
)
const statusBanner = computed(() => {
void lastPrice.value
const state = getPriceDisplayState()
@@ -263,7 +283,9 @@ export function useTvMonitorPage() {
parsianCoins,
bankCoins,
hasCoinBoard,
hasBoardContent,
coinRowCount,
otherProducts,
simorghBars,
statusBanner,
liveBuy,