From 54f386708631ed982d2c24d88d9a7317090ab95e Mon Sep 17 00:00:00 2001 From: SnapOtter Date: Wed, 13 May 2026 16:20:40 +0800 Subject: [PATCH] feat: add Remove Watermark toggle UI with feature gating and e2e tests --- .../tools/transparency-fixer-settings.tsx | 50 +++++++++++++++++-- tests/e2e/transparency-fixer.spec.ts | 34 +++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) diff --git a/apps/web/src/components/tools/transparency-fixer-settings.tsx b/apps/web/src/components/tools/transparency-fixer-settings.tsx index ed1119e6..a41f5087 100644 --- a/apps/web/src/components/tools/transparency-fixer-settings.tsx +++ b/apps/web/src/components/tools/transparency-fixer-settings.tsx @@ -1,7 +1,8 @@ -import { ChevronDown, ChevronRight } from "lucide-react"; +import { ChevronDown, ChevronRight, Droplets } from "lucide-react"; import { useEffect, useRef, useState } from "react"; import { ProgressCard } from "@/components/common/progress-card"; import { useToolProcessor } from "@/hooks/use-tool-processor"; +import { useFeaturesStore } from "@/stores/features-store"; import { useFileStore } from "@/stores/file-store"; type OutputFormat = "png" | "webp"; @@ -19,17 +20,27 @@ export function TransparencyFixerControls({ }: TransparencyFixerControlsProps) { const [defringe, setDefringe] = useState(30); const [outputFormat, setOutputFormat] = useState("png"); + const [removeWatermark, setRemoveWatermark] = useState(false); const [advancedOpen, setAdvancedOpen] = useState(false); + const eraserInstalled = useFeaturesStore((s) => s.isToolInstalled("erase-object")); + const featuresLoaded = useFeaturesStore((s) => s.loaded); + const fetchFeatures = useFeaturesStore((s) => s.fetch); + + useEffect(() => { + fetchFeatures(); + }, [fetchFeatures]); + const onChangeRef = useRef(onChange); useEffect(() => { onChangeRef.current = onChange; }); - // Sync settings on every control change useEffect(() => { - onChangeRef.current({ defringe, outputFormat }); - }, [defringe, outputFormat]); + onChangeRef.current({ defringe, outputFormat, removeWatermark }); + }, [defringe, outputFormat, removeWatermark]); + + const toggleDisabled = featuresLoaded && !eraserInstalled; return (
@@ -37,6 +48,37 @@ export function TransparencyFixerControls({ Upload a PNG with a fake transparent background and we'll fix it in one click.

+ {/* Remove Watermark toggle */} +
+
+ +
+

Remove Watermark

+

+ {toggleDisabled + ? "Requires Object Eraser bundle" + : "Detect and remove semi-transparent watermarks"} +

+
+
+ +
+ {/* Advanced toggle */}