forgot file
This commit is contained in:
parent
e2b4c712af
commit
f93f2b2f76
1 changed files with 72 additions and 0 deletions
72
src/components/still-image/still-image-emoji-popover.js
Normal file
72
src/components/still-image/still-image-emoji-popover.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import Popover from 'components/popover/popover.vue'
|
||||
import SelectComponent from 'components/select/select.vue'
|
||||
|
||||
import StillImage from './still-image.vue'
|
||||
import { mapState } from 'pinia'
|
||||
|
||||
import { useInterfaceStore } from 'src/stores/interface'
|
||||
import { useEmojiStore } from 'src/stores/emoji'
|
||||
|
||||
export default {
|
||||
components: { StillImage, Popover, SelectComponent },
|
||||
props: {
|
||||
shortcode: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
isLocal: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
packName: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isUserAdmin() {
|
||||
return this.$store.state.users.currentUser?.rights.admin
|
||||
},
|
||||
...mapState(useEmojiStore, ['adminPacksLocal', 'adminPacksLocalLoading'])
|
||||
},
|
||||
methods: {
|
||||
displayError(msg) {
|
||||
useInterfaceStore().pushGlobalNotice({
|
||||
messageKey: 'admin_dash.emoji.error',
|
||||
messageArgs: [msg],
|
||||
level: 'error',
|
||||
})
|
||||
},
|
||||
copyToLocalPack() {
|
||||
this.$store.state.api.backendInteractor
|
||||
.addNewEmojiFile({
|
||||
packName: this.packName,
|
||||
file: this.$attrs.src,
|
||||
shortcode: this.shortcode,
|
||||
filename: '',
|
||||
})
|
||||
.then((resp) => resp.json())
|
||||
.then((resp) => {
|
||||
if (resp.error !== undefined) {
|
||||
this.displayError(resp.error)
|
||||
return
|
||||
}
|
||||
useInterfaceStore().pushGlobalNotice({
|
||||
messageKey: 'admin_dash.emoji.copied_successfully',
|
||||
messageArgs: [this.shortcode, this.packName],
|
||||
level: 'success',
|
||||
})
|
||||
|
||||
this.$refs.emojiPopover.hidePopover()
|
||||
this.packName = ''
|
||||
})
|
||||
},
|
||||
|
||||
fetchEmojiPacksIfAdmin() {
|
||||
useEmojiStore().getAdminPacksLocal().then(() => {
|
||||
this.$refs.emojiPopover.updateStyles()
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue