From 32a030b88462924ade8c982637b235e70ad4c8c9 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Thu, 19 Oct 2023 12:57:21 -0400 Subject: [PATCH 1/9] Create ResourceSyncingUiAlert around MissingResourceAlert to use in Learn Plugin --- kolibri/core/assets/src/core-app/apiSpec.js | 2 + .../learn/assets/src/views/ExamPage/index.vue | 6 +- .../learn/assets/src/views/HomePage/index.vue | 6 +- .../src/views/ResourceSyncingUiAlert.vue | 55 +++++++++++++++++++ .../src/views/classes/LessonPlaylistPage.vue | 6 +- .../components/MissingResourceAlert.vue | 5 +- 6 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 kolibri/plugins/learn/assets/src/views/ResourceSyncingUiAlert.vue diff --git a/kolibri/core/assets/src/core-app/apiSpec.js b/kolibri/core/assets/src/core-app/apiSpec.js index 10b6b1ca069..8d64a667011 100644 --- a/kolibri/core/assets/src/core-app/apiSpec.js +++ b/kolibri/core/assets/src/core-app/apiSpec.js @@ -105,6 +105,7 @@ import * as sync from '../views/sync/syncComponentSet'; import PageRoot from '../views/PageRoot'; import NotificationsRoot from '../views/NotificationsRoot'; import useMinimumKolibriVersion from '../composables/useMinimumKolibriVersion'; +import useUserSyncStatus from '../composables/useUserSyncStatus'; import useUser from '../composables/useUser'; // webpack optimization @@ -232,6 +233,7 @@ export default { useKShow, useMinimumKolibriVersion, useUser, + useUserSyncStatus, }, }, resources, diff --git a/kolibri/plugins/learn/assets/src/views/ExamPage/index.vue b/kolibri/plugins/learn/assets/src/views/ExamPage/index.vue index fee9d2e0948..6256beac76e 100644 --- a/kolibri/plugins/learn/assets/src/views/ExamPage/index.vue +++ b/kolibri/plugins/learn/assets/src/views/ExamPage/index.vue @@ -64,7 +64,7 @@ :answerState="currentAttempt.answer" @interaction="saveAnswer" /> - + @@ -186,7 +186,7 @@ import TimeDuration from 'kolibri.coreVue.components.TimeDuration'; import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; import ImmersivePage from 'kolibri.coreVue.components.ImmersivePage'; - import MissingResourceAlert from 'kolibri-common/components/MissingResourceAlert'; + import ResourceSyncingUiAlert from '../ResourceSyncingUiAlert'; import useProgressTracking from '../../composables/useProgressTracking'; import { PageNames, ClassesPageNames } from '../../constants'; import { LearnerClassroomResource } from '../../apiResources'; @@ -208,7 +208,7 @@ TimeDuration, SuggestedTime, ImmersivePage, - MissingResourceAlert, + ResourceSyncingUiAlert, }, mixins: [responsiveWindowMixin, commonCoreStrings], setup() { diff --git a/kolibri/plugins/learn/assets/src/views/HomePage/index.vue b/kolibri/plugins/learn/assets/src/views/HomePage/index.vue index db4eb3cff59..e402033f473 100644 --- a/kolibri/plugins/learn/assets/src/views/HomePage/index.vue +++ b/kolibri/plugins/learn/assets/src/views/HomePage/index.vue @@ -2,7 +2,7 @@
- + + + + + + + + + + diff --git a/kolibri/plugins/learn/assets/src/views/classes/LessonPlaylistPage.vue b/kolibri/plugins/learn/assets/src/views/classes/LessonPlaylistPage.vue index c819b8f0961..9f9fd4de11f 100644 --- a/kolibri/plugins/learn/assets/src/views/classes/LessonPlaylistPage.vue +++ b/kolibri/plugins/learn/assets/src/views/classes/LessonPlaylistPage.vue @@ -26,7 +26,7 @@ {{ currentLesson.description }}

