Skip to content
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

Upgrade KDS to v5.0.0-rc1, introduce KDS live region and use it at one place #12475

Merged
merged 5 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion kolibri/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"js-cookie": "^3.0.5",
"knuth-shuffle-seeded": "^1.0.6",
"kolibri-constants": "0.2.6",
"kolibri-design-system": "4.3.2",
"kolibri-design-system": "5.0.0-rc1 ",
Copy link
Member

Choose a reason for hiding this comment

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

Seems like there is an extra space, I dont think this could cause a problem, but just in case.

Suggested change
"kolibri-design-system": "5.0.0-rc1 ",
"kolibri-design-system": "5.0.0-rc1",

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, yes better to fix. Done

"lockr": "0.8.5",
"lodash": "^4.17.21",
"loglevel": "^1.9.1",
Expand Down
5 changes: 1 addition & 4 deletions kolibri/plugins/learn/assets/src/views/LearnAppBarPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
</template>

<template #storageNotif>
<div
v-if="page === 'AppBarPage'"
aria-live="polite"
>
<div v-if="page === 'AppBarPage'">
<StorageNotification :showBanner="showStorageNotification" />
</div>
</template>
Expand Down
41 changes: 27 additions & 14 deletions kolibri/plugins/learn/assets/src/views/StorageNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<!-- Grid Content -->
<KGridItem :layout12="{ span: 12 }">
<p>
{{ getMessage() }}
{{ message }}
</p>
</KGridItem>

Expand Down Expand Up @@ -61,6 +61,7 @@
import { mapGetters } from 'vuex';
import useUser from 'kolibri.coreVue.composables.useUser';
import { useLocalStorage } from '@vueuse/core';
import useKLiveRegion from 'kolibri-design-system/lib/composables/useKLiveRegion';
import { LearnerDeviceStatus } from 'kolibri.coreVue.vuex.constants';
import urls from 'kolibri.urls';
import redirectBrowser from 'kolibri.utils.redirectBrowser';
Expand Down Expand Up @@ -93,6 +94,8 @@
lastDownloadRemoved,
} = useUserSyncStatus();

const { sendAssertiveMessage } = useKLiveRegion();

return {
lastSynced,
status,
Expand All @@ -105,6 +108,7 @@
local_storage_lastDownloadRemoved,
setLastSyncedValue,
setDownloadRemovedValue,
sendAssertiveMessage,
};
},
data() {
Expand All @@ -114,6 +118,19 @@
},
computed: {
...mapGetters(['isLearner', 'isAdmin', 'canManageContent']),
message() {
let message = '';
if (this.isAdmin) {
message = this.$tr('superAdminMessage');
} else if (this.insufficientStorageNoDownloads) {
message = this.$tr('insufficientStorageNoDownloads');
} else if (this.learnOnlyRemovedResources) {
message = this.$tr('resourcesRemoved');
} else if (this.availableDownload) {
message = this.$tr('insufficientStorageAvailableDownloads');
}
return message;
},
insufficientStorageNoDownloads() {
return (
(this.isLearner && this.insufficientStorage) ||
Expand Down Expand Up @@ -144,6 +161,15 @@
}
},
deep: true,
immediate: true,
},
message: {
handler(newVal, oldVal) {
if (newVal !== oldVal) {
this.sendAssertiveMessage(this.message);
}
},
immediate: true,
},
},
mounted() {
Expand All @@ -153,19 +179,6 @@
document.removeEventListener('focusin', this.focusChange);
},
methods: {
getMessage() {
let message = '';
if (this.isAdmin) {
message = this.$tr('superAdminMessage');
} else if (this.insufficientStorageNoDownloads) {
message = this.$tr('insufficientStorageNoDownloads');
} else if (this.learnOnlyRemovedResources) {
message = this.$tr('resourcesRemoved');
} else if (this.availableDownload) {
message = this.$tr('insufficientStorageAvailableDownloads');
}
return message;
},
closeBanner() {
this.setLastSyncedValue(this.lastSynced);
this.setDownloadRemovedValue(this.lastDownloadRemoved);
Expand Down
2 changes: 1 addition & 1 deletion packages/kolibri-core-for-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"js-cookie": "^3.0.5",
"knuth-shuffle-seeded": "^1.0.6",
"kolibri-constants": "0.2.6",
"kolibri-design-system": "4.3.2",
"kolibri-design-system": "5.0.0-rc1 ",
"lockr": "0.8.5",
"lodash": "^4.17.21",
"loglevel": "^1.9.1",
Expand Down
42 changes: 9 additions & 33 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7659,10 +7659,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/kolibri-constants/-/kolibri-constants-0.2.6.tgz#d13762862505a3a6ec58a104870b21da96778656"
integrity sha512-gQaY2wFNFrsB+9+xQNeEcLHixNuZEK+GHyKKr78s/hg8gFU3YVsnhlYp0u+du4XeVwewpyN1ajGb4UrrdF8rTA==

kolibri-design-system@4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/kolibri-design-system/-/kolibri-design-system-4.3.2.tgz#1779fb5958499bd0cb1a65591a5ec8a82e0a2248"
integrity sha512-hsApuzPGAYxkQpcVlVLcY4GSgZAyrOzLLt+CQGj9XM1Lep99kiJuLysyNP0ZxRzmT/kKjx4jvIA8Mi81Ui5pkw==
"kolibri-design-system@5.0.0-rc1 ":
version "5.0.0-rc1"
resolved "https://registry.yarnpkg.com/kolibri-design-system/-/kolibri-design-system-5.0.0-rc1.tgz#4d9ba7e24c3c96462479a500c5fd2df95c9ecc3f"
integrity sha512-W9OFtSDZNV0invXAW0he8dlj+m68BTjpsHXLQcO7GIwOpn0GZ5wjcPNGhQqCejLC0TefLCHPKNYiZFx+GIPCqw==
dependencies:
"@vue/composition-api" "1.7.2"
aphrodite "https://github.com/learningequality/aphrodite/"
Expand All @@ -7676,6 +7676,7 @@ [email protected]:
purecss "2.2.0"
tippy.js "4.2.1"
vue-intl "3.1.0"
vue2-teleport "1.1.4"
xstate "4.38.3"

launch-editor-middleware@^2.8.1:
Expand Down Expand Up @@ -10539,16 +10540,7 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -10607,14 +10599,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

[email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", [email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -11597,7 +11582,7 @@ [email protected]:
vue-observe-visibility "^0.4.4"
vue-resize "^0.4.5"

vue2-teleport@^1.1.4:
vue2-teleport@1.1.4, vue2-teleport@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/vue2-teleport/-/vue2-teleport-1.1.4.tgz#30c84b1005bf9c208b1c05f4b6147300c54ee846"
integrity sha512-mGTszyQP6k3sSSk7MBq+PZdVojHYLwg5772hl3UVpu5uaLBqWIZ5eNP6/TjkDrf1XUTTxybvpXC6inpjwO+i/Q==
Expand Down Expand Up @@ -11926,16 +11911,7 @@ word-wrap@^1.2.5:
resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.5.tgz#d2c45c6dd4fbce621a66f136cbe328afd0410b34"
integrity sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down
Loading