From 2b9eaa0495e7cc71d695b61900818c8a364aaa7f Mon Sep 17 00:00:00 2001 From: AmirReza Jamali Date: Mon, 10 Nov 2025 12:41:41 +0330 Subject: [PATCH] refactor(marketing): Restructure marketing wizard components and improve project organization - Move all marketing wizard components from `create/_components` to `_components` directory - Update import paths in `create/page.tsx` to reflect new component locations - Add countries constant to support country selection in page type configuration - Minor formatting and cleanup of `.vscode/settings.json` - Prepare for more modular and consistent component structure in marketing wizard --- .vscode/settings.json | 3 +- .../{create => }/_components/BenefitsStep.tsx | 0 .../_components/ChallengesStep.tsx | 0 .../{create => }/_components/ChartPreview.tsx | 0 .../{create => }/_components/ChartStep.tsx | 0 .../{create => }/_components/ContactsStep.tsx | 0 .../{create => }/_components/FeaturesStep.tsx | 0 .../{create => }/_components/FooterStep.tsx | 0 .../{create => }/_components/HeroStep.tsx | 0 .../{create => }/_components/SectionStep.tsx | 0 .../_components/useBenefitsStepPresenter.ts | 0 .../_components/useChallengesStepPresenter.ts | 0 .../_components/useChartStepPresenter.ts | 0 .../_components/useContactsStepPresenter.ts | 0 .../_components/useFeaturesStepPresenter.ts | 0 .../_components/useFooterStepPresenter.ts | 0 .../_components/useHeroStepPresenter.ts | 0 src/app/marketing/create/page.tsx | 72 ++--- src/components/FormElements/select.tsx | 14 +- src/components/ui/Stepper.tsx | 21 +- src/constants/countries.ts | 258 ++++++++++++++++++ 21 files changed, 312 insertions(+), 56 deletions(-) rename src/app/marketing/{create => }/_components/BenefitsStep.tsx (100%) rename src/app/marketing/{create => }/_components/ChallengesStep.tsx (100%) rename src/app/marketing/{create => }/_components/ChartPreview.tsx (100%) rename src/app/marketing/{create => }/_components/ChartStep.tsx (100%) rename src/app/marketing/{create => }/_components/ContactsStep.tsx (100%) rename src/app/marketing/{create => }/_components/FeaturesStep.tsx (100%) rename src/app/marketing/{create => }/_components/FooterStep.tsx (100%) rename src/app/marketing/{create => }/_components/HeroStep.tsx (100%) rename src/app/marketing/{create => }/_components/SectionStep.tsx (100%) rename src/app/marketing/{create => }/_components/useBenefitsStepPresenter.ts (100%) rename src/app/marketing/{create => }/_components/useChallengesStepPresenter.ts (100%) rename src/app/marketing/{create => }/_components/useChartStepPresenter.ts (100%) rename src/app/marketing/{create => }/_components/useContactsStepPresenter.ts (100%) rename src/app/marketing/{create => }/_components/useFeaturesStepPresenter.ts (100%) rename src/app/marketing/{create => }/_components/useFooterStepPresenter.ts (100%) rename src/app/marketing/{create => }/_components/useHeroStepPresenter.ts (100%) create mode 100644 src/constants/countries.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 7a73a41..0967ef4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,2 +1 @@ -{ -} \ No newline at end of file +{} diff --git a/src/app/marketing/create/_components/BenefitsStep.tsx b/src/app/marketing/_components/BenefitsStep.tsx similarity index 100% rename from src/app/marketing/create/_components/BenefitsStep.tsx rename to src/app/marketing/_components/BenefitsStep.tsx diff --git a/src/app/marketing/create/_components/ChallengesStep.tsx b/src/app/marketing/_components/ChallengesStep.tsx similarity index 100% rename from src/app/marketing/create/_components/ChallengesStep.tsx rename to src/app/marketing/_components/ChallengesStep.tsx diff --git a/src/app/marketing/create/_components/ChartPreview.tsx b/src/app/marketing/_components/ChartPreview.tsx similarity index 100% rename from src/app/marketing/create/_components/ChartPreview.tsx rename to src/app/marketing/_components/ChartPreview.tsx diff --git a/src/app/marketing/create/_components/ChartStep.tsx b/src/app/marketing/_components/ChartStep.tsx similarity index 100% rename from src/app/marketing/create/_components/ChartStep.tsx rename to src/app/marketing/_components/ChartStep.tsx diff --git a/src/app/marketing/create/_components/ContactsStep.tsx b/src/app/marketing/_components/ContactsStep.tsx similarity index 100% rename from src/app/marketing/create/_components/ContactsStep.tsx rename to src/app/marketing/_components/ContactsStep.tsx diff --git a/src/app/marketing/create/_components/FeaturesStep.tsx b/src/app/marketing/_components/FeaturesStep.tsx similarity index 100% rename from src/app/marketing/create/_components/FeaturesStep.tsx rename to src/app/marketing/_components/FeaturesStep.tsx diff --git a/src/app/marketing/create/_components/FooterStep.tsx b/src/app/marketing/_components/FooterStep.tsx similarity index 100% rename from src/app/marketing/create/_components/FooterStep.tsx rename to src/app/marketing/_components/FooterStep.tsx diff --git a/src/app/marketing/create/_components/HeroStep.tsx b/src/app/marketing/_components/HeroStep.tsx similarity index 100% rename from src/app/marketing/create/_components/HeroStep.tsx rename to src/app/marketing/_components/HeroStep.tsx diff --git a/src/app/marketing/create/_components/SectionStep.tsx b/src/app/marketing/_components/SectionStep.tsx similarity index 100% rename from src/app/marketing/create/_components/SectionStep.tsx rename to src/app/marketing/_components/SectionStep.tsx diff --git a/src/app/marketing/create/_components/useBenefitsStepPresenter.ts b/src/app/marketing/_components/useBenefitsStepPresenter.ts similarity index 100% rename from src/app/marketing/create/_components/useBenefitsStepPresenter.ts rename to src/app/marketing/_components/useBenefitsStepPresenter.ts diff --git a/src/app/marketing/create/_components/useChallengesStepPresenter.ts b/src/app/marketing/_components/useChallengesStepPresenter.ts similarity index 100% rename from src/app/marketing/create/_components/useChallengesStepPresenter.ts rename to src/app/marketing/_components/useChallengesStepPresenter.ts diff --git a/src/app/marketing/create/_components/useChartStepPresenter.ts b/src/app/marketing/_components/useChartStepPresenter.ts similarity index 100% rename from src/app/marketing/create/_components/useChartStepPresenter.ts rename to src/app/marketing/_components/useChartStepPresenter.ts diff --git a/src/app/marketing/create/_components/useContactsStepPresenter.ts b/src/app/marketing/_components/useContactsStepPresenter.ts similarity index 100% rename from src/app/marketing/create/_components/useContactsStepPresenter.ts rename to src/app/marketing/_components/useContactsStepPresenter.ts diff --git a/src/app/marketing/create/_components/useFeaturesStepPresenter.ts b/src/app/marketing/_components/useFeaturesStepPresenter.ts similarity index 100% rename from src/app/marketing/create/_components/useFeaturesStepPresenter.ts rename to src/app/marketing/_components/useFeaturesStepPresenter.ts diff --git a/src/app/marketing/create/_components/useFooterStepPresenter.ts b/src/app/marketing/_components/useFooterStepPresenter.ts similarity index 100% rename from src/app/marketing/create/_components/useFooterStepPresenter.ts rename to src/app/marketing/_components/useFooterStepPresenter.ts diff --git a/src/app/marketing/create/_components/useHeroStepPresenter.ts b/src/app/marketing/_components/useHeroStepPresenter.ts similarity index 100% rename from src/app/marketing/create/_components/useHeroStepPresenter.ts rename to src/app/marketing/_components/useHeroStepPresenter.ts diff --git a/src/app/marketing/create/page.tsx b/src/app/marketing/create/page.tsx index 7002749..632ed8a 100644 --- a/src/app/marketing/create/page.tsx +++ b/src/app/marketing/create/page.tsx @@ -1,24 +1,26 @@ "use client"; +import { GlobeIcon } from "@/assets/icons"; import Breadcrumb from "@/components/Breadcrumbs/Breadcrumb"; import InputGroup from "@/components/FormElements/InputGroup"; import { Select } from "@/components/FormElements/select"; import { ShowcaseSection } from "@/components/Layouts/showcase-section"; import Stepper, { Step } from "@/components/ui/Stepper"; +import { Countries } from "@/constants/countries"; import { FormErrorMessages } from "@/constants/Texts"; import { useCreateCms } from "@/hooks/queries/useCmsQueries"; import { BreadcrumbItem } from "@/types/shared"; import { useRef, useState } from "react"; import { useForm } from "react-hook-form"; -import BenefitsStep from "./_components/BenefitsStep"; -import ChallengesStep from "./_components/ChallengesStep"; -import ChartStep from "./_components/ChartStep"; -import ContactsStep from "./_components/ContactsStep"; -import FeaturesStep from "./_components/FeaturesStep"; -import FooterStep from "./_components/FooterStep"; -import HeroStep from "./_components/HeroStep"; +import BenefitsStep from "../_components/BenefitsStep"; +import ChallengesStep from "../_components/ChallengesStep"; +import ChartStep from "../_components/ChartStep"; +import ContactsStep from "../_components/ContactsStep"; +import FeaturesStep from "../_components/FeaturesStep"; +import FooterStep from "../_components/FooterStep"; +import HeroStep from "../_components/HeroStep"; interface IPageTypeFields { - page_type: "company" | "organization"; + type: "company" | "organization"; language?: string; company_name?: string; country?: string; @@ -40,13 +42,14 @@ const Marketing = () => { watch: watchPageType, formState: { errors: pageTypeErrors }, getValues: getPageTypeValues, + setValue, } = useForm({ defaultValues: { - page_type: "company", + type: "company", }, }); - const pageType = watchPageType("page_type"); + const pageType = watchPageType("type"); const isCompany = pageType === "company"; const { mutate: createCms, isPending } = useCreateCms(); @@ -146,11 +149,11 @@ const Marketing = () => { const handleSubmitAll = async () => { const allData = await collectAllStepsData(); const pageTypeData = getPageTypeValues(); - + const finalData = { ...allData, - page_type: pageTypeData.page_type, - ...(pageTypeData.page_type === "company" && { + page_type: pageTypeData.type, + ...(pageTypeData.type === "company" && { language: pageTypeData.language, company_name: pageTypeData.company_name, country: pageTypeData.country, @@ -223,7 +226,7 @@ const Marketing = () => {