From b8169fbcd985bc5ac1afd827c393619a7a3329f9 Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Mon, 10 Nov 2025 09:58:27 +0330 Subject: [PATCH] Add section validations --- .../create/_components/SectionStep.tsx | 28 ++++++++++++------- src/components/Tables/contact-us/index.tsx | 24 ++++++++++------ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/app/marketing/create/_components/SectionStep.tsx b/src/app/marketing/create/_components/SectionStep.tsx index 0f1d610..087794a 100644 --- a/src/app/marketing/create/_components/SectionStep.tsx +++ b/src/app/marketing/create/_components/SectionStep.tsx @@ -3,16 +3,17 @@ import { TrashIcon } from "@/assets/icons"; import InputGroup from "@/components/FormElements/InputGroup"; import { TextAreaGroup } from "@/components/FormElements/InputGroup/text-area"; import { ShowcaseSection } from "@/components/Layouts/showcase-section"; +import { REGEX } from "@/constants/regex"; import { FormErrorMessages } from "@/constants/Texts"; import { - Control, - FieldErrors, - FieldValues, - Path, - UseFieldArrayAppend, - UseFieldArrayRemove, - UseFormHandleSubmit, - UseFormRegister, + Control, + FieldErrors, + FieldValues, + Path, + UseFieldArrayAppend, + UseFieldArrayRemove, + UseFormHandleSubmit, + UseFormRegister, } from "react-hook-form"; interface IProps { @@ -73,7 +74,10 @@ const SectionStep = ({ placeholder="Enter Section Description" /> - + {fields.map((field, index) => (
({ message: FormErrorMessages.required, value: true, }, + pattern: { + message: FormErrorMessages.invalidPattern, + value: REGEX.URL, + }, })} label="Icon" name={`cards.${index}.icon`} required type="text" - placeholder="Enter Icon URL or name" + placeholder="Enter Icon URL" /> , { diff --git a/src/components/Tables/contact-us/index.tsx b/src/components/Tables/contact-us/index.tsx index 00f8505..796a9da 100644 --- a/src/components/Tables/contact-us/index.tsx +++ b/src/components/Tables/contact-us/index.tsx @@ -1,6 +1,12 @@ "use client"; import EmptyListWrapper from "@/components/HOC/EmptyListWrapper"; -import { Table, TableHead, TableHeader, TableRow } from "@/components/ui/table"; +import { + Table, + TableBody, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table"; import TableSkeleton from "@/components/ui/TableSkeleton"; import { useContactUsListPresenter } from "./useContactUsListPresenter"; @@ -24,13 +30,15 @@ const ContactUsTable = () => { {isPending && } - - Contact us table will be initialized here - + + + Contact us table will be initialized here + +
);