diff --git a/src/components/sections/ToolGridSection.tsx b/src/components/sections/ToolGridSection.tsx index 2c9c213..187abfc 100644 --- a/src/components/sections/ToolGridSection.tsx +++ b/src/components/sections/ToolGridSection.tsx @@ -12,10 +12,7 @@ import { Sparkles, X, Layers, - ShieldCheck, - Zap, Smartphone, - SlidersHorizontal, ChevronRight, RotateCcw, } from 'lucide-react'; @@ -227,35 +224,63 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string }) setSplitPos(pct); }, []); - const handlePointerDown = (e: React.PointerEvent) => { - if (media.type !== 'comparison') return; + const startDragging = useCallback((clientX: number, target: HTMLElement, pointerId: number) => { isDraggingRef.current = true; try { - e.currentTarget.setPointerCapture(e.pointerId); + target.setPointerCapture(pointerId); } catch {} - updatePosition(e.clientX); + updatePosition(clientX); + }, [updatePosition]); + + // On desktop with mouse, clicking anywhere on the stage moves the slider. + // On phones/touch screens, touching the card does NOT move the slider, + // allowing completely unobstructed vertical page scrolling! + const handleContainerPointerDown = (e: React.PointerEvent) => { + if (media.type !== 'comparison') return; + if (e.pointerType !== 'mouse' || e.button !== 0) return; + startDragging(e.clientX, e.currentTarget, e.pointerId); }; - const handlePointerMove = (e: React.PointerEvent) => { + const handleContainerPointerMove = (e: React.PointerEvent) => { if (media.type !== 'comparison') return; - if (isDraggingRef.current || e.pointerType === 'mouse') { + if (e.pointerType === 'mouse' && !isDraggingRef.current) { updatePosition(e.clientX); } }; - const handlePointerUp = (e: React.PointerEvent) => { - isDraggingRef.current = false; - try { - e.currentTarget.releasePointerCapture(e.pointerId); - } catch {} - }; - - const handlePointerLeave = (e: React.PointerEvent) => { + const handleContainerPointerLeave = (e: React.PointerEvent) => { if (e.pointerType === 'mouse' && !isDraggingRef.current) { setSplitPos(50); } }; + // Dedicated Handle Button Pointer Handlers (Phone Touch & Mouse Dragging) + const handleHandlePointerDown = (e: React.PointerEvent) => { + if (media.type !== 'comparison') return; + if (e.button !== 0 && e.pointerType === 'mouse') return; + e.stopPropagation(); + startDragging(e.clientX, e.currentTarget, e.pointerId); + }; + + const handleHandlePointerMove = (e: React.PointerEvent) => { + if (media.type !== 'comparison') return; + if (isDraggingRef.current) { + e.stopPropagation(); + updatePosition(e.clientX); + } + }; + + const handleHandlePointerUp = (e: React.PointerEvent) => { + if (media.type !== 'comparison') return; + if (isDraggingRef.current) { + e.stopPropagation(); + isDraggingRef.current = false; + try { + e.currentTarget.releasePointerCapture(e.pointerId); + } catch {} + } + }; + // 1. VIDEO TOOL (Background Remover) if (media.type === 'video') { return ( @@ -294,12 +319,11 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string }) return (
{/* Enhanced / After Image (Underneath) */} {/* eslint-disable-next-line @next/next/no-img-element */} @@ -329,16 +353,27 @@ function ToolCardImage({ tool, toolName }: { tool: ToolItem; toolName: string }) />
- {/* Vertical Slider Divider Line */} + {/* Vertical Slider Divider Line (pointer-events-none so it doesn't block vertical scrolling) */}
- {/* Sleek handle pill */} -
-
-
-
+ {/* Dedicated Tactile Handle Button: Phone touch activates ONLY on this button */} +
+
+
+
@@ -480,14 +515,6 @@ export function ToolGridSection({ return categorizedTools.find((g) => g.id === selectedCategory); }, [categorizedTools, selectedCategory]); - // Categories to display - const displayedCategories = useMemo(() => { - if (selectedCategory === 'all') { - return categorizedTools; - } - return categorizedTools.filter((group) => group.id === selectedCategory); - }, [categorizedTools, selectedCategory]); - // If this is a simple embedded grid (e.g., inside an App detail page), render standard container if (!showCategoryFilter) { return ( @@ -537,25 +564,11 @@ export function ToolGridSection({ {/* Top: Header, Search, Categories Nav */}
- {/* Studio Brand & Directory Identity */} -
-
-
- -
-
- - Studio Directory - - - 12 neural models - -
-
- - - Ready - + {/* Categories Header */} +
+

+ Categories +

{/* Instant Search Bar with shortcut hint */} @@ -564,7 +577,7 @@ export function ToolGridSection({ setSearchQuery(e.target.value)} className="w-full pl-9 pr-8 py-2.5 rounded-2xl text-xs border border-rule bg-paper text-ink placeholder:text-muted focus:outline-none focus:border-accent focus:ring-2 focus:ring-accent/20 shadow-2xs font-body transition-colors" @@ -587,8 +600,8 @@ export function ToolGridSection({ {/* Categories Navigation */}
-
- Workspaces +
+ Workspaces {(selectedCategory !== 'all' || searchQuery) && (
- {/* Bottom: GPU RAM Ephemeral Telemetry & Native App Suite Link */} + {/* Bottom: Native App Suite Link */}
-
-
- - - Volatile GPU RAM - -
-

- In-browser GPU execution with immediate memory flush upon completion. Zero server storage. -

-
-
- - Studio Directory + + Categories - - {tools.length} neural models + + {tools.length} tools
@@ -789,62 +790,80 @@ export function ToolGridSection({ {/* ================= INTEGRATED STUDIO HEADER ================= */}
- {/* Breadcrumb row & telemetry */} -
-
- Studio Directory - / + {/* Breadcrumb row */} +
+ Studio Directory + / + {activeCategoryItem ? ( + <> + + / + + {resolveLocalised(activeCategoryItem.category?.name, locale)} + + + ) : ( - {activeCategoryItem - ? resolveLocalised(activeCategoryItem.category?.name, locale) - : 'All Vision Workspaces'} + All Vision Workspaces -
-
- - - {tools.length} Models Online - - - - Zero Server Storage - -
+ )}
- {/* Kinetic Headline */} -

- - {activeCategoryItem - ? resolveLocalised(activeCategoryItem.category?.name, locale) - : resolveLocalised(title, locale) || 'AI Photo & Vision Tools Studio'} - -

+ {activeCategoryItem ? ( + /* Focused Category Workspace Header */ +
+
+
+ {CATEGORY_THEMES[activeCategoryItem.id]?.icon || } +
+
+
+

+ + {resolveLocalised(activeCategoryItem.category?.name, locale)} + +

+ + {activeCategoryItem.tools.length}{' '} + {activeCategoryItem.tools.length === 1 ? 'tool' : 'tools'} + +
+

+ {CATEGORY_THEMES[activeCategoryItem.id]?.description || + resolveLocalised(activeCategoryItem.category?.description, locale)} +

+
+
- {/* Subtitle */} -

- {activeCategoryItem - ? CATEGORY_THEMES[activeCategoryItem.id]?.description || - resolveLocalised(activeCategoryItem.category?.description, locale) - : resolveLocalised(subtitle, locale) || - 'Client-side neural vision models running directly in volatile GPU memory with zero retention. Test interactive before/after sliders or export in native 4K.'} -

- - {/* Studio Capability Badges */} -
- - - Instant in-browser trial - - - - Ephemeral RAM purge - - - - iOS & Mac app handoff - -
+ +
+ ) : ( + /* Universal Studio Overview Header */ +
+

+ + {resolveLocalised(title, locale) || 'AI Photo & Vision Tools Studio'} + +

+

+ {resolveLocalised(subtitle, locale) || + 'Client-side neural vision models running directly in volatile GPU memory with zero retention. Test interactive before/after sliders or export in native 4K.'} +

+
+ )}
{/* ================= SEARCH RESULTS ACTIVE VIEW ================= */} @@ -891,41 +910,25 @@ export function ToolGridSection({
)}
+ ) : activeCategoryItem ? ( + /* ================= SINGLE CATEGORY FOCUSED WORKSPACE ================= */ +
+
+ {activeCategoryItem.tools.map((tool) => ( + + ))} +
+
) : ( /* ================= CATEGORIZED TOOLS GALLERY ================= */
- - {/* Active Category Header Banner if filtered */} - {activeCategoryItem && ( -
-
-
- - - Active Studio Workspace - -
-

- {resolveLocalised(activeCategoryItem.category?.name, locale)} -

-

- {CATEGORY_THEMES[activeCategoryItem.id]?.description || - resolveLocalised(activeCategoryItem.category?.description, locale)} -

-
- - -
- )} - {/* Displayed Categories */} - {displayedCategories.map((group) => { + {categorizedTools.map((group) => { const theme = CATEGORY_THEMES[group.id]; const catName = group.category ? resolveLocalised(group.category.name, locale) @@ -953,7 +956,7 @@ export function ToolGridSection({ {group.tools.length}{' '} - {group.tools.length === 1 ? 'model' : 'models'} + {group.tools.length === 1 ? 'tool' : 'tools'}
{catDesc && ( diff --git a/src/components/ui/CardBeforeAfterSlider.tsx b/src/components/ui/CardBeforeAfterSlider.tsx index 2156ab7..9b9c917 100644 --- a/src/components/ui/CardBeforeAfterSlider.tsx +++ b/src/components/ui/CardBeforeAfterSlider.tsx @@ -81,17 +81,22 @@ export function CardBeforeAfterSlider({ ); const handlePointerDown = (e: React.PointerEvent) => { + if (e.button !== 0 && e.pointerType === 'mouse') return; + e.stopPropagation(); isDraggingRef.current = true; isInteractedRef.current = true; if (containerRef.current) { cachedRectRef.current = containerRef.current.getBoundingClientRect(); } - (e.target as HTMLElement).setPointerCapture(e.pointerId); + try { + (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId); + } catch {} updatePosition(e.clientX); }; const handlePointerMove = (e: React.PointerEvent) => { if (!isDraggingRef.current) return; + e.stopPropagation(); if (rafIdRef.current !== null) cancelAnimationFrame(rafIdRef.current); rafIdRef.current = requestAnimationFrame(() => { updatePosition(e.clientX); @@ -99,15 +104,25 @@ export function CardBeforeAfterSlider({ }; const handlePointerUp = (e: React.PointerEvent) => { + if (!isDraggingRef.current) return; + e.stopPropagation(); isDraggingRef.current = false; cachedRectRef.current = null; try { - (e.target as HTMLElement).releasePointerCapture(e.pointerId); + (e.currentTarget as HTMLElement).releasePointerCapture(e.pointerId); } catch { // Ignore if pointer capture already released } }; + // On desktop with mouse, clicking anywhere on the card moves the slider. + // On phones / touch screens, touching the card does NOT move the slider, + // allowing completely unobstructed vertical page scrolling! + const handleContainerPointerDown = (e: React.PointerEvent) => { + if (e.pointerType !== 'mouse' || e.button !== 0) return; + handlePointerDown(e); + }; + const handleMouseEnter = () => { isHoveredRef.current = true; setIsHoveredState(true); @@ -128,9 +143,10 @@ export function CardBeforeAfterSlider({ return (