diff options
| author | Henry Jameson <me@hjkos.com> | 2022-08-04 01:56:52 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2022-08-04 01:56:52 +0300 |
| commit | dbfca224d812c2ba80a48852ba047bb65c4c6dd9 (patch) | |
| tree | b764284bf0bfe1348482cb4097c1b63c06118a7f /src/components/update_notification/update_notification.js | |
| parent | 5b7c6538745083dfd48771392ab22de557a7a344 (diff) | |
server-side storage for flags
Diffstat (limited to 'src/components/update_notification/update_notification.js')
| -rw-r--r-- | src/components/update_notification/update_notification.js | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/components/update_notification/update_notification.js b/src/components/update_notification/update_notification.js index 6b8665dd..1dd771eb 100644 --- a/src/components/update_notification/update_notification.js +++ b/src/components/update_notification/update_notification.js @@ -10,15 +10,49 @@ library.add( faTimes ) -const SettingsModal = { +const CURRENT_UPDATE_COUNTER = 1 + +const UpdateNotification = { data () { return { - pleromaTanVariant: Math.random() > 0.5 ? pleromaTan : pleromaTanFox + pleromaTanVariant: Math.random() > 0.5 ? pleromaTan : pleromaTanFox, + showingMore: true, + contentHeight: 0 } }, components: { Modal + }, + computed: { + pleromaTanStyles () { + return { + 'shape-outside': 'url(' + this.pleromaTanVariant + ')' + } + }, + shouldShow () { + return this.$store.state.serverSideStorage.flagStorage.updateCounter < CURRENT_UPDATE_COUNTER && + !this.$store.state.serverSideStorage.flagStorage.dontShowUpdateNotifs + } + }, + methods: { + toggleShow () { + this.showingMore = !this.showingMore + }, + neverShowAgain () { + this.$store.commit('setFlag', { flag: 'updateCounter', value: CURRENT_UPDATE_COUNTER }) + this.$store.commit('setFlag', { flag: 'dontShowUpdateNotifs', value: 1 }) + this.$store.dispatch('pushServerSideStorage') + }, + dismiss () { + this.$store.commit('setFlag', { flag: 'updateCounter', value: CURRENT_UPDATE_COUNTER }) + this.$store.dispatch('pushServerSideStorage') + } + }, + mounted () { + setTimeout(() => { + this.contentHeight = this.$refs.content.offsetHeight + }, 10) } } -export default SettingsModal +export default UpdateNotification |
