feat(ui): confine read-only users to the transcription read view (#697)

On the document detail page, pass canEdit={canWrite} to the panel header,
guard onModeChange so a reader can never flip to edit, and default panelMode
to 'read' for readers. Thread canAnnotate={canWrite} through DocumentViewer
to PdfViewer so the annotation layer's canDraw (which also gates delete and
resize) is off for readers — they can open and read, but not draw, edit, or
delete. The writer-only OCR status check is also skipped for readers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-31 12:19:54 +02:00
committed by marcel
parent 4bbdd33344
commit 33aeefbb5b
4 changed files with 46 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ let {
url,
documentId = '',
transcribeMode = false,
canAnnotate = false,
blockNumbers = {},
annotationReloadKey = 0,
activeAnnotationId = $bindable<string | null>(null),
@@ -28,6 +29,7 @@ let {
url: string;
documentId?: string;
transcribeMode?: boolean;
canAnnotate?: boolean;
blockNumbers?: Record<string, number>;
annotationReloadKey?: number;
activeAnnotationId?: string | null;
@@ -262,7 +264,7 @@ function handleAnnotationClick(id: string) {
annotations={visibleAnnotations.filter(
(a) => a.pageNumber === renderer.currentPage
)}
canDraw={transcribeMode}
canDraw={transcribeMode && canAnnotate}
color={TRANSCRIPTION_COLOR}
blockNumbers={blockNumbers}
activeAnnotationId={activeAnnotationId}