Skip to content

feat: chunk annotations system + fix audit highlight (#23, #262 partial)#263

Open
nikazzio wants to merge 8 commits into
mainfrom
feat/issue-23-annotations
Open

feat: chunk annotations system + fix audit highlight (#23, #262 partial)#263
nikazzio wants to merge 8 commits into
mainfrom
feat/issue-23-annotations

Conversation

@nikazzio

Copy link
Copy Markdown
Owner

Summary

  • Introduces a typed, per-chunk annotation system for the review phase
  • Users can add multiple annotations per chunk (comment, doubt, problem, approved), each with optional markdown content and an anchor phrase
  • Anchor phrases are highlighted in the translation editor with type-specific colors
  • Chunk grid dots and index list show colored visual indicators when annotations are present
  • Annotations persist in a new annotations SQLite table and survive pipeline re-runs

Also fixes (#262 partial):

  • Audit phrase highlight clears when issue is marked resolved/rejected
  • Locate-in-text button is now a toggle (click again to deactivate)
  • Navigating to a different chunk clears the active audit highlight
  • Chunk summary panel shows aggregated translation/audit stats (all stages combined) instead of only the last single stage

Closes

Closes #23 — partial fix for #262

Changes

Area What changed
DB New annotations table (idempotent CREATE IF NOT EXISTS)
Types AnnotationType, Annotation in types.ts
Store New annotationsStore.ts — CRUD + load/clear lifecycle
Project lifecycle openProject, switchPipeline, closeProject load/clear annotations
Highlight useGlossaryHighlight extended with annotationAnchors param
CSS 4 new hl-annot-* CSS vars + mark classes
UI NotesTab rewritten — inline add/edit form, typed cards
UI Chunk grid dots get colored badge when chunk has annotations
UI IndexTab shows note count badge with priority color
UI Audit highlight clears on resolve/reject and chunk navigation
Stats ChunkSummaryTab shows aggregated per-category stats
i18n annotations.* keys + updated chunk summary labels

Test plan

  • App starts without errors — annotations table created
  • Add annotation of type Problem → red card, chunk dot red badge
  • Add annotation with anchor → phrase highlighted in translation editor
  • Edit and delete annotation → updates reflected immediately
  • Close and reopen project → annotations persisted
  • Locate-in-text on audit issue → click again → clears highlight
  • Mark audit issue as resolved → highlight disappears
  • Navigate to different chunk → audit highlight clears
  • Chunk summary panel → "Traduzione" card shows totals across all stages

🤖 Generated with Claude Code

nikazzio and others added 8 commits June 11, 2026 21:13
Adds a typed, per-chunk annotation system for the review phase.
Users can annotate complex translation issues (comment, doubt, problem,
approved), optionally anchoring each note to a specific phrase in the
translation text. Notes persist across re-runs and are surfaced visually
in the chunk grid dots and the index list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Right-click on selected translation text opens context menu → creates
  annotation with selected text pre-filled as anchor phrase
- pendingAnnotationAnchor in uiStore bridges DocumentView → NotesTab
- NotesTab: replace MarkdownEditor toolbar with plain textarea
- NotesTab: TypeSelector uses IconButton filter bar (icon-only + italic label),
  removing chip-style type pills
- NotesTab: action buttons use PillButton (accent/secondary), raw <button> removed
- NotesTab: add form removes manual anchor input; shows read-only AnchorPill
  when anchor set via context menu (× to clear)
- NotesTab: edit form keeps anchor text input for modifying existing anchor
- i18n: add annotations.contextMenuAdd key (it + en)
…ontent

- NotebookPen button on each issue in IssueList and AuditPanel
- Sets pendingAnnotationAnchor with phrase as anchor text and '[Audit] {description}' as pre-filled content
- uiStore.pendingAnnotationAnchor extended with optional content field
- NotesTab useEffect reads content field to pre-populate form textarea
- AuditPanel button also navigates to document view before opening notes drawer
- Annotation with anchor text gets marker [^aN] inserted after phrase in translation
- Footnote definition appended to translation text: [^aN]: content
- Marker badge shown in annotation card in NotesTab
- footnote_marker column added to annotations table (migration + schema bump)
- Textarea rows 3→5 for more comfortable editing
- Badge annotazione in lista chunk: da grigio a azzurro (sky-500)
- Footnote inserita anche su chunk bloccati (updateChunkTranslationForce bypassa il lock)
- Marker formato [a1] invece di [^\^a1], separatore --- prima della definizione
- Marker [a1] aggiunto agli anchor highlights nella traduzione (stesso colore annotation type)
- Toolbar MarkdownEditor: scrivi/anteprima/dividi e dimensione testo sempre visibili
  nel header; toggle mostra solo i comandi markdown; help sempre visibile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Annotazioni e note per chunk

1 participant