diff --git a/kolibri/plugins/coach/assets/src/constants/index.js b/kolibri/plugins/coach/assets/src/constants/index.js index 77c47946239..b38f0f7c756 100644 --- a/kolibri/plugins/coach/assets/src/constants/index.js +++ b/kolibri/plugins/coach/assets/src/constants/index.js @@ -53,6 +53,13 @@ export const GroupModals = { DELETE_GROUP: 'DELETE_GROUP', }; +export const ViewMoreButtonStates = { + LOADING: 'LOADING', + HAS_MORE: 'HAS_MORE', + NO_MORE: 'NO_MORE', + ERROR: 'ERROR', +}; + export const pageNameToModuleMap = { [PageNames.EXAMS]: 'examsRoot', [PageNames.EXAM_REPORT]: 'examReport', diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreatePracticeQuizPage.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreatePracticeQuizPage.vue index cae42e01ac6..2a55d0861cb 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreatePracticeQuizPage.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/CreatePracticeQuizPage.vue @@ -43,7 +43,7 @@ import { ContentNodeKinds } from 'kolibri.coreVue.vuex.constants'; import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; import ResourceSelectionBreadcrumbs from '../../plan/LessonResourceSelectionPage/SearchTools/ResourceSelectionBreadcrumbs'; - import { PageNames } from '../../../constants'; + import { PageNames, ViewMoreButtonStates } from '../../../constants/index'; import ContentCardList from '../../plan/LessonResourceSelectionPage/ContentCardList'; import commonCoach from '../../common'; import CoachImmersivePage from '../../CoachImmersivePage'; @@ -58,7 +58,7 @@ mixins: [commonCoreStrings, commonCoach], data() { return { - viewMoreButtonState: 'no_more_results', + viewMoreButtonState: ViewMoreButtonStates.NO_MORE, contentHasCheckbox: () => false, contentIsSelected: () => '', }; diff --git a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue index e4416795089..8f781d0d6d9 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -99,9 +99,9 @@ - - - + + + - - + + + + diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue index a3bebfc4206..d0dfd643cc9 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/ContentCardList.vue @@ -45,11 +45,11 @@ @click="$emit('moreresults')" /> -

+

@@ -59,12 +59,14 @@ - - - + + + - - + + + + diff --git a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/index.vue b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/index.vue index 421046311e4..533a11900f8 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/index.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/LessonResourceSelectionPage/index.vue @@ -122,6 +122,7 @@ import CoachAppBarPage from '../../CoachAppBarPage'; import CoachImmersivePage from '../../CoachImmersivePage'; import { LessonsPageNames } from '../../../constants/lessonsConstants'; + import { ViewMoreButtonStates } from '../../../constants/index'; import LessonsSearchBox from './SearchTools/LessonsSearchBox'; import LessonsSearchFilters from './SearchTools/LessonsSearchFilters'; import ResourceSelectionBreadcrumbs from './SearchTools/ResourceSelectionBreadcrumbs'; @@ -252,13 +253,16 @@ ); }, viewMoreButtonState() { - if (this.moreResultsState === 'waiting' || this.moreResultsState === 'error') { + if ( + this.moreResultsState === ViewMoreButtonStates.LOADING || + this.moreResultsState === ViewMoreButtonStates.ERROR + ) { return this.moreResultsState; } if (!this.inSearchMode || this.numRemainingSearchResults === 0) { - return 'no_more_results'; + return ViewMoreButtonStates.NO_MORE; } - return 'visible'; + return ViewMoreButtonStates.HAS_MORE; }, contentIsInLesson() { return ({ id }) => @@ -519,7 +523,7 @@ }); }, handleMoreResults() { - this.moreResultsState = 'waiting'; + this.moreResultsState = ViewMoreButtonStates.LOADING; this.fetchAdditionalSearchResults({ searchTerm: this.searchTerm, kind: this.filters.kind, @@ -530,7 +534,7 @@ this.moreResultsState = null; }) .catch(() => { - this.moreResultsState = 'error'; + this.moreResultsState = ViewMoreButtonStates.ERROR; }); }, topicsLink(topicId) {