From 0bd050396cdafbb091da3215f41b12ba582a537c Mon Sep 17 00:00:00 2001 From: Connor Yoh Date: Fri, 15 Aug 2025 16:53:53 +0100 Subject: [PATCH] Working --- .../public/locales/en-US/translation.json | 100 ++++++++++++- .../addWatermark/WatermarkContentSettings.tsx | 93 ------------ .../tools/addWatermark/WatermarkFile.tsx | 34 +++++ .../addWatermark/WatermarkFormatting.tsx | 73 ++++++++++ .../tools/addWatermark/WatermarkTextStyle.tsx | 65 +++++++++ .../addWatermark/WatermarkTypeSettings.tsx | 3 +- .../tools/addWatermark/WatermarkWording.tsx | 27 ++++ .../tools/shared/NumberInputWithUnit.tsx | 50 +++++++ .../components/tooltips/useWatermarkTips.ts | 125 ++++++++++++++-- frontend/src/tools/AddWatermark.tsx | 137 ++++++++++++------ 10 files changed, 550 insertions(+), 157 deletions(-) delete mode 100644 frontend/src/components/tools/addWatermark/WatermarkContentSettings.tsx create mode 100644 frontend/src/components/tools/addWatermark/WatermarkFile.tsx create mode 100644 frontend/src/components/tools/addWatermark/WatermarkFormatting.tsx create mode 100644 frontend/src/components/tools/addWatermark/WatermarkTextStyle.tsx create mode 100644 frontend/src/components/tools/addWatermark/WatermarkWording.tsx create mode 100644 frontend/src/components/tools/shared/NumberInputWithUnit.tsx diff --git a/frontend/public/locales/en-US/translation.json b/frontend/public/locales/en-US/translation.json index 4f79f9d4d..a72c04221 100644 --- a/frontend/public/locales/en-US/translation.json +++ b/frontend/public/locales/en-US/translation.json @@ -1766,11 +1766,10 @@ "rotation": "Rotation (degrees)", "opacity": "Opacity (%)", "spacing": { - "width": "Width Spacing", - "height": "Height Spacing" + "horizontal": "Horizontal Spacing", + "vertical": "Vertical Spacing" }, - "convertToImage": "Convert result to image-based PDF", - "convertToImageDesc": "Creates a PDF with images instead of text (more secure but larger file size)" + "convertToImage": "Flatten PDF pages to images" }, "alphabet": { "roman": "Roman/Latin", @@ -1782,10 +1781,10 @@ }, "steps": { "type": "Watermark Type", - "textContent": "Text Content", - "imageContent": "Image Content", - "style": "Style & Position", - "advanced": "Advanced Options" + "wording": "Wording", + "textStyle": "Style", + "file": "Watermark File", + "formatting": "Formatting" }, "results": { "title": "Watermark Results" @@ -1854,6 +1853,91 @@ "bullet3": "Higher values create more spread out patterns" } }, + "wording": { + "header": { + "title": "Text Content" + }, + "text": { + "title": "Watermark Text", + "text": "Enter the text that will appear as your watermark across the document.", + "bullet1": "Keep it concise for better readability", + "bullet2": "Common examples: 'CONFIDENTIAL', 'DRAFT', company name", + "bullet3": "Supports all Unicode characters" + }, + "fontSize": { + "title": "Font Size", + "text": "Control the size of your watermark text (8-72 points).", + "bullet1": "Smaller sizes (8-14pt) for subtle watermarks", + "bullet2": "Medium sizes (16-24pt) for standard visibility", + "bullet3": "Large sizes (30-72pt) for prominent watermarks" + } + }, + "textStyle": { + "header": { + "title": "Text Style" + }, + "language": { + "title": "Language Support", + "text": "Choose the appropriate language setting to ensure proper font rendering.", + "bullet1": "Roman/Latin for Western languages", + "bullet2": "Arabic for Arabic script", + "bullet3": "Japanese, Korean, Chinese for Asian languages", + "bullet4": "Thai for Thai script" + }, + "color": { + "title": "Color Selection", + "text": "Choose a color that provides good contrast with your document content.", + "bullet1": "Light gray (#d3d3d3) for subtle watermarks", + "bullet2": "Black or dark colors for high contrast", + "bullet3": "Custom colors for branding purposes" + } + }, + "file": { + "header": { + "title": "Image Upload" + }, + "upload": { + "title": "Image Selection", + "text": "Upload an image file to use as your watermark.", + "bullet1": "Supports common formats: PNG, JPG, GIF, BMP", + "bullet2": "PNG with transparency works best", + "bullet3": "Higher resolution images maintain quality better" + }, + "recommendations": { + "title": "Best Practices", + "text": "Tips for optimal image watermark results.", + "bullet1": "Use logos or stamps with transparent backgrounds", + "bullet2": "Simple designs work better than complex images", + "bullet3": "Consider the final document size when choosing resolution" + } + }, + "formatting": { + "header": { + "title": "Formatting & Layout" + }, + "appearance": { + "title": "Appearance Settings", + "text": "Control how your watermark looks and blends with the document.", + "bullet1": "Rotation: -360° to 360° for angled watermarks", + "bullet2": "Opacity: 0-100% for transparency control", + "bullet3": "Lower opacity creates subtle watermarks" + }, + "spacing": { + "title": "Spacing Control", + "text": "Adjust the spacing between repeated watermarks across the page.", + "bullet1": "Horizontal spacing: Distance between watermarks left to right", + "bullet2": "Vertical spacing: Distance between watermarks top to bottom", + "bullet3": "Higher values create more spread out patterns" + }, + "security": { + "title": "Security Option", + "text": "Flatten PDF pages to images for enhanced security.", + "bullet1": "Prevents text selection and copying", + "bullet2": "Makes watermarks harder to remove", + "bullet3": "Results in larger file sizes", + "bullet4": "Best for sensitive or copyrighted content" + } + }, "advanced": { "header": { "title": "Advanced Options" diff --git a/frontend/src/components/tools/addWatermark/WatermarkContentSettings.tsx b/frontend/src/components/tools/addWatermark/WatermarkContentSettings.tsx deleted file mode 100644 index 5bab1ab83..000000000 --- a/frontend/src/components/tools/addWatermark/WatermarkContentSettings.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import React, { useRef } from "react"; -import { Stack, Text, TextInput, FileButton, Button, NumberInput, Select, ColorInput } from "@mantine/core"; -import { useTranslation } from "react-i18next"; -import { AddWatermarkParameters } from "./types"; - -interface WatermarkContentSettingsProps { - parameters: AddWatermarkParameters; - onParameterChange: (key: keyof AddWatermarkParameters, value: any) => void; - disabled?: boolean; -} - -const WatermarkContentSettings = ({ parameters, onParameterChange, disabled = false }: WatermarkContentSettingsProps) => { - const { t } = useTranslation(); - const resetRef = useRef<() => void>(null); - - const alphabetOptions = [ - { value: 'roman', label: t('watermark.alphabet.roman', 'Roman/Latin') }, - { value: 'arabic', label: t('watermark.alphabet.arabic', 'Arabic') }, - { value: 'japanese', label: t('watermark.alphabet.japanese', 'Japanese') }, - { value: 'korean', label: t('watermark.alphabet.korean', 'Korean') }, - { value: 'chinese', label: t('watermark.alphabet.chinese', 'Chinese') }, - { value: 'thai', label: t('watermark.alphabet.thai', 'Thai') } - ]; - - return ( - - {/* Text Watermark Settings */} - {parameters.watermarkType === 'text' && ( - - {t('watermark.settings.text.label', 'Watermark Text')} - onParameterChange('watermarkText', e.target.value)} - disabled={disabled} - /> - - {t('watermark.settings.fontSize', 'Font Size')} - onParameterChange('fontSize', value || 12)} - min={8} - max={72} - disabled={disabled} - /> - - {t('watermark.settings.alphabet', 'Font/Language')} - value && onParameterChange("alphabet", value)} + data={alphabetOptions} + disabled={disabled} + /> + + ); +}; + +export default WatermarkTextStyle; diff --git a/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx b/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx index 438d781a6..f97454c5c 100644 --- a/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx +++ b/frontend/src/components/tools/addWatermark/WatermarkTypeSettings.tsx @@ -13,7 +13,6 @@ const WatermarkTypeSettings = ({ watermarkType, onWatermarkTypeChange, disabled return ( - {t('watermark.settings.type', 'Watermark Type')}