import { useEffect, useState } from 'react'; import { useWizardStore } from '../store/wizardStore'; import CategorySelection from './Steps/CategorySelection'; import OperationSelection from './Steps/OperationSelection'; import AttributeForm from './Steps/AttributeForm'; import TextEditorStep from './Steps/TextEditorStep'; import PhotoUploadStep from './Steps/PhotoUploadStep'; import SummaryStep from './Steps/SummaryStep'; import { wizardService } from '../services/wizardService'; import type { AttributeDefinition } from '../types'; import SEO from '../components/SEO'; export default function PublishPage() { const { step, selectedCategory } = useWizardStore(); const [definitions, setDefinitions] = useState([]); useEffect(() => { // CAMBIO: Agregamos el guard aquí también if (selectedCategory?.id) { wizardService.getAttributes(selectedCategory.id) .then(setDefinitions) .catch(err => console.error("Error en PublishPage:", err)); } }, [selectedCategory?.id]); return (
{/* Header del Wizard interno */}
Paso {step} de 6
{[1, 2, 3, 4, 5, 6].map((i) => (
))}
{step === 1 && } {step === 2 && } {step === 3 && } {step === 4 && } {step === 5 && } {step === 6 && }
); }