Morpheme analysis UI: suggestions for #104#111
Conversation
- Don't save empty or whole-word morpheme breakdowns: disable the Done button and guard the Enter / outside-click commit paths - Localize morpheme editor strings and morpheme/trigger aria-labels - Validate morpheme element shape in isTextAnalysis at the persistence boundary (isTokenAnalysisRecord / isMorphemeAnalysis) - Restore focus to the token gloss input when the morpheme popover closes - Gate the disabled morpheme trigger's hover/cursor affordance - De-duplicate the boolean project-setting validators into one isBoolean - Document the deliberate provenance exclusion in isEmptyTokenAnalysis and de-stale the viewOptions memo comment Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
ChangesMorpheme editor improvements, localization, and type guard strengthening
Sequence Diagram(s)sequenceDiagram
participant User
participant TokenChip
participant MorphemeBreakdownPopover
participant PopoverContent
participant DOM as Token label DOM
User->>TokenChip: clicks morpheme trigger button
TokenChip->>MorphemeBreakdownPopover: open with surfaceText and glossInputId
User->>MorphemeBreakdownPopover: edits breakdown
MorphemeBreakdownPopover->>MorphemeBreakdownPopover: derive isMeaningless(draft, surfaceText)
alt draft is meaningful
User->>MorphemeBreakdownPopover: clicks Done or Enter
MorphemeBreakdownPopover->>TokenChip: onSave(draft)
else draft is meaningless
MorphemeBreakdownPopover->>MorphemeBreakdownPopover: Done disabled, close without saving
end
PopoverContent->>MorphemeBreakdownPopover: onCloseAutoFocus(event)
alt morpheme gloss field exists in token label
MorphemeBreakdownPopover->>DOM: focus first input[data-morpheme-gloss]
else no morpheme gloss field
MorphemeBreakdownPopover->>DOM: focus token gloss input via glossInputId
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
alex-rawlings-yyc
left a comment
There was a problem hiding this comment.
Left a nit, but otherwise looks great
@alex-rawlings-yyc reviewed 10 files and all commit messages, and made 2 comments.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on imnasnainaec).
src/components/MorphemeEditor.tsx line 168 at r1 (raw file):
onInteractOutside={handleInteractOutside} onOpenAutoFocus={(e) => e.preventDefault()} onCloseAutoFocus={(e) => {
Given its large body size, this could become a handler to keep the component code clean. That's my preference, but it's certainly not a rule
da0d7b7 to
1685766
Compare
alex-rawlings-yyc
left a comment
There was a problem hiding this comment.
@alex-rawlings-yyc reviewed 1 file and all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on imnasnainaec).
alex-rawlings-yyc
left a comment
There was a problem hiding this comment.
@alex-rawlings-yyc reviewed 1 file and all commit messages, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).
Done. |
* Add UI for morphosyntactic analysis of tokens * Improve editor, allow deletion of MSA * Minor adjustments * Add writing system to morpheme pipeline, fix input focus issue, prevent morpheme ID regeneration on unedited done/enter * Minor adjustments * Migrate MorphemeEditor to Platform.Bible popover, clean up analysisSlice, other minor improvements * Recenter on showMorphology toggle * Minor adjustments * Cleanup * Minor adjustments * Memoize viewOptions, clear blank morpheme gloss * Tiny tweaks (#109) * Address token-analysis review comments - MorphemeEditor: normalize internal whitespace in isUnedited to avoid no-op saves on spacing-only changes - TokenChip: document the deliberate onOpenChange omission on the controlled Popover Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Add JSDoc to normalize helper in MorphemeEditor Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Add validator for show morphology setting * Close morphology popover when token chip disabled, * Morpheme analysis UI: suggestions for #104 (#111) * Address review feedback on morpheme analysis UI - Don't save empty or whole-word morpheme breakdowns: disable the Done button and guard the Enter / outside-click commit paths - Localize morpheme editor strings and morpheme/trigger aria-labels - Validate morpheme element shape in isTextAnalysis at the persistence boundary (isTokenAnalysisRecord / isMorphemeAnalysis) - Restore focus to the token gloss input when the morpheme popover closes - Gate the disabled morpheme trigger's hover/cursor affordance - De-duplicate the boolean project-setting validators into one isBoolean - Document the deliberate provenance exclusion in isEmptyTokenAnalysis and de-stale the viewOptions memo comment Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Focus on 1st morph gloss * Tweak * Extract handle --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Fix formatting issue --------- Co-authored-by: D. Ror. <imnasnainaec@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Suggested modifications on #104
Devin: https://app.devin.ai/review/sillsdev/interlinearizer-extension/pull/111
Summary of changes
useLocalizedStrings(with{form}/{token}interpolation); new keys added tolocalizedStrings.json.isTextAnalysisnow rejects malformedmorphemesvia newisTokenAnalysisRecord/isMorphemeAnalysisguards.isBoolean.isEmptyTokenAnalysis; de-stale theviewOptionsmemo comment.Devin: https://app.devin.ai/review/sillsdev/interlinearizer-extension/pull/111
🤖 Generated with Claude Code
This change is
Summary by CodeRabbit
New Features
Improvements