Prevented the word limit toast to duplicate

This commit is contained in:
Tiago Ribeiro
2023-04-06 23:10:07 +01:00
parent a82a168953
commit 8c1d42f2d9

View File

@@ -30,7 +30,7 @@ export default function Writing({exam}: Props) {
} else { } else {
setIsSubmitEnabled(true); setIsSubmitEnabled(true);
if (wordCounter.limit < words.length) { if (wordCounter.limit < words.length) {
toast.warning(`You have reached your word limit of ${wordCounter.limit} words!`); toast.warning(`You have reached your word limit of ${wordCounter.limit} words!`, {toastId: "word-limit"});
setInputText(words.slice(0, words.length - 1).join(" ")); setInputText(words.slice(0, words.length - 1).join(" "));
} }
} }
@@ -60,7 +60,7 @@ export default function Writing({exam}: Props) {
</span> </span>
</div> </div>
<textarea <textarea
className="w-1/2 h-1/3 cursor-text p-2 input input-bordered" className="w-1/2 h-1/3 cursor-text p-2 input input-bordered bg-white"
onChange={(e) => setInputText(e.target.value)} onChange={(e) => setInputText(e.target.value)}
value={inputText} value={inputText}
placeholder="Write your text here..." placeholder="Write your text here..."