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

View File

@@ -108,7 +108,7 @@ const favoriteReq = {
/**
* @param {{
* type: string,
* group: string (name)
* group: string
* }} params
* @return { Promise<{json: any, params}> }
*/

View File

@@ -173,14 +173,15 @@
"new_group": "New Group",
"refresh": "Refresh",
"cancel_refresh": "Cancel Refresh",
"check_invalid": "Check Invalid Avatars in This Group",
"check_description": "Detect and remove invalid avatars in this group",
"checking": "Checking invalid avatars...",
"check_invalid": "Check for deleted/private avatars",
"check_description": "Detect and remove invalid avatars from this group",
"checking": "Checking for invalid avatars...",
"check_progress": "Progress: {current}/{total}",
"check_complete": "Check complete!",
"check_summary": "Checked {total} avatars, found {invalid} invalid, removed {removed}",
"removed_list_header": "Removed avatar list:",
"copy_removed_ids": "Copy Removed Avatar IDs",
"removed_list_header": "Avatars pending deletion:",
"copy_removed_ids": "Copy Avatar IDs",
"copied_ids": "Avatar IDs copied to clipboard",
"checking_progress": "Checking avatar ({current}/{total})...",
"confirm_delete_invalid": "Delete Invalid Avatars?",
"confirm_delete_description": "Found {count} invalid avatars, delete them?",

View File

@@ -500,8 +500,8 @@
<script setup>
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 { Loading, MoreFilled, Plus, Refresh } from '@element-plus/icons-vue';
import { storeToRefs } from 'pinia';
import { useI18n } from 'vue-i18n';
@@ -1084,7 +1084,7 @@
async function handleCheckInvalidAvatars(groupName) {
handleGroupMenuVisible(localGroupMenuKey(groupName), false);
try {
await ElMessageBox.confirm(
t('view.favorite.avatars.check_description'),
@@ -1107,23 +1107,28 @@
const ProgressContent = {
setup() {
return () => h('div', { style: 'padding: 4px 0;' }, [
h('p', {
style: 'margin: 0 0 12px 0; font-size: 14px; color: var(--el-text-color-primary);'
}, t('view.favorite.avatars.checking_progress', {
current: progressState.current,
total: progressState.total
})),
h(ElProgress, {
percentage: progressState.percentage,
style: 'margin-top: 8px;'
})
]);
return () =>
h('div', { style: 'padding: 4px 0;' }, [
h(
'p',
{
style: 'margin: 0 0 12px 0; font-size: 14px; color: var(--el-text-color-primary);'
},
t('view.favorite.avatars.checking_progress', {
current: progressState.current,
total: progressState.total
})
),
h(ElProgress, {
percentage: progressState.percentage,
style: 'margin-top: 8px;'
})
]);
}
};
let progressNotification = null;
try {
progressNotification = ElNotification({
title: t('view.favorite.avatars.checking'),
@@ -1157,17 +1162,25 @@
const confirmDelete = await ElMessageBox.confirm(
h('div', [
h('p', { style: 'margin-bottom: 12px;' },
h(
'p',
{ style: 'margin-bottom: 12px;' },
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')
),
h('div', {
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)
))
h(
'div',
{
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'),
{
@@ -1177,10 +1190,11 @@
type: 'warning',
beforeClose: (action, instance, done) => {
if (action === 'cancel') {
navigator.clipboard.writeText(result.invalidIds.join('\n'))
navigator.clipboard
.writeText(result.invalidIds.join('\n'))
.then(() => {
ElMessage({
message: t('dialog.user.info.copy_id'),
message: t('view.favorite.avatars.copied_ids'),
type: 'success'
});
})
@@ -1195,7 +1209,9 @@
done();
}
}
).then(() => true).catch(() => false);
)
.then(() => true)
.catch(() => false);
if (!confirmDelete) {
ElNotification({