Skip to content

refactor: render arrow characters as icons, drop getWordHtml funbox hook (@miodec) - #8492

Merged
Miodec merged 3 commits into
masterfrom
arrow-letter-icons
Oct 21, 2026
Merged

Miodec merged 3 commits into
masterfrom
arrow-letter-icons

Conversation

@Miodec

@Miodec Miodec commented Oct 21, 2026

Copy link
Copy Markdown
Member

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.

 FunboxFunctions
-  getWordHtml?: (char, letterTag?) => string
 arrows
-  getWordHtml(char, letterTag) -> "<letter><i class='fas fa-arrow-*'></i></letter>"
 packages/funbox list.ts (arrows frontendFunctions)
-  "getWordHtml"
 packages/funbox validation.ts
-  oneCharReplacerMax   // only ever matched arrows
 test-ui.ts (buildWordHTML, updateWordLetters typed + untyped letters)
-  findSingleActiveFunboxWithFunction("getWordHtml") -> funbox HTML
+  arrowIcons[char] -> <i class="fas fa-arrow-*">   // same branch as tab / newline

Only behaviour change: arrow characters in custom text (no funbox) now render as icons. No language or quote contains them.

Evidence

  • Before (arrows funbox): <letter><i class="fas fa-arrow-right"></i></letter>…, typed → letter.correct / letter.incorrect with the icon
    After: identical markup and classes (checked in the browser, untyped and typed)
  • packages/funbox tests (9) and frontend/__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

…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>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 15:46
@monkeytypegeorge monkeytypegeorge added frontend User interface or web stuff packages Changes in local packages labels Oct 21, 2026
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Oct 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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 arrowIcons map in test-ui.ts and applied it across buildWordHTML and both the typed/untyped branches of updateWordLetters, producing markup identical to the old funbox output.
  • Removed the getWordHtml function type and the arrows implementation from the frontend funbox functions, and dropped "getWordHtml" from the arrows frontendFunctions list.
  • Removed the now-unused oneCharReplacerMax compatibility check from funbox validation (arrows was the only funbox using getWordHtml).
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

Miodec and others added 2 commits October 21, 2026 18:09
noUncheckedIndexedAccess already types the lookup as string | undefined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot removed the waiting for review Pull requests that require a review before continuing label Oct 21, 2026
@Miodec
Miodec merged commit b4dd6cb into master Oct 21, 2026
13 checks passed
@Miodec
Miodec deleted the arrow-letter-icons branch October 21, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff packages Changes in local packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants