Skip to content

refactor: store words as objects (@miodec)#8161

Open
Miodec wants to merge 7 commits into
masterfrom
word-object
Open

refactor: store words as objects (@miodec)#8161
Miodec wants to merge 7 commits into
masterfrom
word-object

Conversation

@Miodec

@Miodec Miodec commented Jun 25, 2026

Copy link
Copy Markdown
Member

Mainly as an inbetween step for a future pr.

Copilot AI review requested due to automatic review settings June 25, 2026 15:57
@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Jun 25, 2026
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Jun 25, 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.

Pull request overview

Refactors test word storage from string[] (+ parallel section index list) to structured word objects (text, display, textWithCommit, sectionIndex) as a prep step for future work.

Changes:

  • Introduce Word object model in test-words + migrate call sites from getText/getCurrentText to get/getCurrent
  • Update UI/rendering + caret/keymap targeting to use display/text/textWithCommit as appropriate
  • Adjust event log + unit test mocking to reflect the new structure

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/ts/test/timer-progress.ts Reads sectionIndex from word objects for custom-section progress.
frontend/src/ts/test/test-words.ts Core refactor: words become objects; new get/getCurrent APIs.
frontend/src/ts/test/test-ui.ts UI updated to use word.display / word.text instead of raw strings.
frontend/src/ts/test/test-timer.ts Keymap “next” highlight uses getCurrent().text.
frontend/src/ts/test/test-logic.ts Init/addWord updated for new word accessors/fields.
frontend/src/ts/test/replay-ui.ts Replay targets now use word.text (no commit char).
frontend/src/ts/test/practise-words.ts Practice word extraction updated to word.text.
frontend/src/ts/test/pace-caret.ts Pace caret logic updated to measure word.display.
frontend/src/ts/test/funbox/funbox-functions.ts Funbox logic updated to display/text/get(...).
frontend/src/ts/test/events/data.ts Event log now serializes targetWords from textWithCommit.
frontend/src/ts/input/listeners/input.ts Input correctness comparisons now use textWithCommit.
frontend/src/ts/input/helpers/word-navigation.ts Navigation + script toggling now uses textWithCommit.
frontend/src/ts/input/handlers/insert-text.ts Target word comparisons/length checks now use textWithCommit.
frontend/src/ts/input/handlers/delete.ts Delete logic now uses textWithCommit.
frontend/src/ts/input/handlers/before-insert-text.ts Pre-insert validation now uses textWithCommit.
frontend/src/ts/input/handlers/before-delete.ts Confidence-mode checks now use previousWord?.textWithCommit.
frontend/src/ts/elements/caret.ts Caret placement uses word.display for grapheme length.
frontend/src/ts/commandline/lists/result-screen.ts Copy-words output now maps word objects to .text.
frontend/tests/test/events/stats.spec.ts Updates test-words mock + helpers for new word object structure.

Comment thread frontend/src/ts/test/test-words.ts Outdated
@Miodec Miodec changed the title refactor: store words as objects refactor: store words as objects (@miodec) Jun 25, 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.

Pull request overview

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

Comment thread frontend/src/ts/test/timer-progress.ts Outdated
Comment thread frontend/src/ts/test/test-ui.ts
Comment thread frontend/src/ts/commandline/lists/result-screen.ts
Comment thread frontend/src/ts/test/replay-ui.ts
Comment thread frontend/src/ts/input/helpers/word-navigation.ts Outdated
Comment thread frontend/src/ts/input/helpers/word-navigation.ts Outdated
Comment thread frontend/src/ts/input/listeners/input.ts

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.

Pull request overview

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

Comment thread frontend/src/ts/test/timer-progress.ts
Comment thread frontend/src/ts/test/test-ui.ts
Comment thread frontend/src/ts/commandline/lists/result-screen.ts
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 waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants