From e9861abbcac5dff320cf9b5f91f1eb9651df7693 Mon Sep 17 00:00:00 2001 From: Garvit Singhal Date: Tue, 13 Feb 2024 18:11:09 +0530 Subject: [PATCH] Refactor ContentCardList component and its dependencies for improved consistency --- .../plugins/coach/assets/src/constants/index.js | 7 +++++++ .../CreateExamPage/CreatePracticeQuizPage.vue | 4 ++-- .../plan/CreateExamPage/ResourceSelection.vue | 7 +++---- .../ContentCardList.vue | 17 ++++++++++++----- .../plan/LessonResourceSelectionPage/index.vue | 14 +++++++++----- 5 files changed, 33 insertions(+), 16 deletions(-) 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 46aa59b8c75..4c8985c69f3 100644 --- a/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue +++ b/kolibri/plugins/coach/assets/src/views/plan/CreateExamPage/ResourceSelection.vue @@ -41,7 +41,6 @@ :channelsLink="channelsLink" :topicsLink="topicsLink" /> - { if (hasMore.value) { - return 'yes'; + return ViewMoreButtonStates.HAS_MORE; } else { - return 'no_more_results'; + return ViewMoreButtonStates.NO_MORE; } }); 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 fe321cfb272..5d15dd56546 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')" /> -

+

@@ -65,6 +65,8 @@