Skip to content

Coach questions preview: Fix background and selection colors + resolve linter errors #12427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,17 @@
</h3>
</template>
<template #content>
<div
v-show="isExpanded(index)"
:style="{
backgroundColor: $themePalette.grey.v_100,
}"
>
<div v-show="isExpanded(index)">
<ul class="question-list">
<li v-for="(question, i) in section.questions">
<li
v-for="(question, i) in section.questions"
:key="i"
>
<KButton
tabindex="0"
class="question-button"
appearance="basic-link"
:class="{ selected: isSelected(question) }"
:class="[listItemClass, isSelected(question) ? selectedListItemClass : '']"
:style="accordionStyleOverrides"
@click="handleQuestionChange(i, index)"
>
Expand Down Expand Up @@ -162,12 +160,10 @@
enhancedQuizManagementStrings,
} from 'kolibri-common/strings/enhancedQuizManagementStrings';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import AssessmentQuestionListItem from './AssessmentQuestionListItem';

export default {
name: 'QuestionListPreview',
components: {
AssessmentQuestionListItem,
AccordionContainer,
AccordionItem,
},
Expand Down Expand Up @@ -300,15 +296,14 @@
};
},
props: {
// `sections` is used in `setup`
// eslint-disable-next-line kolibri/vue-no-unused-properties
sections: {
type: Array,
required: true,
},
// If set to true, question buttons will be draggable
fixedOrder: {
type: Boolean,
required: true,
},
// `selectedExercises` is used in `setup`
// eslint-disable-next-line kolibri/vue-no-unused-properties
selectedExercises: {
type: Object,
required: true,
Expand All @@ -321,21 +316,26 @@
textDecoration: 'none',
};
},
listItemClass() {
return this.$computedClass({
':hover': {
backgroundColor: this.$themePalette.grey.v_100,
},
});
},
selectedListItemClass() {
return this.$computedClass({
backgroundColor: this.$themePalette.grey.v_100,
':hover': {
backgroundColor: this.$themePalette.grey.v_200,
},
});
},
resourceMissingText() {
return this.coreString('resourceNotFoundOnDevice');
},
},
methods: {
listKey(question) {
return question.exercise_id + question.question_id;
},
numCoachContents(exerciseId) {
// Do this to handle missing content
return Boolean((this.selectedExercises[exerciseId] || {}).num_coach_contents);
},
available(exerciseId) {
return Boolean(this.selectedExercises[exerciseId]);
},
isSelected(question) {
return (
this.currentQuestion.question_id === question.question_id &&
Expand Down Expand Up @@ -425,14 +425,6 @@
width: 100%;
height: 100%;
padding: 0.5em;

&:hover {
background-color: white;
}

&.selected {
background-color: white;
}
Comment on lines -428 to -435
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this in a bit of a rush 😅 - thanks for the reminder on $computedClass 😃

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, can happen 🙂

}

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

<QuestionListPreview
:sections="quiz.question_sources || []"
:fixedOrder="!quizIsRandomized"
:selectedExercises="selectedExercises"
/>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
</p>

<QuestionListPreview
:fixedOrder="!quizIsRandomized"
:selectedQuestions="selectedQuestions"
:selectedExercises="selectedExercises"
/>
Expand Down