mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-17 04:44:40 +08:00
25 lines
584 B
TypeScript
25 lines
584 B
TypeScript
export type AgentsPageView = 'roster' | 'live' | 'plans'
|
|
|
|
export function planAgentsPageLoads(options: {
|
|
view: AgentsPageView
|
|
isAdmin: boolean
|
|
}): {
|
|
loadRoster: boolean
|
|
loadAgentFormLookups: boolean
|
|
pollLiveBadge: boolean
|
|
} {
|
|
const isLiveView = options.view === 'live'
|
|
return {
|
|
loadRoster: !isLiveView,
|
|
loadAgentFormLookups: !isLiveView,
|
|
pollLiveBadge: options.isAdmin && !isLiveView,
|
|
}
|
|
}
|
|
|
|
export function shouldShowAgentsLiveBadge(options: {
|
|
view: AgentsPageView
|
|
running: number
|
|
}): boolean {
|
|
return options.view !== 'live' && options.running > 0
|
|
}
|