mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 22:55:51 -05:00
e61eb1b220
Improve calculations of empty state, mini state and sizes variables in review panel GitOrigin-RevId: 41bcb3b67c9f0019c11b4de0e4590b0407e04e66
25 lines
574 B
TypeScript
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
|
|
}
|