-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create ResourceSyncingUiAlert around MissingResourceAlert to use in L…
…earn Plugin
- Loading branch information
1 parent
3c012b2
commit a6d9925
Showing
5 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
kolibri/plugins/learn/assets/src/views/ResourceSyncingUiAlert.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<template> | ||
|
||
<MissingResourceAlert> | ||
<template v-if="isSyncing" #syncAlert> | ||
{{ syncMessage }} | ||
</template> | ||
</MissingResourceAlert> | ||
|
||
</template> | ||
|
||
|
||
<script> | ||
import MissingResourceAlert from 'kolibri-common/components/MissingResourceAlert.vue'; | ||
import useUserSyncStatus from 'kolibri.coreVue.composables.useUserSyncStatus'; | ||
import { SyncStatus } from 'kolibri.coreVue.vuex.constants'; | ||
import { createTranslator } from 'kolibri.utils.i18n'; | ||
const syncStatusDescriptionStrings = createTranslator('SyncStatusDescription', { | ||
syncingDescription: { | ||
message: 'The device is currently syncing.', | ||
context: 'Description of the device syncing status.', | ||
}, | ||
queuedDescription: { | ||
message: 'The device is waiting to sync.', | ||
context: 'Description of the device syncing status', | ||
}, | ||
}); | ||
export default { | ||
name: 'ResourceSyncingUiAlert', | ||
components: { | ||
MissingResourceAlert, | ||
}, | ||
setup() { | ||
const { status } = useUserSyncStatus(); | ||
return { | ||
status, | ||
}; | ||
}, | ||
computed: { | ||
isSyncing() { | ||
return this.status == SyncStatus.QUEUED || this.status == SyncStatus.SYNCING; | ||
}, | ||
syncMessage() { | ||
/* eslint-disable kolibri/vue-no-undefined-string-uses */ | ||
return this.status == SyncStatus.QUEUED | ||
? syncStatusDescriptionStrings.$tr('queuedDescription') | ||
: syncStatusDescriptionStrings.$tr('syncingDescription'); | ||
/* eslint-enable */ | ||
}, | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters