🐛 Fixed selection not highlighting correctly
This commit is contained in:
@@ -137,8 +137,6 @@ class QuizQuestion(BaseModel):
|
|||||||
|
|
||||||
@validator("answers")
|
@validator("answers")
|
||||||
def answers_not_none_if_abcd_type(cls, v, values):
|
def answers_not_none_if_abcd_type(cls, v, values):
|
||||||
print(values)
|
|
||||||
# print(values)
|
|
||||||
if values["type"] == QuizQuestionType.ABCD and type(v[0]) != ABCDQuizAnswer:
|
if values["type"] == QuizQuestionType.ABCD and type(v[0]) != ABCDQuizAnswer:
|
||||||
raise ValueError("Answers can't be none if type is ABCD")
|
raise ValueError("Answers can't be none if type is ABCD")
|
||||||
if values["type"] == QuizQuestionType.RANGE and type(v) != RangeQuizAnswer:
|
if values["type"] == QuizQuestionType.RANGE and type(v) != RangeQuizAnswer:
|
||||||
|
|||||||
@@ -44,13 +44,14 @@
|
|||||||
<div class="grid grid-rows-2 grid-flow-col auto-cols-auto gap-2 w-full p-4 h-full">
|
<div class="grid grid-rows-2 grid-flow-col auto-cols-auto gap-2 w-full p-4 h-full">
|
||||||
{#each question.answers as answer, i}
|
{#each question.answers as answer, i}
|
||||||
<button
|
<button
|
||||||
class="rounded-lg h-full flex align-middle justify-center disabled:opacity-60 p-3 border-2 border-black opacity-50 transition-all"
|
class="rounded-lg h-full flex align-middle justify-center disabled:opacity-60 p-3 border-2 border-black transition-all"
|
||||||
style="background-color: {answer.color ??
|
style="background-color: {answer.color ??
|
||||||
default_colors[i]}; color: {get_foreground_color(
|
default_colors[i]}; color: {get_foreground_color(
|
||||||
answer.color ?? default_colors[i]
|
answer.color ?? default_colors[i]
|
||||||
)}"
|
)}"
|
||||||
on:click={() => selectAnswer(i)}
|
on:click={() => selectAnswer(i)}
|
||||||
class:opacity-100={_selected_answers[i]}
|
class:opacity-100={_selected_answers[i]}
|
||||||
|
class:opacity-50={!_selected_answers[i]}
|
||||||
>
|
>
|
||||||
{#if game_mode === 'kahoot'}
|
{#if game_mode === 'kahoot'}
|
||||||
<img class="h-2/3 inline-block m-auto" alt="Icon" src={kahoot_icons[i]} />
|
<img class="h-2/3 inline-block m-auto" alt="Icon" src={kahoot_icons[i]} />
|
||||||
|
|||||||
Reference in New Issue
Block a user