fix(trade): use stream closed and trade_open instead of device clock
Changing the phone time can no longer open a product that the server has closed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -24,6 +24,19 @@ export function isProductTradeOpen(product: TradeOpenProduct, isBuy: boolean) {
|
||||
return isBuy ? isProductBuyOpen(product) : isProductSellOpen(product)
|
||||
}
|
||||
|
||||
/** ساعت کاری محصول از استریم (trade_open) — نه ساعت دستگاه */
|
||||
export function isProductTradingHoursOpen(
|
||||
product?: { show?: boolean; trade_open?: boolean } | null,
|
||||
) {
|
||||
if (!product) return false
|
||||
if (typeof product.trade_open === 'boolean') return product.trade_open
|
||||
return product.show === true
|
||||
}
|
||||
|
||||
export function productHoursClosedMessage() {
|
||||
return 'این محصول در حال حاضر خارج از ساعت کاری است.'
|
||||
}
|
||||
|
||||
/** تب اولیه با توجه به query و وضعیت باز/بسته خرید و فروش */
|
||||
export function resolveProductTradeIsBuy(product: TradeOpenProduct, routeState?: string | null) {
|
||||
const wantSell = routeState === 'sell'
|
||||
|
||||
Reference in New Issue
Block a user