Repository navigation
refactor: render arrow characters as icons, drop getWordHtml funbox hook (@miodec) - #8492
Conversation
…ook (@Miodec) Arrow characters always render as icons, like tab and newline, so the arrows funbox no longer needs a getWordHtml hook and the single char replacer compatibility check goes away with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The refactor is self-consistent with no remaining references to the removed hook, preserves identical markup, and keeps the funbox function/implementation consistency test passing.
No open issues 🎉
What changed in this PR
This PR refactors how arrow characters (←, ↓, ↑, →) are rendered in the typing test. Previously these were produced via the arrows funbox's getWordHtml hook; now they are rendered as Font Awesome icons unconditionally in test-ui.ts, in the same branch as \t (tab) and \n (newline). This removes the getWordHtml funbox function entirely and shrinks the surface area of the upcoming Solid Words component refactor (#8491), which would otherwise have to port the hook. The only behavior change is that arrow characters in custom text (no funbox active) now also render as icons; the PR notes no language or quote contains these characters.
Changes:
- Added a module-level
arrowIconsmap intest-ui.tsand applied it acrossbuildWordHTMLand both the typed/untyped branches ofupdateWordLetters, producing markup identical to the old funbox output. - Removed the
getWordHtmlfunction type and the arrows implementation from the frontend funbox functions, and dropped"getWordHtml"from the arrowsfrontendFunctionslist. - Removed the now-unused
oneCharReplacerMaxcompatibility check from funbox validation (arrows was the only funbox usinggetWordHtml).
| File | Description |
|---|---|
frontend/src/ts/test/test-ui.ts |
Introduces arrowIcons map and replaces findSingleActiveFunboxWithFunction("getWordHtml") branches with icon lookups; drops the now-unused import. |
frontend/src/ts/test/funbox/funbox-functions.ts |
Removes the getWordHtml type member and the arrows implementation. |
packages/funbox/src/list.ts |
Drops "getWordHtml" from the arrows funbox frontendFunctions. |
packages/funbox/src/validation.ts |
Removes the oneCharReplacerMax check and its usage in the compatibility return. |
I verified the refactor is consistent: no stale references to getWordHtml or oneCharReplacerMax remain, the arrowIcons map matches the removed logic exactly (characters and icon classes), the generated markup (<letter> wrapping vs. bare <i>) is preserved per branch, and the funbox.spec.ts consistency test stays green since getWordHtml was removed from both list.ts and funbox-functions.ts.
Review effort: Balanced
noUncheckedIndexedAccess already types the lookup as string | undefined. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Arrow characters now always render as icons, like tab and newline, instead of going through a funbox hook. Shrinks #8491 (Solid Words component), which otherwise has to port
getWordHtml.Only behaviour change: arrow characters in custom text (no funbox) now render as icons. No language or quote contains them.
Evidence
<letter><i class="fas fa-arrow-right"></i></letter>…, typed →letter.correct/letter.incorrectwith the iconAfter: identical markup and classes (checked in the browser, untyped and typed)
packages/funboxtests (9) andfrontend/__tests__/test(229) pass.Merge Danger
Door: two-way
Blast Radius: arrows funbox
Rendering of arrow characters in the typing test only.
🤖 Generated with Claude Code