diff --git a/frontend/lib/components/AddBrainModal/components/AddBrainSteps/AddBrainSteps.tsx b/frontend/lib/components/AddBrainModal/components/AddBrainSteps/AddBrainSteps.tsx index 76a12a563..d184c2aac 100644 --- a/frontend/lib/components/AddBrainModal/components/AddBrainSteps/AddBrainSteps.tsx +++ b/frontend/lib/components/AddBrainModal/components/AddBrainSteps/AddBrainSteps.tsx @@ -5,6 +5,7 @@ import Button from "@/lib/components/ui/Button"; import { Modal } from "@/lib/components/ui/Modal"; import { cn } from "@/lib/utils"; +import { BrainParamsStep } from "./components/BrainParamsStep/BrainParamsStep"; import { BrainTypeSelectionStep } from "./components/BrainTypeSelectionStep/BrainTypeSelectionStep"; import { Stepper } from "./components/Stepper/Stepper"; import { useAddBrainConfig } from "./hooks/useAddBrainConfig"; @@ -22,37 +23,38 @@ export const AddBrainSteps = ({ useAddBrainConfig(); return ( - <> - void 0} - variant={"tertiary"} - className={cn("border-0", triggerClassName)} - data-testid="add-brain-button" - > - {t("newBrain", { ns: "brain" })} - - - } - title={t("newBrainTitle", { ns: "brain" })} - desc={t("newBrainSubtitle", { ns: "brain" })} - isOpen={isBrainCreationModalOpened} - setOpen={setIsBrainCreationModalOpened} - CloseTrigger={
} - > -
{ - e.preventDefault(); - }} - className="my-10 flex flex-col items-center gap-2 justify-center" + void 0} + variant={"tertiary"} + className={cn("border-0", triggerClassName)} + data-testid="add-brain-button" > - - setIsBrainCreationModalOpened(false)} - /> - -
- + {t("newBrain", { ns: "brain" })} + + + } + title={t("newBrainTitle", { ns: "brain" })} + desc={t("newBrainSubtitle", { ns: "brain" })} + isOpen={isBrainCreationModalOpened} + setOpen={setIsBrainCreationModalOpened} + CloseTrigger={
} + > +
{ + e.preventDefault(); + }} + className="my-10 flex flex-col items-center gap-2 justify-center" + > + + setIsBrainCreationModalOpened(false)} + /> + setIsBrainCreationModalOpened(false)} + /> + + ); }; diff --git a/frontend/lib/components/AddBrainModal/components/AddBrainSteps/components/BrainParamsStep/BrainParamsStep.tsx b/frontend/lib/components/AddBrainModal/components/AddBrainSteps/components/BrainParamsStep/BrainParamsStep.tsx new file mode 100644 index 000000000..582167443 --- /dev/null +++ b/frontend/lib/components/AddBrainModal/components/AddBrainSteps/components/BrainParamsStep/BrainParamsStep.tsx @@ -0,0 +1,105 @@ +import { Fragment } from "react"; +import { useTranslation } from "react-i18next"; +import { FaArrowLeft, FaArrowRight } from "react-icons/fa"; + +import { PublicAccessConfirmationModal } from "@/lib/components/AddBrainModalOld/components/AddBrainConfig/components/PublicAccessConfirmationModal"; +import Button from "@/lib/components/ui/Button"; +import Field from "@/lib/components/ui/Field"; +import { Radio } from "@/lib/components/ui/Radio"; +import { TextArea } from "@/lib/components/ui/TextArea"; + +import { useBrainParamsStep } from "./hooks/useBrainParamsStep"; +import { useBrainStatusOptions } from "./hooks/useBrainStatusOptions"; +import { usePublicAccessConfirmationModal } from "./hooks/usePublicAccessConfirmationModal"; +import { useBrainCreationSteps } from "../../hooks/useBrainCreationSteps"; +import { useBrainTypeSelectionStep } from "../BrainTypeSelectionStep/hooks/useBrainTypeSelectionStep"; + +type BrainParamsStepProps = { + onCancelBrainCreation: () => void; +}; + +export const BrainParamsStep = ({ + onCancelBrainCreation, +}: BrainParamsStepProps): JSX.Element => { + const { goToNextStep, goToPreviousStep, currentStep } = + useBrainCreationSteps(); + const { register } = useBrainTypeSelectionStep(); + const { t } = useTranslation(["translation", "brain", "config"]); + const { brainStatusOptions } = useBrainStatusOptions(); + const { isNextButtonDisabled } = useBrainParamsStep(); + const { + isPublicAccessConfirmationModalOpened, + onCancelPublicAccess, + onConfirmPublicAccess, + } = usePublicAccessConfirmationModal(); + + if (currentStep !== "BRAIN_PARAMS") { + return ; + } + + return ( + <> + +