- +
@@ -57,7 +57,7 @@ import ProgressIcon from 'kolibri.coreVue.components.ProgressIcon'; import ContentIcon from 'kolibri.coreVue.components.ContentIcon'; import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; - import MissingResourceAlert from 'kolibri-common/components/MissingResourceAlert'; + import ResourceSyncingUiAlert from '../ResourceSyncingUiAlert'; import useContentLink from '../../composables/useContentLink'; import useContentNodeProgress from '../../composables/useContentNodeProgress'; import { PageNames, ClassesPageNames } from '../../constants'; @@ -78,7 +78,7 @@ ContentIcon, ProgressIcon, LearnAppBarPage, - MissingResourceAlert, + ResourceSyncingUiAlert, }, mixins: [commonCoreStrings, commonLearnStrings, responsiveWindowMixin], setup() { diff --git a/packages/kolibri-common/components/MissingResourceAlert.vue b/packages/kolibri-common/components/MissingResourceAlert.vue index d826540f64f..2d92840c69a 100644 --- a/packages/kolibri-common/components/MissingResourceAlert.vue +++ b/packages/kolibri-common/components/MissingResourceAlert.vue @@ -7,7 +7,10 @@ type="warning" :style="{ marginBottom: 0, marginTop: '8px' }" > - + + + + {{ coreString( multiple ? 'someResourcesMissingOrNotSupported' : 'resourceNotFoundOnDevice' From 304b9c638a91a5896e247c24f5e161684f87afc6 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Thu, 19 Oct 2023 15:46:36 -0400 Subject: [PATCH 2/9] Conditionalize for LODs --- .../plugins/learn/assets/src/views/ExamPage/index.vue | 5 ++++- .../plugins/learn/assets/src/views/HomePage/index.vue | 5 +++-- .../assets/src/views/classes/LessonPlaylistPage.vue | 9 +++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/kolibri/plugins/learn/assets/src/views/ExamPage/index.vue b/kolibri/plugins/learn/assets/src/views/ExamPage/index.vue index 6256beac76e..d31ced59269 100644 --- a/kolibri/plugins/learn/assets/src/views/ExamPage/index.vue +++ b/kolibri/plugins/learn/assets/src/views/ExamPage/index.vue @@ -64,7 +64,7 @@ :answerState="currentAttempt.answer" @interaction="saveAnswer" /> - + @@ -186,6 +186,7 @@ import TimeDuration from 'kolibri.coreVue.components.TimeDuration'; import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; import ImmersivePage from 'kolibri.coreVue.components.ImmersivePage'; + import useUser from 'kolibri.coreVue.composables.useUser'; import ResourceSyncingUiAlert from '../ResourceSyncingUiAlert'; import useProgressTracking from '../../composables/useProgressTracking'; import { PageNames, ClassesPageNames } from '../../constants'; @@ -220,6 +221,7 @@ startTrackingProgress, stopTrackingProgress, } = useProgressTracking(); + const { isLearnerOnlyImport } = useUser(); return { pastattempts, time_spent, @@ -227,6 +229,7 @@ updateContentSession, startTrackingProgress, stopTrackingProgress, + isLearnerOnlyImport, }; }, data() { diff --git a/kolibri/plugins/learn/assets/src/views/HomePage/index.vue b/kolibri/plugins/learn/assets/src/views/HomePage/index.vue index e402033f473..fe7320fba0a 100644 --- a/kolibri/plugins/learn/assets/src/views/HomePage/index.vue +++ b/kolibri/plugins/learn/assets/src/views/HomePage/index.vue @@ -2,7 +2,7 @@
- +
- +
@@ -57,6 +60,7 @@ import ProgressIcon from 'kolibri.coreVue.components.ProgressIcon'; import ContentIcon from 'kolibri.coreVue.components.ContentIcon'; import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings'; + import useUser from 'kolibri.coreVue.composables.useUser'; import ResourceSyncingUiAlert from '../ResourceSyncingUiAlert'; import useContentLink from '../../composables/useContentLink'; import useContentNodeProgress from '../../composables/useContentNodeProgress'; @@ -84,7 +88,8 @@ setup() { const { genContentLinkBackLinkCurrentPage } = useContentLink(); const { contentNodeProgressMap } = useContentNodeProgress(); - return { contentNodeProgressMap, genContentLinkBackLinkCurrentPage }; + const { isLearnerOnlyImport } = useUser(); + return { contentNodeProgressMap, genContentLinkBackLinkCurrentPage, isLearnerOnlyImport }; }, computed: { ...mapState('lessonPlaylist', ['contentNodesMap', 'currentLesson']), From 549cdd2879ea87cd17ff1dddc105cd3ddd9e6ff0 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Thu, 19 Oct 2023 17:26:58 -0400 Subject: [PATCH 3/9] Update display conditions to include whether or not the sync has completed, not only if it has been initiated --- .../src/views/ResourceSyncingUiAlert.vue | 13 +++++++++- .../components/MissingResourceAlert.vue | 24 ++++++++++++------- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/kolibri/plugins/learn/assets/src/views/ResourceSyncingUiAlert.vue b/kolibri/plugins/learn/assets/src/views/ResourceSyncingUiAlert.vue index 594a61b4b51..f1d6cd1c45a 100644 --- a/kolibri/plugins/learn/assets/src/views/ResourceSyncingUiAlert.vue +++ b/kolibri/plugins/learn/assets/src/views/ResourceSyncingUiAlert.vue @@ -1,6 +1,9 @@