fix: keep main actor column highlighted on abandon
This commit is contained in:
parent
2c5c9899bd
commit
253fdcf040
1 changed files with 6 additions and 7 deletions
|
|
@ -50,24 +50,23 @@ export default function GameRow({ actorName, pos, colStart, totalWidth, hintType
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isMainActorCell = charIndex === pos;
|
||||||
const attemptedLetter = typeof attemptedLetters?.[charIndex] === 'string'
|
const attemptedLetter = typeof attemptedLetters?.[charIndex] === 'string'
|
||||||
? attemptedLetters[charIndex].toUpperCase()
|
? attemptedLetters[charIndex].toUpperCase()
|
||||||
: '';
|
: '';
|
||||||
const correctLetter = ch.toUpperCase();
|
const correctLetter = ch.toUpperCase();
|
||||||
const revealState = !revealed
|
const revealState = !revealed || isMainActorCell
|
||||||
? null
|
? null
|
||||||
: attemptedLetter === ''
|
: attemptedLetter === correctLetter
|
||||||
? null
|
? 'correct'
|
||||||
: attemptedLetter === correctLetter
|
: 'wrong';
|
||||||
? 'correct'
|
|
||||||
: 'wrong';
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LetterInput
|
<LetterInput
|
||||||
key={colIndex}
|
key={colIndex}
|
||||||
rowIndex={rowIndex}
|
rowIndex={rowIndex}
|
||||||
charIndex={charIndex}
|
charIndex={charIndex}
|
||||||
highlighted={!revealed && charIndex === pos}
|
highlighted={isMainActorCell}
|
||||||
inputRef={setInputRef(charIndex)}
|
inputRef={setInputRef(charIndex)}
|
||||||
onNext={() => focusNextInput(charIndex, 1)}
|
onNext={() => focusNextInput(charIndex, 1)}
|
||||||
onPrev={() => focusNextInput(charIndex, -1)}
|
onPrev={() => focusNextInput(charIndex, -1)}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue