Skip to content

Add strategy descriptions to web UI dropdown#14

Merged
JuliusScheuerer merged 1 commit into
mainfrom
worktree-strategy-descriptions-ui
Mar 25, 2026
Merged

Add strategy descriptions to web UI dropdown#14
JuliusScheuerer merged 1 commit into
mainfrom
worktree-strategy-descriptions-ui

Conversation

@JuliusScheuerer
Copy link
Copy Markdown
Owner

Summary

  • Add i18n-translated strategy descriptions to the anonymization strategy dropdown
  • Each <option> has a title attribute with the description (native tooltip)
  • A <span> below the dropdown shows the description of the currently selected strategy
  • Descriptions update dynamically via updateStrategyDescription() in review.js
  • Both German and English translations added (5 keys each)

Test plan

  • make check passes (275 tests, 95.50% coverage)
  • Manual: hover over dropdown options to see tooltips, change selection to see description update

Each dropdown option now shows a translated description via tooltip
(title attribute) and a text label below the select that updates on
change. Descriptions are i18n-translated in both German and English.
@JuliusScheuerer JuliusScheuerer merged commit c7ded66 into main Mar 25, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 25, 2026

Greptile Summary

This PR enriches the anonymization strategy dropdown in the web UI with i18n-translated descriptions. Each <option> gains a native title tooltip, and a dynamically updated <span> below the dropdown surfaces the description of the currently selected strategy for users who don't rely on hover tooltips. The implementation is small, self-contained, and well-integrated with the existing i18n and vanilla-JS patterns used throughout the codebase.

  • Five strategy.* translation keys added to both en.json and de.json, covering all strategies defined in AnonymizationStrategy — no missing or extra keys.
  • results.html injects the description via {{ _('strategy.' + s) }} in the title attribute and adds <span id="strategy-description"> below the dropdown.
  • updateStrategyDescription() in review.js reads the selected option's title attribute and writes it to the span, called on both init and every change event via syncStrategyField().
  • Minor style note: the local var selected inside updateStrategyDescription() shadows the outer module-level selected object; renaming it to selectedOption would reduce ambiguity.

Confidence Score: 5/5

  • Safe to merge — changes are purely additive UI enhancements with no logic impact.
  • All four changed files are straightforward: two JSON translation files with correct keys, a minimal HTML addition, and a small JS helper. The only finding is a non-critical variable shadowing (P2 style). No functional regressions introduced.
  • No files require special attention.

Important Files Changed

Filename Overview
src/document_anonymizer/web/static/js/review.js Adds updateStrategyDescription() helper that reads the title attribute from the selected option and writes it to #strategy-description. Wired into syncStrategyField() so it fires on both init and user-driven changes. Minor variable naming concern (shadows outer selected).
src/document_anonymizer/web/templates/results.html Adds title attribute to each <option> using the i18n helper and a new <span id="strategy-description"> below the dropdown. Both changes are correctly scoped and safe.
src/document_anonymizer/i18n/translations/en.json Adds five strategy.* translation keys covering all strategies defined in AnonymizationStrategy. Keys and values are accurate and consistently placed.
src/document_anonymizer/i18n/translations/de.json Adds five matching strategy.* German translations. Descriptions are accurate and mirror the English entries correctly.

Sequence Diagram

sequenceDiagram
    participant Browser
    participant results.html
    participant review.js
    participant i18n

    Browser->>results.html: Page load / HTMX swap
    results.html->>i18n: _('strategy.' + s) for each option
    i18n-->>results.html: Translated description string
    results.html-->>Browser: <option title="description"> rendered

    Browser->>review.js: DOMContentLoaded → init()
    review.js->>review.js: syncStrategyField()
    review.js->>review.js: updateStrategyDescription()
    review.js-->>Browser: #strategy-description.textContent = option.title

    Browser->>review.js: User changes dropdown (change event)
    review.js->>review.js: syncStrategyField()
    review.js->>review.js: updateStrategyDescription()
    review.js-->>Browser: #strategy-description updated with new description
Loading

Reviews (1): Last reviewed commit: "Add strategy descriptions to web UI drop..." | Re-trigger Greptile

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.

1 participant