mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-28 20:00:10 +02:00

[web] Fix review panel check for comments in active document GitOrigin-RevId: fc0c35bc1d2f253c133dec5dcea7f81f68d723a9
26 lines
619 B
TypeScript
26 lines
619 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 comment of ranges.comments) {
|
|
const thread = threads[comment.op.t]
|
|
if (thread && !thread.resolved) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|