mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-15 02:54:06 +02:00
🔄 Dynamic Processing Strategies - Adaptive routing: Same tool uses different backend endpoints based on file analysis - Combined vs separate processing: Intelligently chooses between merge operations and individual file processing - Cross-format workflows: Enable complex conversions like "mixed files → PDF" that other tools can't handle ⚙️ Format-Specific Intelligence Each conversion type gets tailored options: - HTML/ZIP → PDF: Zoom controls (0.1-3.0 increments) with live preview - Email → PDF: Attachment handling, size limits, recipient control - PDF → PDF/A: Digital signature detection with warnings - Images → PDF: Smart combining vs individual file options File Architecture Core Implementation: ├── Convert.tsx # Main stepped workflow UI ├── ConvertSettings.tsx # Centralized settings with smart detection ├── GroupedFormatDropdown.tsx # Enhanced format selector with grouping ├── useConvertParameters.ts # Smart detection & parameter management ├── useConvertOperation.ts # Multi-strategy processing logic └── Settings Components: ├── ConvertFromWebSettings.tsx # HTML zoom controls ├── ConvertFromEmailSettings.tsx # Email attachment options ├── ConvertToPdfaSettings.tsx # PDF/A with signature detection ├── ConvertFromImageSettings.tsx # Image PDF options └── ConvertToImageSettings.tsx # PDF to image options Utility Layer Utils & Services: ├── convertUtils.ts # Format detection & endpoint routing ├── fileResponseUtils.ts # Generic API response handling └── setupTests.ts # Enhanced test environment with crypto mocks Testing & Quality Comprehensive Test Coverage Test Suite: ├── useConvertParameters.test.ts # Parameter logic & smart detection ├── useConvertParametersAutoDetection.test.ts # File type analysis ├── ConvertIntegration.test.tsx # End-to-end conversion workflows ├── ConvertSmartDetectionIntegration.test.tsx # Mixed file scenarios ├── ConvertE2E.spec.ts # Playwright browser tests ├── convertUtils.test.ts # Utility function validation └── fileResponseUtils.test.ts # API response handling Advanced Test Features - Crypto API mocking: Proper test environment for file hashing - File.arrayBuffer() polyfills: Complete browser API simulation - Multi-file scenario testing: Complex batch processing validation - CI/CD integration: Vitest runs in GitHub Actions with proper artifacts --------- Co-authored-by: Connor Yoh <[email protected]> Co-authored-by: Anthony Stirling <[email protected]>
60 lines
2.0 KiB
TypeScript
60 lines
2.0 KiB
TypeScript
import React from 'react';
|
|
import { Stack, Text, Select, Alert } from '@mantine/core';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { ConvertParameters } from '../../../hooks/tools/convert/useConvertParameters';
|
|
import { usePdfSignatureDetection } from '../../../hooks/usePdfSignatureDetection';
|
|
|
|
interface ConvertToPdfaSettingsProps {
|
|
parameters: ConvertParameters;
|
|
onParameterChange: (key: keyof ConvertParameters, value: any) => void;
|
|
selectedFiles: File[];
|
|
disabled?: boolean;
|
|
}
|
|
|
|
const ConvertToPdfaSettings = ({
|
|
parameters,
|
|
onParameterChange,
|
|
selectedFiles,
|
|
disabled = false
|
|
}: ConvertToPdfaSettingsProps) => {
|
|
const { t } = useTranslation();
|
|
const { hasDigitalSignatures, isChecking } = usePdfSignatureDetection(selectedFiles);
|
|
|
|
const pdfaFormatOptions = [
|
|
{ value: 'pdfa-1', label: 'PDF/A-1b' },
|
|
{ value: 'pdfa', label: 'PDF/A-2b' }
|
|
];
|
|
|
|
return (
|
|
<Stack gap="sm" data-testid="pdfa-settings">
|
|
<Text size="sm" fw={500}>{t("convert.pdfaOptions", "PDF/A Options")}:</Text>
|
|
|
|
{hasDigitalSignatures && (
|
|
<Alert color="yellow" size="sm">
|
|
<Text size="sm">
|
|
{t("convert.pdfaDigitalSignatureWarning", "The PDF contains a digital signature. This will be removed in the next step.")}
|
|
</Text>
|
|
</Alert>
|
|
)}
|
|
|
|
<Stack gap="xs">
|
|
<Text size="xs" fw={500}>{t("convert.outputFormat", "Output Format")}:</Text>
|
|
<Select
|
|
value={parameters.pdfaOptions.outputFormat}
|
|
onChange={(value) => onParameterChange('pdfaOptions', {
|
|
...parameters.pdfaOptions,
|
|
outputFormat: value || 'pdfa-1'
|
|
})}
|
|
data={pdfaFormatOptions}
|
|
disabled={disabled || isChecking}
|
|
data-testid="pdfa-output-format-select"
|
|
/>
|
|
<Text size="xs" c="dimmed">
|
|
{t("convert.pdfaNote", "PDF/A-1b is more compatible, PDF/A-2b supports more features.")}
|
|
</Text>
|
|
</Stack>
|
|
</Stack>
|
|
);
|
|
};
|
|
|
|
export default ConvertToPdfaSettings; |