This commit is contained in:
Henry Jameson 2024-03-07 00:38:19 +02:00
parent 34f23b992e
commit afc94c6801
4 changed files with 162 additions and 81 deletions

View File

@ -13,13 +13,15 @@
<button <button
class="button button-default btn" class="button button-default btn"
type="button" type="button"
@click="reloadEmoji"> @click="reloadEmoji"
>
{{ $t('admin_dash.emoji.reload') }} {{ $t('admin_dash.emoji.reload') }}
</button> </button>
<button <button
class="button button-default btn" class="button button-default btn"
type="button" type="button"
@click="importFromFS"> @click="importFromFS"
>
{{ $t('admin_dash.emoji.importFS') }} {{ $t('admin_dash.emoji.importFS') }}
</button> </button>
</li> </li>
@ -28,7 +30,8 @@
<button <button
class="button button-default btn" class="button button-default btn"
type="button" type="button"
@click="$refs.remotePackPopover.showPopover"> @click="$refs.remotePackPopover.showPopover"
>
{{ $t('admin_dash.emoji.remote_packs') }} {{ $t('admin_dash.emoji.remote_packs') }}
<Popover <Popover
@ -51,7 +54,8 @@
<button <button
class="button button-default btn emoji-tab-popover-button" class="button button-default btn emoji-tab-popover-button"
type="button" type="button"
@click="listRemotePacks"> @click="listRemotePacks"
>
{{ $t('admin_dash.emoji.do_list') }} {{ $t('admin_dash.emoji.do_list') }}
</button> </button>
</div> </div>
@ -65,9 +69,22 @@
<li> <li>
<h4>{{ $t('admin_dash.emoji.edit_pack') }}</h4> <h4>{{ $t('admin_dash.emoji.edit_pack') }}</h4>
<Select class="form-control" v-model="packName"> <Select
<option value="" disabled hidden>{{ $t('admin_dash.emoji.emoji_pack') }}</option> v-model="packName"
<option v-for="(pack, listPackName) in knownPacks" :label="listPackName" :key="listPackName"> class="form-control"
>
<option
value=""
disabled
hidden
>
{{ $t('admin_dash.emoji.emoji_pack') }}
</option>
<option
v-for="(pack, listPackName) in knownPacks"
:key="listPackName"
:label="listPackName"
>
{{ listPackName }} {{ listPackName }}
</option> </option>
</Select> </Select>
@ -75,7 +92,8 @@
<button <button
class="button button-default btn emoji-tab-popover-button" class="button button-default btn emoji-tab-popover-button"
type="button" type="button"
@click="$refs.createPackPopover.showPopover"> @click="$refs.createPackPopover.showPopover"
>
{{ $t('admin_dash.emoji.create_pack') }} {{ $t('admin_dash.emoji.create_pack') }}
</button> </button>
<Popover <Popover
@ -98,7 +116,8 @@
<button <button
class="button button-default btn emoji-tab-popover-button" class="button button-default btn emoji-tab-popover-button"
type="button" type="button"
@click="createEmojiPack"> @click="createEmojiPack"
>
{{ $t('admin_dash.emoji.create') }} {{ $t('admin_dash.emoji.create') }}
</button> </button>
</div> </div>
@ -113,7 +132,10 @@
<li> <li>
<label> <label>
{{ $t('admin_dash.emoji.description') }} {{ $t('admin_dash.emoji.description') }}
<ModifiedIndicator :changed="metaEdited('description')" message-key="admin_dash.emoji.metadata_changed" /> <ModifiedIndicator
:changed="metaEdited('description')"
message-key="admin_dash.emoji.metadata_changed"
/>
<textarea <textarea
v-model="packMeta.description" v-model="packMeta.description"
@ -125,22 +147,29 @@
<li> <li>
<label> <label>
{{ $t('admin_dash.emoji.homepage') }} {{ $t('admin_dash.emoji.homepage') }}
<ModifiedIndicator :changed="metaEdited('homepage')" message-key="admin_dash.emoji.metadata_changed" /> <ModifiedIndicator
:changed="metaEdited('homepage')"
message-key="admin_dash.emoji.metadata_changed"
/>
<input <input
class="emoji-info-input input"
v-model="packMeta.homepage" v-model="packMeta.homepage"
:disabled="pack.remote !== undefined"> class="emoji-info-input input"
:disabled="pack.remote !== undefined"
>
</label> </label>
</li> </li>
<li> <li>
<label> <label>
{{ $t('admin_dash.emoji.fallback_src') }} {{ $t('admin_dash.emoji.fallback_src') }}
<ModifiedIndicator :changed="metaEdited('fallback-src')" message-key="admin_dash.emoji.metadata_changed" /> <ModifiedIndicator
:changed="metaEdited('fallback-src')"
message-key="admin_dash.emoji.metadata_changed"
/>
<input <input
class="emoji-info-input input"
v-model="packMeta['fallback-src']" v-model="packMeta['fallback-src']"
class="emoji-info-input input"
:disabled="pack.remote !== undefined" :disabled="pack.remote !== undefined"
> >
</label> </label>
@ -150,40 +179,49 @@
{{ $t('admin_dash.emoji.fallback_sha256') }} {{ $t('admin_dash.emoji.fallback_sha256') }}
<input <input
v-model="packMeta['fallback-src-sha256']"
:disabled="true" :disabled="true"
class="emoji-info-input input" class="emoji-info-input input"
v-model="packMeta['fallback-src-sha256']"
> >
</label> </label>
</li> </li>
<li> <li>
<Checkbox :disabled="pack.remote !== undefined" v-model="packMeta['share-files']"> <Checkbox
v-model="packMeta['share-files']"
:disabled="pack.remote !== undefined"
>
{{ $t('admin_dash.emoji.share') }} {{ $t('admin_dash.emoji.share') }}
</Checkbox> </Checkbox>
<ModifiedIndicator :changed="metaEdited('share-files')" message-key="admin_dash.emoji.metadata_changed" /> <ModifiedIndicator
:changed="metaEdited('share-files')"
message-key="admin_dash.emoji.metadata_changed"
/>
</li> </li>
<li class="btn-group"> <li class="btn-group">
<button <button
v-if="pack.remote === undefined"
class="button button-default btn" class="button button-default btn"
type="button" type="button"
v-if="pack.remote === undefined" @click="savePackMetadata"
@click="savePackMetadata"> >
{{ $t('admin_dash.emoji.save_meta') }} {{ $t('admin_dash.emoji.save_meta') }}
</button> </button>
<button <button
v-if="pack.remote === undefined"
class="button button-default btn" class="button button-default btn"
type="button" type="button"
v-if="pack.remote === undefined" @click="savePackMetadata"
@click="savePackMetadata"> >
{{ $t('admin_dash.emoji.revert_meta') }} {{ $t('admin_dash.emoji.revert_meta') }}
</button> </button>
<button <button
class="button button-default btn"
v-if="pack.remote === undefined" v-if="pack.remote === undefined"
class="button button-default btn"
type="button" type="button"
@click="deleteModalVisible = true"> @click="deleteModalVisible = true"
>
{{ $t('admin_dash.emoji.delete_pack') }} {{ $t('admin_dash.emoji.delete_pack') }}
<ConfirmModal <ConfirmModal
@ -192,16 +230,18 @@
:cancel-text="$t('status.delete_confirm_cancel_button')" :cancel-text="$t('status.delete_confirm_cancel_button')"
:confirm-text="$t('status.delete_confirm_accept_button')" :confirm-text="$t('status.delete_confirm_accept_button')"
@cancelled="deleteModalVisible = false" @cancelled="deleteModalVisible = false"
@accepted="deleteEmojiPack" > @accepted="deleteEmojiPack"
>
{{ $t('admin_dash.emoji.delete_confirm', [packName]) }} {{ $t('admin_dash.emoji.delete_confirm', [packName]) }}
</ConfirmModal> </ConfirmModal>
</button> </button>
<button <button
v-if="pack.remote !== undefined"
class="button button-default btn" class="button button-default btn"
type="button" type="button"
v-if="pack.remote !== undefined" @click="$refs.dlPackPopover.showPopover"
@click="$refs.dlPackPopover.showPopover"> >
{{ $t('admin_dash.emoji.download_pack') }} {{ $t('admin_dash.emoji.download_pack') }}
<Popover <Popover
@ -221,13 +261,16 @@
<label> <label>
{{ $t('admin_dash.emoji.download_as_name') }} {{ $t('admin_dash.emoji.download_as_name') }}
<input <input
class="emoji-data-input input"
v-model="remotePackDownloadAs" v-model="remotePackDownloadAs"
class="emoji-data-input input"
:placeholder="$t('admin_dash.emoji.download_as_name_full')" :placeholder="$t('admin_dash.emoji.download_as_name_full')"
> >
</label> </label>
<div v-if="downloadWillReplaceLocal" class="warning"> <div
v-if="downloadWillReplaceLocal"
class="warning"
>
<em>{{ $t('admin_dash.emoji.replace_warning') }}</em> <em>{{ $t('admin_dash.emoji.replace_warning') }}</em>
</div> </div>
</div> </div>
@ -235,7 +278,8 @@
<button <button
class="button button-default btn" class="button button-default btn"
type="button" type="button"
@click="downloadRemotePack"> @click="downloadRemotePack"
>
{{ $t('admin_dash.emoji.download') }} {{ $t('admin_dash.emoji.download') }}
</button> </button>
</div> </div>
@ -251,31 +295,47 @@
<h4> <h4>
{{ $t('admin_dash.emoji.files') }} {{ $t('admin_dash.emoji.files') }}
<ModifiedIndicator v-if="pack" <ModifiedIndicator
v-if="pack"
:changed="$refs.emojiPopovers && $refs.emojiPopovers.some(p => p.isEdited)" :changed="$refs.emojiPopovers && $refs.emojiPopovers.some(p => p.isEdited)"
message-key="admin_dash.emoji.emoji_changed"/> message-key="admin_dash.emoji.emoji_changed"
/>
</h4> </h4>
<div class="emoji-list" v-if="pack"> <div
v-if="pack"
class="emoji-list"
>
<EmojiEditingPopover <EmojiEditingPopover
v-if="pack.remote === undefined" v-if="pack.remote === undefined"
placement="bottom" new-upload placement="bottom"
new-upload
:title="$t('admin_dash.emoji.adding_new')" :title="$t('admin_dash.emoji.adding_new')"
:packName="packName" :pack-name="packName"
@updatePackFiles="updatePackFiles" @displayError="displayError" @updatePackFiles="updatePackFiles"
@displayError="displayError"
> >
<template #trigger> <template #trigger>
<FAIcon icon="plus" size="2x" :title="$t('admin_dash.emoji.add_file')" /> <FAIcon
icon="plus"
size="2x"
:title="$t('admin_dash.emoji.add_file')"
/>
</template> </template>
</EmojiEditingPopover> </EmojiEditingPopover>
<EmojiEditingPopover <EmojiEditingPopover
placement="top" ref="emojiPopovers" v-for="(file, shortcode) in pack.files"
v-for="(file, shortcode) in pack.files" :key="shortcode" ref="emojiPopovers"
:key="shortcode"
placement="top"
:title="$t('admin_dash.emoji.editing', [shortcode])" :title="$t('admin_dash.emoji.editing', [shortcode])"
:disabled="pack.remote !== undefined" :disabled="pack.remote !== undefined"
:shortcode="shortcode" :file="file" :packName="packName" :shortcode="shortcode"
@updatePackFiles="updatePackFiles" @displayError="displayError" :file="file"
:pack-name="packName"
@updatePackFiles="updatePackFiles"
@displayError="displayError"
> >
<template #trigger> <template #trigger>
<StillImage <StillImage

