Skip to content

Commit

Permalink
Adds feedback from pr after rebase. Also streamlines use of showBanne…
Browse files Browse the repository at this point in the history
…r vs bannerOpened
  • Loading branch information
akolson committed Jul 18, 2023
1 parent a7008db commit 07027d1
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions kolibri/core/assets/src/views/StorageNotification.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<div v-if="showBanner" class="banner" :style="{ background: $themeTokens.surface }">
<div v-if="bannerOpened" class="banner" :style="{ background: $themeTokens.surface }">
<div class="banner-inner">
<h1 style="display: none">
{{ $tr('bannerHeading') }}
Expand Down Expand Up @@ -97,7 +97,9 @@
};
},
data() {
return {};
return {
bannerOpened: false,
};
},
computed: {
...mapGetters(['isLearner', 'isAdmin', 'canManageContent']),
Expand All @@ -123,6 +125,16 @@
);
},
},
watch: {
showBanner: {
handler(newVal, oldValue) {
if (newVal !== oldValue) {
this.bannerOpened = newVal;
}
},
deep: true,
},
},
mounted() {
document.addEventListener('focusin', this.focusChange);
},
Expand All @@ -146,15 +158,16 @@
closeBanner() {
this.setLastSyncedValue(this.lastSynced);
this.setDownloadRemovedValue(this.lastDownloadRemoved);
this.showBanner = false;
this.bannerOpened = false;
if (this.previouslyFocusedElement) {
this.previouslyFocusedElement.focus();
}
},
manageChannel() {
if (!this.isLearner) {
redirectBrowser(urls['kolibri:kolibri.plugins.device:device_management']());
const deviceManagementUrl = urls['kolibri:kolibri.plugins.device:device_management']();
if (this.canManageContent && deviceManagementUrl) {
redirectBrowser(deviceManagementUrl);
} else {
this.bannerOpened = false;
}
Expand Down

0 comments on commit 07027d1

Please sign in to comment.