From 3f27668c9f95f017cec7c7d8f9649a5b10a9fa44 Mon Sep 17 00:00:00 2001 From: imeepos Date: Thu, 17 Jul 2025 13:36:32 +0800 Subject: [PATCH] style: implement left-right layout for export statistics cards - Change to left-right layout: left side statistics info, right side icon - Follow TemplateMatchingResultStatsPanel design pattern - Use white background with subtle shadow and border - Add percentage calculations for success/failure rates - Add average file size calculation - Use larger icons (w-8 h-8) with opacity-60 for visual balance - Include subtitle information for better context - Match the exact layout structure used in project statistics fix: correct re_export_record command parameters - Add newFilePath parameter using file dialog selection - Fix parameter naming to match backend expectation (newFilePath) - Implement proper file selection dialog for export path --- .../src/components/ExportRecordManager.tsx | 119 +++++++++++------- 1 file changed, 77 insertions(+), 42 deletions(-) diff --git a/apps/desktop/src/components/ExportRecordManager.tsx b/apps/desktop/src/components/ExportRecordManager.tsx index b75f2c8..4ba281b 100644 --- a/apps/desktop/src/components/ExportRecordManager.tsx +++ b/apps/desktop/src/components/ExportRecordManager.tsx @@ -143,8 +143,32 @@ const ExportRecordManager: React.FC = ({ // 重新导出 const handleReExport = async (recordId: string) => { try { - await invoke('re_export_record', { recordId }); - await loadExportRecords(); + // 打开文件选择对话框 + const { open } = await import('@tauri-apps/plugin-dialog'); + const selected = await open({ + title: '选择导出路径', + directory: false, + multiple: false, + filters: [ + { + name: '剪映项目', + extensions: ['json'] + }, + { + name: '所有文件', + extensions: ['*'] + } + ] + }); + + if (selected) { + await invoke('re_export_record', { + recordId, + newFilePath: selected + }); + await loadExportRecords(); + console.log('重新导出成功'); + } } catch (err) { setError(`重新导出失败: ${err}`); } @@ -372,66 +396,77 @@ const ExportRecordManager: React.FC = ({ {statistics && (
{/* 总导出次数 */} -
-
-
-
-
- -
+
+
+
+

总导出次数

+

+ {statistics.total_exports} +

-
- {statistics.total_exports} +
+
-
总导出次数
{/* 成功导出 */} -
-
-
-
-
- -
+
+
+
+

成功导出

+

+ {statistics.successful_exports} +

+ {statistics.total_exports > 0 && ( +

+ {((statistics.successful_exports / statistics.total_exports) * 100).toFixed(1)}% 成功率 +

+ )}
-
- {statistics.successful_exports} +
+
-
成功导出
{/* 失败导出 */} -
-
-
-
-
- -
+
+
+
+

失败导出

+

+ {statistics.failed_exports} +

+ {statistics.total_exports > 0 && ( +

+ {((statistics.failed_exports / statistics.total_exports) * 100).toFixed(1)}% 失败率 +

+ )}
-
- {statistics.failed_exports} +
+
-
失败导出
{/* 总文件大小 */} -
-
-
-
-
- -
+
+
+
+

总文件大小

+

+ {formatFileSize(statistics.total_file_size)} +

+ {statistics.total_exports > 0 && ( +

+ 平均 {formatFileSize(statistics.total_file_size / statistics.total_exports)} +

+ )}
-
- {formatFileSize(statistics.total_file_size)} +
+
-
总文件大小