From 83dab9346ba4ec6f5d2a771aa8484172bc1d3289 Mon Sep 17 00:00:00 2001 From: shiva raj badu Date: Fri, 18 Jul 2025 04:07:28 +0545 Subject: [PATCH] feat(nextjs): Image editor features added --- .../components/ImageEditor.tsx | 175 +++++++++++++++++- 1 file changed, 167 insertions(+), 8 deletions(-) diff --git a/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx b/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx index 159abdac..eaf33d59 100644 --- a/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx +++ b/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx @@ -284,11 +284,7 @@ const ImageEditor = ({ } }; - // Helper function to determine image URL - const getImageUrl = (src: string | null) => { - if (!src) return ""; - return getStaticFileUrl(src) || ""; - }; + return ( onClose?.()}> @@ -296,23 +292,186 @@ const ImageEditor = ({ side="right" className="w-[600px]" onOpenAutoFocus={(e) => e.preventDefault()} + onClick={(e) => e.stopPropagation()} > Update Image
- - + + + + Edit + AI Generate - Upload + +
+ {/* Current Image Preview */} +
+

Current Image

+
+ {image ? ( + Current image { + e.stopPropagation(); + handleFocusPointClick(e); + }} + onError={(e) => { + console.error('Image failed to load:', image); + e.currentTarget.src = '/placeholder-image.png'; + }} + /> + ) : ( +
+
+ +

No image selected

+
+
+ )} + + {/* Focus Point Indicator */} + {isFocusPointMode && image && ( +
+ )} +
+ {/* Debug info */} + {image && ( +
+

Image Path: {image}

+

Resolved URL: {image}

+

Focus Point: {focusPoint.x.toFixed(1)}%, {focusPoint.y.toFixed(1)}%

+

Object Fit: {objectFit}

+
+ )} +
+ + {/* Editing Controls */} +
+ {/* Focus Point Controls */} +
+
+

Focus Point

+ +
+ {isFocusPointMode && ( +

+ Click on the image above to set the focus point +

+ )} +
+ + {/* Object Fit Controls */} +
+

Image Fit

+
+ + + +
+
+

Cover: Fill container, may crop image

+

Contain: Fit entire image, may show empty space

+

Fill: Stretch to fill container exactly

+
+
+ + {/* Quick Actions */} +
+

Quick Actions

+
+ +
+
+
+
+