diff --git a/frontend/public/locales/en-GB/translation.json b/frontend/public/locales/en-GB/translation.json index 622e26623..b71494452 100644 --- a/frontend/public/locales/en-GB/translation.json +++ b/frontend/public/locales/en-GB/translation.json @@ -2758,6 +2758,7 @@ "adjustContrast": { "title": "Adjust Colors/Contrast", "header": "Adjust Colors/Contrast", + "basic": "Basic Adjustments", "contrast": "Contrast:", "brightness": "Brightness:", "saturation": "Saturation:", diff --git a/frontend/public/locales/en-US/translation.json b/frontend/public/locales/en-US/translation.json index f14cc8661..b4ac8302d 100644 --- a/frontend/public/locales/en-US/translation.json +++ b/frontend/public/locales/en-US/translation.json @@ -1714,6 +1714,7 @@ "adjustContrast": { "title": "Adjust Colors/Contrast", "header": "Adjust Colors/Contrast", + "basic": "Basic Adjustments", "contrast": "Contrast:", "brightness": "Brightness:", "saturation": "Saturation:", diff --git a/frontend/src/components/tools/adjustContrast/AdjustContrastSettings.tsx b/frontend/src/components/tools/adjustContrast/AdjustContrastSettings.tsx deleted file mode 100644 index cd350b0fb..000000000 --- a/frontend/src/components/tools/adjustContrast/AdjustContrastSettings.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; -import { Stack, Slider, Text, Group, NumberInput, Divider } from '@mantine/core'; -import { useTranslation } from 'react-i18next'; -import { AdjustContrastParameters } from '../../../hooks/tools/adjustContrast/useAdjustContrastParameters'; - -interface Props { - parameters: AdjustContrastParameters; - onParameterChange: (key: K, value: AdjustContrastParameters[K]) => void; - disabled?: boolean; - file?: File | null; -} - -export default function AdjustContrastSettings({ parameters, onParameterChange, disabled }: Props) { - const { t } = useTranslation(); - - const renderSlider = (label: string, value: number, onChange: (v: number) => void) => ( -
- {label}: {Math.round(value)}% - -
- -
- onChange(Number(v) || 0)} - min={0} - max={200} - step={1} - disabled={disabled} - style={{ width: 90 }} - /> -
-
- ); - - return ( - - {renderSlider(t('adjustContrast.contrast', 'Contrast'), parameters.contrast, (v) => onParameterChange('contrast', v as any))} - {renderSlider(t('adjustContrast.brightness', 'Brightness'), parameters.brightness, (v) => onParameterChange('brightness', v as any))} - {renderSlider(t('adjustContrast.saturation', 'Saturation'), parameters.saturation, (v) => onParameterChange('saturation', v as any))} - - - {t('adjustContrast.adjustColors', 'Adjust Colors')} - {renderSlider(t('adjustContrast.red', 'Red'), parameters.red, (v) => onParameterChange('red', v as any))} - {renderSlider(t('adjustContrast.green', 'Green'), parameters.green, (v) => onParameterChange('green', v as any))} - {renderSlider(t('adjustContrast.blue', 'Blue'), parameters.blue, (v) => onParameterChange('blue', v as any))} - - ); -} - - diff --git a/frontend/src/components/tools/shared/createToolFlow.tsx b/frontend/src/components/tools/shared/createToolFlow.tsx index 2f7835c15..ffa4b0db6 100644 --- a/frontend/src/components/tools/shared/createToolFlow.tsx +++ b/frontend/src/components/tools/shared/createToolFlow.tsx @@ -92,8 +92,9 @@ export function createToolFlow(config: ToolFlowConfig) { }, stepConfig.content) )} - {/* Preview (outside steps, above execute button). Hide when review is visible. */} - {!config.review.isVisible && config.preview} + {/* Preview (outside steps, above execute button). + Hide when review is visible or when no files are selected. */} + {!config.review.isVisible && (config.files.selectedFiles?.length ?? 0) > 0 && config.preview} {/* Execute Button */} {config.executeButton && config.executeButton.isVisible !== false && ( diff --git a/frontend/src/data/useTranslatedToolRegistry.tsx b/frontend/src/data/useTranslatedToolRegistry.tsx index 2106a1e7a..66e498661 100644 --- a/frontend/src/data/useTranslatedToolRegistry.tsx +++ b/frontend/src/data/useTranslatedToolRegistry.tsx @@ -92,7 +92,6 @@ import ScannerImageSplitSettings from "../components/tools/scannerImageSplit/Sca import ChangeMetadataSingleStep from "../components/tools/changeMetadata/ChangeMetadataSingleStep"; import SignSettings from "../components/tools/sign/SignSettings"; import CropSettings from "../components/tools/crop/CropSettings"; -import AdjustContrastSettings from "../components/tools/adjustContrast/AdjustContrastSettings"; import RemoveAnnotations from "../tools/RemoveAnnotations"; import RemoveAnnotationsSettings from "../components/tools/removeAnnotations/RemoveAnnotationsSettings"; import PageLayoutSettings from "../components/tools/pageLayout/PageLayoutSettings"; @@ -643,7 +642,6 @@ export function useFlatToolRegistry(): ToolRegistry { categoryId: ToolCategoryId.ADVANCED_TOOLS, subcategoryId: SubcategoryId.ADVANCED_FORMATTING, operationConfig: adjustContrastOperationConfig, - settingsComponent: AdjustContrastSettings, synonyms: getSynonyms(t, "adjustContrast"), }, repair: { diff --git a/frontend/src/tools/AdjustContrast.tsx b/frontend/src/tools/AdjustContrast.tsx index a3adda14e..cf790c06d 100644 --- a/frontend/src/tools/AdjustContrast.tsx +++ b/frontend/src/tools/AdjustContrast.tsx @@ -4,7 +4,6 @@ import { BaseToolProps, ToolComponent } from '../types/tool'; import { useBaseTool } from '../hooks/tools/shared/useBaseTool'; import { useAdjustContrastParameters } from '../hooks/tools/adjustContrast/useAdjustContrastParameters'; import { useAdjustContrastOperation } from '../hooks/tools/adjustContrast/useAdjustContrastOperation'; -import AdjustContrastSettings from '../components/tools/adjustContrast/AdjustContrastSettings'; import AdjustContrastBasicSettings from '../components/tools/adjustContrast/AdjustContrastBasicSettings'; import AdjustContrastColorSettings from '../components/tools/adjustContrast/AdjustContrastColorSettings'; import AdjustContrastPreview from '../components/tools/adjustContrast/AdjustContrastPreview';