diff --git a/src/app/dashboard/(admin)/admin/email/edit-in-buit-templates/_components/preview-card/index.tsx b/src/app/dashboard/(admin)/admin/email/edit-in-buit-templates/_components/preview-card/index.tsx index 01019875f..24c27d371 100644 --- a/src/app/dashboard/(admin)/admin/email/edit-in-buit-templates/_components/preview-card/index.tsx +++ b/src/app/dashboard/(admin)/admin/email/edit-in-buit-templates/_components/preview-card/index.tsx @@ -1,8 +1,12 @@ const PreviewCard = () => { + // @kinxlo IS CURRENTLY WORKING ON THIS FIX đź‘Ť. return (
-
+
+ hi guys, @Guy in A Chair is currently working on this component + responsivess đź‘Ť +
); diff --git a/src/app/dashboard/(admin)/admin/email/generate-with-html/_components/generate-field/generate-field.tsx b/src/app/dashboard/(admin)/admin/email/generate-with-html/_components/generate-field/generate-field.tsx index 9a6000999..886d9c69d 100644 --- a/src/app/dashboard/(admin)/admin/email/generate-with-html/_components/generate-field/generate-field.tsx +++ b/src/app/dashboard/(admin)/admin/email/generate-with-html/_components/generate-field/generate-field.tsx @@ -14,9 +14,7 @@ const GenerateField = () => { isButtonVisible={true} buttonContent="Generate" onButtonClick={() => - router.push( - "/dashboard/admin/email/generate-with-html/preview-template", - ) + router.push("/admin/email/generate-with-html/preview-template") } /> diff --git a/src/app/dashboard/(admin)/admin/email/generate-with-html/preview-template/_component.tsx/TemplateViewer.tsx b/src/app/dashboard/(admin)/admin/email/generate-with-html/preview-template/_component.tsx/TemplateViewer.tsx index 07ecb7405..3909f607a 100644 --- a/src/app/dashboard/(admin)/admin/email/generate-with-html/preview-template/_component.tsx/TemplateViewer.tsx +++ b/src/app/dashboard/(admin)/admin/email/generate-with-html/preview-template/_component.tsx/TemplateViewer.tsx @@ -1,21 +1,25 @@ -import React, { useEffect, useRef, useState } from "react"; +import { usePathname } from "next/navigation"; +import React, { ReactNode, useEffect, useRef, useState } from "react"; interface PreviewComponentProperties { - template?: string; + template?: string | ReactNode; mode?: "preview" | "edit"; onEdit?: (content: string) => void; } const TemplateViewer: React.FC = ({ - template = "", + template, mode = "preview", onEdit, }) => { - const [content, setContent] = useState(template); + const [content, setContent] = useState(template as string); const contentReference = useRef(null); + const pathname = usePathname(); useEffect(() => { - setContent(template); + if (typeof template === "string") { + setContent(template); + } }, [template]); useEffect(() => { @@ -28,8 +32,10 @@ const TemplateViewer: React.FC = ({ event: React.ChangeEvent, ) => { const newContent = event.target.value; - setContent(newContent); - onEdit?.(newContent); + if (newContent !== content) { + setContent(newContent); + onEdit?.(newContent); + } }; return ( @@ -41,7 +47,7 @@ const TemplateViewer: React.FC = ({ data-testid="scroll-container" className="relative overflow-y-auto rounded-lg lg:max-h-[719px]" > -
+
{mode === "edit" ? (