Rotatiton

This commit is contained in:
Connor Yoh 2025-10-01 14:32:01 +01:00
parent 7bb7f9f32b
commit 5096545e20
4 changed files with 50 additions and 4 deletions

View File

@ -850,6 +850,7 @@
"rotate": {
"title": "Rotate PDF",
"submit": "Apply Rotation",
"selectRotation": "Select Rotation Angle (Clockwise)",
"error": {
"failed": "An error occurred while rotating the PDF."
},

View File

@ -0,0 +1,43 @@
/**
* RotateAutomationSettings - Used for automation only
*
* Simplified rotation settings for automation that allows selecting
* one of four 90-degree rotation angles.
*/
import { Stack, Text } from "@mantine/core";
import { useTranslation } from "react-i18next";
import { RotateParameters } from "../../../hooks/tools/rotate/useRotateParameters";
import ButtonSelector from "../../shared/ButtonSelector";
interface RotateAutomationSettingsProps {
parameters: RotateParameters;
onParameterChange: <K extends keyof RotateParameters>(key: K, value: RotateParameters[K]) => void;
disabled?: boolean;
}
const RotateAutomationSettings = ({ parameters, onParameterChange, disabled = false }: RotateAutomationSettingsProps) => {
const { t } = useTranslation();
return (
<Stack gap="md">
<Text size="sm" fw={500}>
{t("rotate.selectRotation", "Select Rotation Angle (Clockwise)")}
</Text>
<ButtonSelector
value={parameters.angle}
onChange={(value: number) => onParameterChange('angle', value)}
options={[
{ value: 0, label: "0°" },
{ value: 90, label: "90°" },
{ value: 180, label: "180°" },
{ value: 270, label: "270°" },
]}
disabled={disabled}
/>
</Stack>
);
};
export default RotateAutomationSettings;

View File

@ -95,6 +95,7 @@ import ReplaceColorSettings from "../components/tools/replaceColor/ReplaceColorS
import AddStampAutomationSettings from "../components/tools/addStamp/AddStampAutomationSettings";
import CertSignAutomationSettings from "../components/tools/certSign/CertSignAutomationSettings";
import CropAutomationSettings from "../components/tools/crop/CropAutomationSettings";
import RotateAutomationSettings from "../components/tools/rotate/RotateAutomationSettings";
const showPlaceholderTools = true; // Show all tools; grey out unavailable ones in UI
@ -408,7 +409,7 @@ export function useFlatToolRegistry(): ToolRegistry {
maxFiles: -1,
endpoints: ["rotate-pdf"],
operationConfig: rotateOperationConfig,
automationSettings: RotateSettings, //TODO:: Fix
automationSettings: RotateAutomationSettings,
synonyms: getSynonyms(t, "rotate")
},
split: {

View File

@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
import React from 'react';
import LocalIcon from '../../../components/shared/LocalIcon';
import { SuggestedAutomation } from '../../../types/automation';
import { SPLIT_METHODS } from '../../../constants/splitConstants';
// Create icon components
const CompressIcon = () => React.createElement(LocalIcon, { icon: 'compress', width: '1.5rem', height: '1.5rem' });
@ -83,18 +84,18 @@ export function useSuggestedAutomations(): SuggestedAutomation[] {
}
},
{
operation: "splitPdf",
operation: "split",
parameters: {
mode: 'bySizeOrCount',
method: SPLIT_METHODS.BY_SIZE,
pages: '',
hDiv: '1',
vDiv: '1',
merge: false,
splitType: 'size',
splitValue: '20MB',
bookmarkLevel: '1',
includeMetadata: false,
allowDuplicates: false,
duplexMode: false,
}
},
{