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
This commit is contained in:
AmirReza Jamali
2025-11-10 12:41:41 +03:30
parent b8169fbcd9
commit 2b9eaa0495
21 changed files with 312 additions and 56 deletions
+6 -8
View File
@@ -64,13 +64,15 @@ export function Select<T extends FieldValues>({
}, [controlledValue]);
const handleClear = () => {
setValue("");
if (controlledValue === undefined) {
setValue("");
}
setIsOptionSelected(false);
onClear?.();
if (onChange) {
const event = {
target: { value: "" },
} as ChangeEvent<HTMLSelectElement>;
target: { value: "", name },
} as unknown as ChangeEvent<HTMLSelectElement>;
onChange(event);
}
};
@@ -113,11 +115,7 @@ export function Select<T extends FieldValues>({
clearable && value && "pr-20",
)}
>
{placeholder && (
<option value="" disabled hidden>
{placeholder}
</option>
)}
{placeholder && <option value="">{placeholder}</option>}
{items.map((item) => (
<option key={item.value} value={item.value}>
+17 -4
View File
@@ -10,12 +10,16 @@ interface StepperProps {
steps: Step[];
currentStep?: number;
onStepChange?: (step: number) => void;
onSubmit?: () => void;
isSubmitting?: boolean;
}
const Stepper: React.FC<StepperProps> = ({
steps,
currentStep: controlledStep,
onStepChange,
onSubmit,
isSubmitting = false,
}) => {
const [internalStep, setInternalStep] = useState(0);
const currentStep =
@@ -32,7 +36,12 @@ const Stepper: React.FC<StepperProps> = ({
};
const nextStep = () => {
if (currentStep < steps.length - 1) {
if (currentStep === steps.length - 1) {
// On last step, trigger submit
if (onSubmit) {
onSubmit();
}
} else if (currentStep < steps.length - 1) {
const newStep = currentStep + 1;
if (onStepChange) {
onStepChange(newStep);
@@ -124,14 +133,18 @@ const Stepper: React.FC<StepperProps> = ({
</button>
<button
onClick={nextStep}
disabled={currentStep === steps.length - 1}
disabled={isSubmitting}
className={`rounded-lg px-6 py-2 font-medium transition-all ${
currentStep === steps.length - 1
isSubmitting
? "cursor-not-allowed bg-gray-1 text-gray-4"
: "bg-primary text-white hover:bg-primary/90"
}`}
>
{currentStep === steps.length - 1 ? "Completed" : "Next"}
{isSubmitting
? "Submitting..."
: currentStep === steps.length - 1
? "Submit"
: "Next"}
</button>
</div>
</div>