fix some bugs from chart
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { toJalali } from '@core/utils/useDataTime'
|
||||
|
||||
/** همتراز با CustomerPresenceService::ONLINE_THRESHOLD_SECONDS روی سرور */
|
||||
export const CUSTOMER_ONLINE_THRESHOLD_MS = 2 * 60 * 1000
|
||||
|
||||
@@ -16,3 +18,13 @@ export function getCustomerPresenceKind(
|
||||
export function isCustomerOnline(lastSeenAt: string | Date | null | undefined): boolean {
|
||||
return getCustomerPresenceKind(lastSeenAt) === 'online'
|
||||
}
|
||||
|
||||
/** متن وضعیت برای چت (بهجای «نامشخص») */
|
||||
export function formatCustomerPresenceLabel(
|
||||
lastSeenAt: string | Date | null | undefined
|
||||
): string {
|
||||
const kind = getCustomerPresenceKind(lastSeenAt)
|
||||
if (kind === 'online') return 'آنلاین'
|
||||
if (kind === 'never') return 'آفلاین'
|
||||
return lastSeenAt ? `آخرین بازدید ${toJalali(lastSeenAt as string)}` : 'آفلاین'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user