Skip to content

feat: ricerca globale documento + sistema evidenziazioni unificato (#140)#196

Merged
nikazzio merged 9 commits into
mainfrom
feat/search-global-highlight-system
May 29, 2026
Merged

feat: ricerca globale documento + sistema evidenziazioni unificato (#140)#196
nikazzio merged 9 commits into
mainfrom
feat/search-global-highlight-system

Conversation

@nikazzio
Copy link
Copy Markdown
Owner

Summary

  • Tab Cerca in InsightsDrawer: ricerca full-text su source, traduzione e audit di tutti i chunk. Debounce 250ms, snippet con match in grassetto, badge per tipo (source / translation / audit), virtualizer per lista risultati. Click → naviga al chunk.
  • Highlights unificati: useGlossaryHighlight accetta searchQuery opzionale; tutti i tipi di span (glossario + ricerca) passano per un unico buildHtml pass senza conflitti HTML.
  • Master toggle Highlighter nella barra navigazione chunk di DocumentView (sempre visibile, sostituisce il toggle sepolto nella GlossaryTab).
  • Colori configurabili per tipo in Impostazioni → Evidenziazioni (4 color picker, alpha preservato).
  • CSS custom properties per tutti i colori highlight, iniettate reattivamente da HighlightColorSync in App.tsx.
  • Rimosso glossaryHighlightEnabled → sostituito da highlightsEnabled globale.
  • ARCHITECTURE.md, help utente (it+en), i18n completo aggiornati.

Test plan

  • Aprire documento multi-chunk, tab Cerca → digitare query → risultati + snippet evidenziati
  • Click su risultato → chunk corretto selezionato + termine evidenziato in giallo nel testo
  • Master toggle Highlighter → tutti gli highlight scompaiono/riappaiono
  • Settings → Evidenziazioni → cambiare colore → highlight aggiornato istantaneamente
  • Glossario attivo + query ricerca attiva → entrambi i tipi visibili contemporaneamente
  • npm run lint e npm test green (346 test pass, 0 errori TS)

Closes #140

nikazzio added 3 commits May 28, 2026 23:35
)

- Nuovo tab Cerca in InsightsDrawer: ricerca full-text su source, traduzione e
  audit di tutti i chunk con debounce 250ms, snippet con match evidenziato,
  badge per tipo di match (source/translation/audit), virtualizer per risultati
- Highlights unificati: useGlossaryHighlight accetta searchQuery opzionale,
  tutti i tipi di span (glossario + search) passano per un unico buildHtml pass
- Master toggle Highlighter nella barra navigazione chunk (DocumentView)
- Colori highlight configurabili per tipo in Impostazioni → Evidenziazioni
  con color picker che preserva il canale alpha
- CSS custom properties per tutti i colori highlight, aggiornate reattivamente
  da HighlightColorSync in App.tsx
- Rimosso glossaryHighlightEnabled (sostituito da highlightsEnabled globale)
- Aggiornati ARCHITECTURE.md, help utente (it+en), i18n completo
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a global, full-text “Search” experience for documents inside the Insights drawer and unifies all in-text highlighting (glossary + search) behind a single global toggle and a single HTML-building pass. It also introduces configurable highlight colors (synced via CSS custom properties) and updates docs/i18n accordingly.

Changes:

  • Added a new Search tab in InsightsDrawer with debounced full-text search across chunk source/translation/audit and virtualized results.
  • Reworked highlighting into a single global highlighter system (highlightsEnabled, unified buildHtml pass) with runtime-configurable colors stored in UI prefs and synced to CSS variables.
  • Moved the master highlight toggle into DocumentView chunk navigation and updated help/docs/i18n.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/stores/uiStore.ts Introduces global highlights state, highlight colors, and search query; persists highlight prefs.
src/index.css Adds CSS custom properties for highlight tokens and a new hl-search style.
src/i18n/it.json Adds/updates strings for search + highlight settings and revises settings title/help text.
src/i18n/en.json Adds/updates strings for search + highlight settings and revises settings title/help text.
src/hooks/useGlossaryHighlight.ts Unifies glossary + search spans into one HTML build pass.
src/components/settings/SettingsModal.tsx Adds highlight color pickers and splits modal into Provider/Settings tabs.
src/components/pipeline/ProductionStream.tsx Switches to the new global highlightsEnabled toggle.
src/components/help/HelpGuide.tsx Documents the new document search feature in the help guide.
src/components/document/SearchTab.tsx New virtualized document search UI and result rendering.
src/components/document/InsightsDrawer.tsx Adds the Search tab and removes glossary-tab-local highlight toggle.
src/components/document/DocumentView.tsx Adds master highlighter toggle; wires searchQuery into highlighting.
src/components/audit/AuditPanel.test.tsx Updates test store state to use highlightsEnabled.
src/App.tsx Injects highlight color CSS variables reactively via HighlightColorSync.
docs/ARCHITECTURE.md Updates architecture notes for new UI store fields and persistence behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/document/SearchTab.tsx
Comment thread src/components/settings/SettingsModal.tsx Outdated
Comment thread src/components/settings/SettingsModal.tsx Outdated
Comment thread src/components/settings/SettingsModal.tsx Outdated
Comment thread src/stores/uiStore.ts
Comment thread src/hooks/useGlossaryHighlight.ts
nikazzio added 2 commits May 29, 2026 01:42
…rabile

- Aggiunge hl-audit (sfondo arancio) nel pannello traduzione quando si preme il mirino su un issue audit
- Il pulsante mirino in InsightsDrawer diventa rosso quando attivo e si togola al secondo click
- Colore hl-audit configurabile da Impostazioni → Evidenziazioni ("Frase audit")
- Algoritmo interval-breakpoint: hl-audit coesiste con hl-source-term (sottolineatura) e altri highlight
- Rimuove la selezione nativa azzurra del browser (setSelectionRange) — lo scroll è mantenuto
- Aggiunge hl-audit alla priorità 3 nel sistema BG_CLASSES
- Migration Zustand v2 per aggiungere auditPhrase a highlightColors in stato persistito
- Icona rossa sezione "prompt" in StageCard (coerente con design system pipeline)
- Test copertura: overlay coesistenza underline+background, priorità bg class
- Aggiunge common.clear (Cancella/Clear) nei file i18n
- Localizza etichetta tab "Provider" via settings.providerTab
- Aggiunge aria-pressed ai tab buttons e a NavSelector (+ role="group")
- NavSelector riceve ariaLabel prop per semantica gruppo
- uiStore migrate: gestisce fromVersion < 1 copiando glossaryHighlightEnabled → highlightsEnabled
- buildHtml omette title quando tooltip è vuoto (già gestito dal ternario)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.

Comment thread src/stores/uiStore.ts
Comment thread src/hooks/useGlossaryHighlight.ts
Comment thread src/components/document/SearchTab.tsx
Comment thread src/components/document/SearchTab.tsx Outdated
Comment thread src/components/settings/SettingsModal.tsx
nikazzio added 3 commits May 29, 2026 01:51
- uiStore: migrate v2 fa merge completo di tutti i default highlightColors
- buildHtml: pre-separa bg/deco span fuori dal loop (evita re-sort per segmento)
- SearchTab: aggiunge title al clear button; snippet text-[11px] → text-xs
- SettingsModal: model description text-[11px] → text-xs
@nikazzio nikazzio merged commit 45204e3 into main May 29, 2026
6 checks passed
@nikazzio nikazzio deleted the feat/search-global-highlight-system branch May 29, 2026 06:14
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: search globale su documento, chunk, audit e note

2 participants