View File

@ -6,7 +6,10 @@
<div class="setting-item"> <div class="setting-item">
<h2>{{ $t('admin_dash.tabs.frontends') }}</h2> <h2>{{ $t('admin_dash.tabs.frontends') }}</h2>
<p>{{ $t('admin_dash.frontend.wip_notice') }}</p> <p>{{ $t('admin_dash.frontend.wip_notice') }}</p>
<ul class="setting-list" v-if="adminDraft"> <ul
v-if="adminDraft"
class="setting-list"
>
<li> <li>
<h3>{{ $t('admin_dash.frontend.default_frontend') }}</h3> <h3>{{ $t('admin_dash.frontend.default_frontend') }}</h3>
<p>{{ $t('admin_dash.frontend.default_frontend_tip') }}</p> <p>{{ $t('admin_dash.frontend.default_frontend_tip') }}</p>
@ -23,7 +26,10 @@
</ul> </ul>
</li> </li>
</ul> </ul>
<div v-else class="setting-list"> <div
v-else
class="setting-list"
>
{{ $t('admin_dash.frontend.default_frontend_unavail') }} {{ $t('admin_dash.frontend.default_frontend_unavail') }}
</div> </div>

View File

@ -1,10 +1,10 @@
<template> <template>
<Popover <Popover
ref="emojiPopover"
trigger="click" trigger="click"
:placement="placement" :placement="placement"
bound-to-selector=".emoji-list" bound-to-selector=".emoji-list"
popover-class="emoji-tab-edit-popover popover-default" popover-class="emoji-tab-edit-popover popover-default"
ref="emojiPopover"
:bound-to="{ x: 'container' }" :bound-to="{ x: 'container' }"
:offset="{ y: 5 }" :offset="{ y: 5 }"
:disabled="disabled" :disabled="disabled"
@ -18,23 +18,34 @@
{{ title }} {{ title }}
</h3> </h3>
<StillImage class="emoji" v-if="emojiPreview" :src="emojiPreview" /> <StillImage
<div v-else class="emoji"></div> v-if="emojiPreview"
class="emoji"
:src="emojiPreview"
/>
<div
v-else
class="emoji"
/>
<div class="emoji-tab-popover-input" v-if="newUpload"> <div
v-if="newUpload"
class="emoji-tab-popover-input"
>
<input <input
type="file" type="file"
accept="image/*" accept="image/*"
class="emoji-tab-popover-file input" class="emoji-tab-popover-file input"
@change="uploadFile = $event.target.files"> @change="uploadFile = $event.target.files"
>
</div> </div>
<div> <div>
<div class="emoji-tab-popover-input"> <div class="emoji-tab-popover-input">
<label> <label>
{{ $t('admin_dash.emoji.shortcode') }} {{ $t('admin_dash.emoji.shortcode') }}
<input <input
class="emoji-data-input input"
v-model="editedShortcode" v-model="editedShortcode"
class="emoji-data-input input"
:placeholder="$t('admin_dash.emoji.new_shortcode')" :placeholder="$t('admin_dash.emoji.new_shortcode')"
> >
</label> </label>
@ -45,8 +56,8 @@
{{ $t('admin_dash.emoji.filename') }} {{ $t('admin_dash.emoji.filename') }}
<input <input
class="emoji-data-input input"
v-model="editedFile" v-model="editedFile"
class="emoji-data-input input"
:placeholder="$t('admin_dash.emoji.new_filename')" :placeholder="$t('admin_dash.emoji.new_filename')"
> >
</label> </label>
@ -56,7 +67,8 @@
class="button button-default btn" class="button button-default btn"
type="button" type="button"
:disabled="newUpload ? uploadFile.length == 0 : !isEdited" :disabled="newUpload ? uploadFile.length == 0 : !isEdited"
@click="newUpload ? uploadEmoji() : saveEditedEmoji()"> @click="newUpload ? uploadEmoji() : saveEditedEmoji()"
>
{{ $t('admin_dash.emoji.save') }} {{ $t('admin_dash.emoji.save') }}
</button> </button>
@ -64,13 +76,15 @@
<button <button
class="button button-default btn emoji-tab-popover-button" class="button button-default btn emoji-tab-popover-button"
type="button" type="button"
@click="deleteModalVisible = true"> @click="deleteModalVisible = true"
>
{{ $t('admin_dash.emoji.delete') }} {{ $t('admin_dash.emoji.delete') }}
</button> </button>
<button <button
class="button button-default btn emoji-tab-popover-button" class="button button-default btn emoji-tab-popover-button"
type="button" type="button"
@click="revertEmoji"> @click="revertEmoji"
>
{{ $t('admin_dash.emoji.revert') }} {{ $t('admin_dash.emoji.revert') }}
</button> </button>
<ConfirmModal <ConfirmModal
@ -79,7 +93,8 @@
:cancel-text="$t('status.delete_confirm_cancel_button')" :cancel-text="$t('status.delete_confirm_cancel_button')"
:confirm-text="$t('status.delete_confirm_accept_button')" :confirm-text="$t('status.delete_confirm_accept_button')"
@cancelled="deleteModalVisible = false" @cancelled="deleteModalVisible = false"
@accepted="deleteEmoji" > @accepted="deleteEmoji"
>
{{ $t('admin_dash.emoji.delete_confirm', [shortcode]) }} {{ $t('admin_dash.emoji.delete_confirm', [shortcode]) }}
</ConfirmModal> </ConfirmModal>
</template> </template>
@ -95,6 +110,30 @@ import StillImage from 'components/still-image/still-image.vue'
export default { export default {
components: { Popover, ConfirmModal, StillImage }, components: { Popover, ConfirmModal, StillImage },
inject: ['emojiAddr'],
props: {
placement: String,
disabled: {
type: Boolean,
default: false
},
newUpload: Boolean,
title: String,
packName: String,
shortcode: {
type: String,
// Only exists when this is not a new upload
default: ''
},
file: {
type: String,
// Only exists when this is not a new upload
default: ''
}
},
emits: ['updatePackFiles', 'displayError'],
data () { data () {
return { return {
uploadFile: [], uploadFile: [],
@ -117,7 +156,6 @@ export default {
return !this.newUpload && (this.editedShortcode !== this.shortcode || this.editedFile !== this.file) return !this.newUpload && (this.editedShortcode !== this.shortcode || this.editedFile !== this.file)
} }
}, },
inject: ['emojiAddr'],
methods: { methods: {
saveEditedEmoji () { saveEditedEmoji () {
if (!this.isEdited) return if (!this.isEdited) return
@ -171,29 +209,6 @@ export default {
this.$emit('updatePackFiles', resp) this.$emit('updatePackFiles', resp)
}) })
} }
},
emits: ['updatePackFiles', 'displayError'],
props: {
placement: String,
disabled: {
type: Boolean,
default: false
},
newUpload: Boolean,
title: String,
packName: String,
shortcode: {
type: String,
// Only exists when this is not a new upload
default: ''
},
file: {
type: String,
// Only exists when this is not a new upload
default: ''
}
} }
} }
</script> </script>

View File

@ -89,8 +89,8 @@
</div> </div>
<div <div
v-if="followersTabVisible" v-if="followersTabVisible"
class="panel-body"
key="followers" key="followers"
class="panel-body"
:label="$t('user_card.followers')" :label="$t('user_card.followers')"
:disabled="!user.followers_count" :disabled="!user.followers_count"
> >