From 146338f77e99fc9097d0e02ee464129ea7db0fe6 Mon Sep 17 00:00:00 2001 From: shiva raj badu Date: Wed, 6 Aug 2025 00:21:15 +0545 Subject: [PATCH] feat(Nextjs): Custom Layout Html edit and layout title & descritpion modal added --- .../components/AnthropicKeyWarning.tsx | 20 + .../components/EachSlide/EditControls.tsx | 165 ++++ .../components/EachSlide/HtmlEditor.tsx | 99 +++ .../components/EachSlide/NewEachSlide.tsx | 192 +++++ .../components/EachSlide/SlideActions.tsx | 102 +++ .../EachSlide/SlideContentDisplay.tsx | 122 +++ .../components/FileUploadSection.tsx | 115 +++ .../components/LoadingSpinner.tsx | 21 + .../components/SaveLayoutButton.tsx | 39 + .../components/SaveLayoutModal.tsx | 120 +++ .../hooks/useAnthropicKeyCheck.ts | 17 + .../custom-layout/hooks/useCustomLayout.ts | 32 + .../custom-layout/hooks/useDrawingCanvas.ts | 167 ++++ .../app/custom-layout/hooks/useFileUpload.ts | 39 + .../custom-layout/hooks/useFontManagement.ts | 152 ++++ .../app/custom-layout/hooks/useHtmlEdit.ts | 49 ++ .../custom-layout/hooks/useLayoutSaving.ts | 149 ++++ .../app/custom-layout/hooks/useSlideEdit.ts | 222 +++++ .../custom-layout/hooks/useSlideProcessing.ts | 198 +++++ servers/nextjs/app/custom-layout/page.tsx | 768 ++---------------- .../nextjs/app/custom-layout/types/index.ts | 108 +++ servers/nextjs/package.json | 2 +- servers/nextjs/tailwind.config.ts | 2 - 23 files changed, 2203 insertions(+), 697 deletions(-) create mode 100644 servers/nextjs/app/custom-layout/components/AnthropicKeyWarning.tsx create mode 100644 servers/nextjs/app/custom-layout/components/EachSlide/EditControls.tsx create mode 100644 servers/nextjs/app/custom-layout/components/EachSlide/HtmlEditor.tsx create mode 100644 servers/nextjs/app/custom-layout/components/EachSlide/NewEachSlide.tsx create mode 100644 servers/nextjs/app/custom-layout/components/EachSlide/SlideActions.tsx create mode 100644 servers/nextjs/app/custom-layout/components/EachSlide/SlideContentDisplay.tsx create mode 100644 servers/nextjs/app/custom-layout/components/FileUploadSection.tsx create mode 100644 servers/nextjs/app/custom-layout/components/LoadingSpinner.tsx create mode 100644 servers/nextjs/app/custom-layout/components/SaveLayoutButton.tsx create mode 100644 servers/nextjs/app/custom-layout/components/SaveLayoutModal.tsx create mode 100644 servers/nextjs/app/custom-layout/hooks/useAnthropicKeyCheck.ts create mode 100644 servers/nextjs/app/custom-layout/hooks/useCustomLayout.ts create mode 100644 servers/nextjs/app/custom-layout/hooks/useDrawingCanvas.ts create mode 100644 servers/nextjs/app/custom-layout/hooks/useFileUpload.ts create mode 100644 servers/nextjs/app/custom-layout/hooks/useFontManagement.ts create mode 100644 servers/nextjs/app/custom-layout/hooks/useHtmlEdit.ts create mode 100644 servers/nextjs/app/custom-layout/hooks/useLayoutSaving.ts create mode 100644 servers/nextjs/app/custom-layout/hooks/useSlideEdit.ts create mode 100644 servers/nextjs/app/custom-layout/hooks/useSlideProcessing.ts create mode 100644 servers/nextjs/app/custom-layout/types/index.ts diff --git a/servers/nextjs/app/custom-layout/components/AnthropicKeyWarning.tsx b/servers/nextjs/app/custom-layout/components/AnthropicKeyWarning.tsx new file mode 100644 index 00000000..68d8e565 --- /dev/null +++ b/servers/nextjs/app/custom-layout/components/AnthropicKeyWarning.tsx @@ -0,0 +1,20 @@ +import React from "react"; +import Header from "@/components/Header"; + +export const AnthropicKeyWarning: React.FC = () => { + return ( +
+
+
+
+

+ Please put Anthropic Key To Process The Layout +

+

+ It Only works on Anthropic(Claude-4). +

+
+
+
+ ); +}; \ No newline at end of file diff --git a/servers/nextjs/app/custom-layout/components/EachSlide/EditControls.tsx b/servers/nextjs/app/custom-layout/components/EachSlide/EditControls.tsx new file mode 100644 index 00000000..2ad731b7 --- /dev/null +++ b/servers/nextjs/app/custom-layout/components/EachSlide/EditControls.tsx @@ -0,0 +1,165 @@ +import React from "react"; +import { Button } from "@/components/ui/button"; +import { Textarea } from "@/components/ui/textarea"; +import { Pencil, Eraser, RotateCcw, SendHorizontal, X } from "lucide-react"; +import { EditControlsProps } from "../../types"; + +export const EditControls: React.FC = ({ + isEditMode, + prompt, + isUpdating, + strokeWidth, + strokeColor, + eraserMode, + onPromptChange, + onSave, + onCancel, + onStrokeWidthChange, + onStrokeColorChange, + onEraserModeChange, + onClearCanvas, +}) => { + const colors = [ + "#000000", + "#FF0000", + "#00FF00", + "#0000FF", + "#FFFF00", + "#FF00FF", + "#00FFFF", + "#FFA500", + ]; + + const strokeWidths = [1, 3, 5, 8, 12]; + + if (!isEditMode) return null; + + return ( +
+ {/* Drawing Tools */} +
+
+ {/* Drawing Tools */} +
+ + + +
+ + {/* Color Picker */} + {!eraserMode && ( +
+ {colors.map((color) => ( +
+ )} + + {/* Stroke Width */} +
+ {strokeWidths.map((width) => ( + + ))} +
+ + +
+ + +
+ + {/* Prompt Section */} +
+ +
+