Removed the used words check from fillBlanks since allow repetition wasn't implemented and messes up imports
This commit is contained in:
@@ -4,7 +4,6 @@ interface Props {
|
|||||||
letter: string;
|
letter: string;
|
||||||
word: string;
|
word: string;
|
||||||
isSelected: boolean;
|
isSelected: boolean;
|
||||||
isUsed: boolean;
|
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
onRemove?: () => void;
|
onRemove?: () => void;
|
||||||
onEdit?: (newWord: string) => void;
|
onEdit?: (newWord: string) => void;
|
||||||
@@ -15,7 +14,6 @@ const FillBlanksWord: React.FC<Props> = ({
|
|||||||
letter,
|
letter,
|
||||||
word,
|
word,
|
||||||
isSelected,
|
isSelected,
|
||||||
isUsed,
|
|
||||||
onClick,
|
onClick,
|
||||||
onRemove,
|
onRemove,
|
||||||
onEdit,
|
onEdit,
|
||||||
@@ -36,10 +34,8 @@ const FillBlanksWord: React.FC<Props> = ({
|
|||||||
) : (
|
) : (
|
||||||
<button
|
<button
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
disabled={isUsed}
|
|
||||||
className={`
|
className={`
|
||||||
min-w-0 flex-1 flex items-center gap-2 p-2 rounded-md border text-left transition-colors
|
min-w-0 flex-1 flex items-center gap-2 p-2 rounded-md border text-left transition-colors
|
||||||
${isUsed ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer hover:bg-blue-50'}
|
|
||||||
${isSelected ? 'border-blue-500 bg-blue-100' : 'border-gray-200'}
|
${isSelected ? 'border-blue-500 bg-blue-100' : 'border-gray-200'}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -195,11 +195,6 @@ const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: num
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const isWordUsed = (word: string): boolean => {
|
|
||||||
if (local.allowRepetition) return false;
|
|
||||||
return Array.from(answers.values()).includes(word);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleEditWord = (index: number, newWord: string) => {
|
const handleEditWord = (index: number, newWord: string) => {
|
||||||
if (!editing) setEditing(true);
|
if (!editing) setEditing(true);
|
||||||
|
|
||||||
@@ -299,7 +294,6 @@ const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: num
|
|||||||
letter={wordItem.letter}
|
letter={wordItem.letter}
|
||||||
word={wordItem.word}
|
word={wordItem.word}
|
||||||
isSelected={answers.get(selectedBlankId || '') === wordItem.word}
|
isSelected={answers.get(selectedBlankId || '') === wordItem.word}
|
||||||
isUsed={isWordUsed(wordItem.word)}
|
|
||||||
onClick={() => handleWordSelect(wordItem.word)}
|
onClick={() => handleWordSelect(wordItem.word)}
|
||||||
onRemove={isEditMode ? () => handleRemoveWord(index) : undefined}
|
onRemove={isEditMode ? () => handleRemoveWord(index) : undefined}
|
||||||
onEdit={isEditMode ? (newWord) => handleEditWord(index, newWord) : undefined}
|
onEdit={isEditMode ? (newWord) => handleEditWord(index, newWord) : undefined}
|
||||||
|
|||||||
Reference in New Issue
Block a user