Skip to content

Commit

Permalink
fix: Show multiple suggestions for dictionary rules (#260)
Browse files Browse the repository at this point in the history
* Show multiple suggestions for dictionary rules

While still showing replacements for classic Typerighter rules. Before this, only the first dictionary rule suggestion was being shown.

* Render only the first 6 suggestions
  • Loading branch information
samanthagottlieb committed Sep 14, 2023
1 parent bc647d0 commit 0a30a70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ts/components/Match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class Match<TMatch extends IMatch> extends Component<IMatchProps<TMatch>> {
ruleId
};

const suggestionsToRender = replacement ? [replacement] : suggestions || [];
// render up to 6 suggestions if they exist (e.g. dictionary rules), otherwise render the replacement (as sometimes exists for classic Typerighter rules)
const suggestionsToRender = suggestions && suggestions.length > 0 ? suggestions.slice(0, 6) : replacement ? [replacement] : [];
const suggestionContent = (
<div className="MatchWidget__suggestion-list">
{suggestionsToRender && applySuggestions && !markAsCorrect && (
Expand Down

0 comments on commit 0a30a70

Please sign in to comment.