2022-08-01 21:37:48 +00:00
|
|
|
import Modal from 'src/components/modal/modal.vue'
|
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import pleromaTan from 'src/assets/pleromatan_apology.png'
|
|
|
|
import pleromaTanFox from 'src/assets/pleromatan_apology_fox.png'
|
|
|
|
|
|
|
|
import {
|
|
|
|
faTimes
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
library.add(
|
|
|
|
faTimes
|
|
|
|
)
|
|
|
|
|
2022-08-04 19:09:42 +00:00
|
|
|
export const CURRENT_UPDATE_COUNTER = 1
|
2022-08-03 22:56:52 +00:00
|
|
|
|
|
|
|
const UpdateNotification = {
|
2022-08-01 21:37:48 +00:00
|
|
|
data () {
|
|
|
|
return {
|
2022-08-03 22:56:52 +00:00
|
|
|
pleromaTanVariant: Math.random() > 0.5 ? pleromaTan : pleromaTanFox,
|
2022-08-03 23:12:04 +00:00
|
|
|
showingMore: false,
|
2022-08-03 22:56:52 +00:00
|
|
|
contentHeight: 0
|
2022-08-01 21:37:48 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
Modal
|
2022-08-03 22:56:52 +00:00
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
pleromaTanStyles () {
|
|
|
|
return {
|
|
|
|
'shape-outside': 'url(' + this.pleromaTanVariant + ')'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
shouldShow () {
|
2022-08-07 23:01:07 +00:00
|
|
|
return !this.$store.state.instance.disableUpdateNotification &&
|
2022-08-07 23:14:09 +00:00
|
|
|
this.$store.state.users.currentUser &&
|
2022-08-07 23:01:07 +00:00
|
|
|
this.$store.state.serverSideStorage.flagStorage.updateCounter < CURRENT_UPDATE_COUNTER &&
|
2022-08-03 22:56:52 +00:00
|
|
|
!this.$store.state.serverSideStorage.flagStorage.dontShowUpdateNotifs
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
toggleShow () {
|
|
|
|
this.showingMore = !this.showingMore
|
|
|
|
},
|
|
|
|
neverShowAgain () {
|
2022-08-03 23:12:04 +00:00
|
|
|
this.toggleShow()
|
2022-08-04 19:09:42 +00:00
|
|
|
this.$store.commit('setFlag', { flag: 'updateCounter', value: CURRENT_UPDATE_COUNTER })
|
|
|
|
this.$store.commit('setFlag', { flag: 'dontShowUpdateNotifs', value: 1 })
|
|
|
|
this.$store.dispatch('pushServerSideStorage')
|
2022-08-03 22:56:52 +00:00
|
|
|
},
|
|
|
|
dismiss () {
|
|
|
|
this.$store.commit('setFlag', { flag: 'updateCounter', value: CURRENT_UPDATE_COUNTER })
|
2022-08-04 19:09:42 +00:00
|
|
|
this.$store.dispatch('pushServerSideStorage')
|
2022-08-03 22:56:52 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
setTimeout(() => {
|
|
|
|
this.contentHeight = this.$refs.content.offsetHeight
|
|
|
|
}, 10)
|
2022-08-01 21:37:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-03 22:56:52 +00:00
|
|
|
export default UpdateNotification
|