diff --git a/servers/nextjs/app/(presentation-generator)/components/IconsEditor.tsx b/servers/nextjs/app/(presentation-generator)/components/IconsEditor.tsx index 1b8ecf12..ca8d6e17 100644 --- a/servers/nextjs/app/(presentation-generator)/components/IconsEditor.tsx +++ b/servers/nextjs/app/(presentation-generator)/components/IconsEditor.tsx @@ -28,6 +28,7 @@ interface IconsEditorProps { isWhite?: boolean; className?: string; icon_prompt?: string[] | null; + onClose?: () => void; } const IconsEditor = ({ @@ -39,6 +40,7 @@ const IconsEditor = ({ slideIndex, elementId, icon_prompt, + onClose, }: IconsEditorProps) => { const dispatch = useDispatch(); @@ -97,124 +99,83 @@ const IconsEditor = ({ }; return ( - <> -
onClose?.()}> + e.preventDefault()} + onClick={(e) => e.stopPropagation()} > - {icon ? ( - slide icon + Choose Icon + +
+
{ + e.preventDefault(); + e.stopPropagation(); + handleIconSearch(); }} - data-slide-index={slideIndex} - data-element-type="picture" - data-is-icon - data-element-id={`${elementId}-image`} - data-is-network={false} - data-image-path={icon} - /> - ) : ( -
- - {initialIcon !== undefined && ( -

- -

+ > +
+ + + setSearchQuery(e.target.value)} + onClick={(e) => e.stopPropagation()} + className="pl-10" + /> +
+ + + + {/* Icons grid */} +
+ {loading ? ( +
+ {Array.from({ length: 40 }).map((_, index) => ( + + ))} +
+ ) : icons.length > 0 ? ( +
+ {icons.map((iconSrc, idx) => ( +
{ + e.stopPropagation(); + handleIconChange(iconSrc); + }} + className="w-12 h-12 cursor-pointer group relative rounded-lg overflow-hidden hover:bg-gray-100 p-2" + > + {`Icon +
+ ))} +
+ ) : ( +
+ +

No icons found for your search.

+

Try refining your search query.

+
)}
- )} - {/* Hover overlay */} -
-
- - - e.preventDefault()} - > - - Choose Icon - -
-
{ - e.preventDefault(); - handleIconSearch(); - }} - > -
- - - setSearchQuery(e.target.value)} - className="pl-10" - /> -
- -
- - {/* Icons grid */} -
- {loading ? ( -
- {Array.from({ length: 40 }).map((_, index) => ( - - ))} -
- ) : icons.length > 0 ? ( -
- {icons.map((iconSrc, idx) => ( -
handleIconChange(iconSrc)} - className="w-12 h-12 cursor-pointer group relative rounded-lg overflow-hidden hover:bg-gray-100 p-2" - > - {`Icon -
- ))} -
- ) : ( -
- -

No icons found for your search.

-

Try refining your search query.

-
- )} -
-
-
-
- +
+ + ); }; diff --git a/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx b/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx index de66031f..14349032 100644 --- a/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx +++ b/servers/nextjs/app/(presentation-generator)/components/ImageEditor.tsx @@ -12,9 +12,8 @@ import { Textarea } from "@/components/ui/textarea"; import { Wand2, Upload, - Edit, Move, - Maximize, + } from "lucide-react"; import { cn } from "@/lib/utils"; import { useDispatch, useSelector } from "react-redux"; @@ -28,34 +27,27 @@ import { } from "@/store/slices/presentationGeneration"; import { getStaticFileUrl, ThemeImagePrompt } from "../utils/others"; -import { - Popover, - PopoverContent, - PopoverTrigger, -} from "@/components/ui/popover"; -import ToolTip from "@/components/ToolTip"; interface ImageEditorProps { initialImage: string | null; imageIdx?: number; - title: string; + slideIndex: number; - elementId: string; + className?: string; promptContent?: string; properties?: null | any; + onClose?: () => void; } const ImageEditor = ({ initialImage, imageIdx = 0, - className, - title, slideIndex, - elementId, promptContent, properties, + onClose, }: ImageEditorProps) => { const dispatch = useDispatch(); @@ -64,9 +56,6 @@ const ImageEditor = ({ const searchParams = useSearchParams(); const [image, setImage] = useState(initialImage); const [previewImages, setPreviewImages] = useState([initialImage]); - - const [isEditorOpen, setIsEditorOpen] = useState(false); - const [isToolbarOpen, setIsToolbarOpen] = useState(false); const [prompt, setPrompt] = useState(""); const [isGenerating, setIsGenerating] = useState(false); const [error, setError] = useState(null); @@ -108,7 +97,7 @@ const ImageEditor = ({ !toolbarRef.current.contains(event.target as Node) && !popoverContentRef.current ) { - setIsToolbarOpen(false); + if (isFocusPointMode) { // saveFocusPoint(); // Save focus point before closing saveImageProperties(objectFit, focusPoint); @@ -123,16 +112,7 @@ const ImageEditor = ({ }; }, [isFocusPointMode, focusPoint]); - const handleImageClick = () => { - if (!isFocusPointMode) { - setIsToolbarOpen(true); - } - }; - const handleOpenEditor = () => { - setIsToolbarOpen(false); - setIsEditorOpen(true); - }; const handleImageChange = (newImage: string) => { setImage(newImage); @@ -143,7 +123,6 @@ const ImageEditor = ({ image: newImage, }) ); - setIsEditorOpen(false); }; const handleFocusPointClick = (e: React.MouseEvent) => { @@ -282,383 +261,344 @@ const ImageEditor = ({ } }; - // Helper function to determine image URL - const getImageUrl = (src: string | null) => { - if (!src) return ""; - return getStaticFileUrl(src) || ""; - }; + return ( - <> -
{ - if (initialImage !== undefined) { - if (isFocusPointMode) { - handleFocusPointClick(e); - } else { - handleImageClick(); - } - } - }} + onClose?.()}> + e.preventDefault()} + onClick={(e) => e.stopPropagation()} > - {image ? ( - {title} - ) : ( -
- - { -

- {initialImage !== undefined - ? "Click to add image" - : "Loading..."} -

- } -
- )} + + Update Image + -
+
+ + + + Edit + + + AI Generate + + + Upload + + - {isFocusPointMode && ( -
-
-

- Click anywhere to set focus point -

- -
- - {/* Focus point marker */} -
-
-
-
-
-
-
-
- )} - - {/* Image Toolbar */} - {isToolbarOpen && !isFocusPointMode && ( -
-
- - - - - - - - - - - - -
- - - -
-
-
-
-
- )} -
- - - e.preventDefault()} - > - - Update Image - - -
- - - - AI Generate - - - - Upload - - - - -
-
-
-

Current Prompt

- -

{promptContent}

-
-
-

- Image Description -

-