v1.4.7: 类型文案全面去「张」——注册表驱动 countLabel/typeCountsOf,补 design/other 类型行,统计图例按注册表顺序展示

This commit is contained in:
jinghui committed 2026-11-18 22:30:57 +08:00
1 parent 58900d0d45
commit c59791f994
16 files changed
+215 -40

No files matched your search

+19 -18
View File
@@ -9,6 +9,7 @@ import { imageAPI, fileAPI } from '../api';
import JSZip from 'jszip';
import RatingStars from './RatingStars';
import { createLogger } from '../utils/logger';
import { typeMeta, typeCountsOf, countLabel, typeLabelOf } from '../utils/fileTypes';
const logger = createLogger('RightPanel');
@@ -321,7 +322,7 @@ function RightPanel() {
setSelectedImages(updatedSelectedImages);
}
logger.file(`已更新 ${paths.length} 张图片的评分为 ${newRating} 星`);
logger.file(`已更新 ${paths.length} 个文件的评分为 ${newRating} 星`);
} catch (error) {
logger.error('更新评分失败:', error);
alert('更新评分失败: ' + (error.message || '未知错误'));
@@ -779,8 +780,9 @@ function RightPanel() {
return selectedImage ? [selectedImage] : [];
};
// 选中集合是否含视频(决定多选计数单位文案:视频用「个」,图片用「张」)
const selectionHasVideo = getImagesToProcess().some(img => img?.fileType === 'video');
// 选中集合类型计数(由类型注册表驱动文案:图片/视频/文档…混合自动按"文件")
const selectionTypeCounts = typeCountsOf(getImagesToProcess());
const selectionTypeLabel = typeLabelOf(selectionTypeCounts);
// 批量复制图片
const copyMultipleImages = async () => {
@@ -1095,15 +1097,16 @@ function RightPanel() {
const totalCount = folderImages.length;
const totalSize = folderImages.reduce((sum, img) => sum + (img.size || 0), 0);
return { totalCount, totalSize };
const folderTypeCounts = typeCountsOf(folderImages);
return { totalCount, totalSize, folderTypeCounts };
};
// ========== 文件夹详情渲染 ==========
if (isShowingFolder) {
const folderPath = selectedFolderItem.path;
const folderName = selectedFolderItem.name;
const { totalCount, totalSize } = getFolderStats(folderPath);
const { totalCount, totalSize, folderTypeCounts } = getFolderStats(folderPath);
const fullPath = currentLibrary?.path
? normalizePath(`${currentLibrary.path}${getPathSeparator()}${folderPath}`)
: folderPath;
@@ -1160,8 +1163,8 @@ function RightPanel() {
)}
</div>
<div>
<span className="text-gray-500 dark:text-gray-400">包含图片:</span>
<p className="text-gray-900 dark:text-gray-100">{totalCount} 张(含子文件夹)</p>
<span className="text-gray-500 dark:text-gray-400">包含:</span>
<p className="text-gray-900 dark:text-gray-100">{countLabel(totalCount, folderTypeCounts)}(含子文件夹)</p>
</div>
<div>
<span className="text-gray-500 dark:text-gray-400">总大小:</span>
@@ -1212,7 +1215,7 @@ function RightPanel() {
<span>
{isExportingFolder
? `打包中... ${folderExportProgress}%`
: `导出文件夹 (${totalCount} 张)`
: `导出文件夹 (${countLabel(totalCount, folderTypeCounts)})`
}
</span>
</div>
@@ -1263,7 +1266,7 @@ function RightPanel() {
}
}
}}
title="双击查看第一张图片"
title="双击查看原文件"
>
{(() => {
const imagesToShow = getImagesToProcess().slice(0, 5);
@@ -1367,7 +1370,7 @@ function RightPanel() {
<div className="flex-1 overflow-y-auto p-4 space-y-4 min-h-0">
<div>
<h3 className="text-xs font-semibold text-gray-700 dark:text-gray-300 mb-2">
{isMultiSelect ? `已选择 ${actualSelectedCount} ${selectionHasVideo ? '个文件' : '张图片'}` : '基本信息'}
{isMultiSelect ? `已选择 ${countLabel(actualSelectedCount, selectionTypeCounts)}` : '基本信息'}
</h3>
<div className="space-y-2 text-xs">
{isMultiSelect ? (
@@ -1380,7 +1383,7 @@ function RightPanel() {
<>
<div>
<span className="text-gray-500 dark:text-gray-400">数量:</span>
<p className="text-gray-900 dark:text-gray-100 text-xs">{stats.count} {selectionHasVideo ? '个文件' : '张图片'}</p>
<p className="text-gray-900 dark:text-gray-100 text-xs">{countLabel(stats.count, selectionTypeCounts)}</p>
</div>
<div>
<span className="text-gray-500 dark:text-gray-400">评分:</span>
@@ -1581,7 +1584,7 @@ function RightPanel() {
</div>
{isMultiSelect && (
<p className="text-xs text-gray-400 dark:text-gray-500 mt-1">
已选择 {actualSelectedCount} {selectionHasVideo ? '个文件' : '张图片'}的共同父路径
已选择 {countLabel(actualSelectedCount, selectionTypeCounts)}的共同父路径
</p>
)}
</div>
@@ -1623,15 +1626,13 @@ function RightPanel() {
{imageCopied ? (
<>
<Check className="w-4 h-4" />
<span>已复制{isMultiSelect ? ` ${actualSelectedCount} ${selectionHasVideo ? '个' : '张'}` : ''}</span>
<span>已复制{isMultiSelect ? ` ${countLabel(actualSelectedCount, selectionTypeCounts)}` : ''}</span>
</>
) : (
<>
<Copy className="w-4 h-4" />
<span>
{singleIsVideo
? '复制视频'
: `${selectionHasVideo ? '复制文件' : '复制图片'}${isMultiSelect ? ` (${actualSelectedCount})` : ''}`}
{`复制${singleIsVideo ? '视频' : selectionTypeLabel}${isMultiSelect ? ` (${actualSelectedCount})` : ''}`}
</span>
</>
)}
@@ -1648,7 +1649,7 @@ function RightPanel() {
<span>
{isExporting
? `打包中... ${exportProgress}%`
: `${singleIsVideo ? '导出视频' : selectionHasVideo ? '导出文件' : '导出图片'}${isMultiSelect ? ` (${actualSelectedCount})` : ''}`
: `导出${singleIsVideo ? '视频' : selectionTypeLabel}${isMultiSelect ? ` (${actualSelectedCount})` : ''}`
}
</span>
</div>