mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-08-27 06:39:24 +00:00

- Updated integration tests in ConvertIntegration.test.tsx to include additional parameters for conversion options. - Improved error handling for API responses and network errors. - Enhanced mock implementations for axios calls to ensure accurate testing of conversion operations. - Added tests for smart detection functionality in ConvertSmartDetectionIntegration.test.tsx, covering various file types and conversion scenarios. - Refined mantineTheme.ts by removing unused font weights and ensuring type safety in component customizations. - Updated fileContext.ts and pageEditor.ts to improve type definitions and ensure consistency across the application. - Enhanced fileUtils.ts with additional methods for file handling and improved error logging. - Refactored thumbnailUtils.ts to optimize thumbnail generation logic and improve memory management. - Made minor adjustments to toolOperationTracker.ts for better type handling.
29 lines
889 B
TypeScript
29 lines
889 B
TypeScript
import { FileOperation } from '../types/fileContext';
|
|
|
|
/**
|
|
* Creates operation tracking data for FileContext integration
|
|
*/
|
|
export const createOperation = <TParams = void>(
|
|
operationType: string,
|
|
params: TParams,
|
|
selectedFiles: File[]
|
|
): { operation: FileOperation; operationId: string; fileId: string } => {
|
|
const operationId = `${operationType}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
const fileId = selectedFiles.map(f => f.name).join(',');
|
|
|
|
const operation: FileOperation = {
|
|
id: operationId,
|
|
type: operationType,
|
|
timestamp: Date.now(),
|
|
fileIds: selectedFiles.map(f => f.name),
|
|
status: 'pending',
|
|
metadata: {
|
|
originalFileName: selectedFiles[0]?.name,
|
|
parameters: params,
|
|
fileSize: selectedFiles.reduce((sum, f) => sum + f.size, 0)
|
|
}
|
|
} as any /* FIX ME*/;
|
|
|
|
return { operation, operationId, fileId };
|
|
};
|