overleaf/services/web/frontend/js/features/review-panel-new/utils/has-active-range.ts
Alf Eaton e61eb1b220 Merge pull request #20008 from overleaf/ae-review-panel-empty-state
Improve calculations of empty state, mini state and sizes variables in review panel

GitOrigin-RevId: 41bcb3b67c9f0019c11b4de0e4590b0407e04e66
2024-08-22 14:01:16 +00:00

25 lines
574 B
TypeScript

import { Ranges } from '@/features/review-panel-new/context/ranges-context'
import { Threads } from '@/features/review-panel-new/context/threads-context'
export const hasActiveRange = (
ranges: Ranges | undefined,
threads: Threads | undefined
): boolean | undefined => {
if (!ranges || !threads) {
// data isn't loaded yet
return undefined
}
if (ranges.changes.length > 0) {
// at least one tracked change
return true
}
for (const thread of Object.values(threads)) {
if (!thread.resolved) {
return true
}
}
return false
}