aboutsummaryrefslogtreecommitdiff
path: root/src/components/update_notification/update_notification.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/update_notification/update_notification.js')
-rw-r--r--src/components/update_notification/update_notification.js40
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