This commit is contained in:
Natsumi
2025-12-09 17:13:49 +11:00
parent c5709f8ce5
commit 4a38aafa6f
3 changed files with 48 additions and 31 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ const favoriteReq = {
/** /**
* @param {{ * @param {{
* type: string, * type: string,
* group: string (name) * group: string
* }} params * }} params
* @return { Promise<{json: any, params}> } * @return { Promise<{json: any, params}> }
*/ */
+6 -5
View File
@@ -173,14 +173,15 @@
"new_group": "New Group", "new_group": "New Group",
"refresh": "Refresh", "refresh": "Refresh",
"cancel_refresh": "Cancel Refresh", "cancel_refresh": "Cancel Refresh",
"check_invalid": "Check Invalid Avatars in This Group", "check_invalid": "Check for deleted/private avatars",
"check_description": "Detect and remove invalid avatars in this group", "check_description": "Detect and remove invalid avatars from this group",
"checking": "Checking invalid avatars...", "checking": "Checking for invalid avatars...",
"check_progress": "Progress: {current}/{total}", "check_progress": "Progress: {current}/{total}",
"check_complete": "Check complete!", "check_complete": "Check complete!",
"check_summary": "Checked {total} avatars, found {invalid} invalid, removed {removed}", "check_summary": "Checked {total} avatars, found {invalid} invalid, removed {removed}",
"removed_list_header": "Removed avatar list:", "removed_list_header": "Avatars pending deletion:",
"copy_removed_ids": "Copy Removed Avatar IDs", "copy_removed_ids": "Copy Avatar IDs",
"copied_ids": "Avatar IDs copied to clipboard",
"checking_progress": "Checking avatar ({current}/{total})...", "checking_progress": "Checking avatar ({current}/{total})...",
"confirm_delete_invalid": "Delete Invalid Avatars?", "confirm_delete_invalid": "Delete Invalid Avatars?",
"confirm_delete_description": "Found {count} invalid avatars, delete them?", "confirm_delete_description": "Found {count} invalid avatars, delete them?",
+41 -25
View File
@@ -500,8 +500,8 @@
<script setup> <script setup>
import { computed, h, nextTick, onBeforeMount, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue'; import { computed, h, nextTick, onBeforeMount, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
import { Loading, MoreFilled, Plus, Refresh } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox, ElNotification, ElProgress } from 'element-plus'; import { ElMessage, ElMessageBox, ElNotification, ElProgress } from 'element-plus';
import { Loading, MoreFilled, Plus, Refresh } from '@element-plus/icons-vue';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
@@ -1084,7 +1084,7 @@
async function handleCheckInvalidAvatars(groupName) { async function handleCheckInvalidAvatars(groupName) {
handleGroupMenuVisible(localGroupMenuKey(groupName), false); handleGroupMenuVisible(localGroupMenuKey(groupName), false);
try { try {
await ElMessageBox.confirm( await ElMessageBox.confirm(
t('view.favorite.avatars.check_description'), t('view.favorite.avatars.check_description'),
@@ -1107,23 +1107,28 @@
const ProgressContent = { const ProgressContent = {
setup() { setup() {
return () => h('div', { style: 'padding: 4px 0;' }, [ return () =>
h('p', { h('div', { style: 'padding: 4px 0;' }, [
style: 'margin: 0 0 12px 0; font-size: 14px; color: var(--el-text-color-primary);' h(
}, t('view.favorite.avatars.checking_progress', { 'p',
current: progressState.current, {
total: progressState.total style: 'margin: 0 0 12px 0; font-size: 14px; color: var(--el-text-color-primary);'
})), },
h(ElProgress, { t('view.favorite.avatars.checking_progress', {
percentage: progressState.percentage, current: progressState.current,
style: 'margin-top: 8px;' total: progressState.total
}) })
]); ),
h(ElProgress, {
percentage: progressState.percentage,
style: 'margin-top: 8px;'
})
]);
} }
}; };
let progressNotification = null; let progressNotification = null;
try { try {
progressNotification = ElNotification({ progressNotification = ElNotification({
title: t('view.favorite.avatars.checking'), title: t('view.favorite.avatars.checking'),
@@ -1157,17 +1162,25 @@
const confirmDelete = await ElMessageBox.confirm( const confirmDelete = await ElMessageBox.confirm(
h('div', [ h('div', [
h('p', { style: 'margin-bottom: 12px;' }, h(
'p',
{ style: 'margin-bottom: 12px;' },
t('view.favorite.avatars.confirm_delete_description', { count: result.invalid }) t('view.favorite.avatars.confirm_delete_description', { count: result.invalid })
), ),
h('div', { style: 'margin-top: 12px; margin-bottom: 8px; font-weight: 600;' }, h(
'div',
{ style: 'margin-top: 12px; margin-bottom: 8px; font-weight: 600;' },
t('view.favorite.avatars.removed_list_header') t('view.favorite.avatars.removed_list_header')
), ),
h('div', { h(
style: 'max-height: 200px; overflow-y: auto; background: var(--el-fill-color-lighter); padding: 8px; border-radius: 4px;' 'div',
}, result.invalidIds.map(id => {
h('div', { style: 'font-family: monospace; font-size: 12px; padding: 2px 0;' }, id) style: 'max-height: 200px; overflow-y: auto; background: var(--el-fill-color-lighter); padding: 8px; border-radius: 4px;'
)) },
result.invalidIds.map((id) =>
h('div', { style: 'font-family: monospace; font-size: 12px; padding: 2px 0;' }, id)
)
)
]), ]),
t('view.favorite.avatars.confirm_delete_invalid'), t('view.favorite.avatars.confirm_delete_invalid'),
{ {
@@ -1177,10 +1190,11 @@
type: 'warning', type: 'warning',
beforeClose: (action, instance, done) => { beforeClose: (action, instance, done) => {
if (action === 'cancel') { if (action === 'cancel') {
navigator.clipboard.writeText(result.invalidIds.join('\n')) navigator.clipboard
.writeText(result.invalidIds.join('\n'))
.then(() => { .then(() => {
ElMessage({ ElMessage({
message: t('dialog.user.info.copy_id'), message: t('view.favorite.avatars.copied_ids'),
type: 'success' type: 'success'
}); });
}) })
@@ -1195,7 +1209,9 @@
done(); done();
} }
} }
).then(() => true).catch(() => false); )
.then(() => true)
.catch(() => false);
if (!confirmDelete) { if (!confirmDelete) {
ElNotification({ ElNotification({