Skip to content

Commit

Permalink
refactor(create-forms): 🎉 update create forms
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhangunduz committed Oct 31, 2023
1 parent 2d5645b commit 570bbb0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import {
IRobotWorkspaces,
} from "../../interfaces/robotInterfaces";

interface ICFWorkspaces {
interface ICFWorkspacesMapper {
formik: FormikProps<IRobotWorkspaces>;
responseRobot: any;
isImportRobot?: boolean;
}

export default function CFWorkspaces({
export default function CFWorkspacesMapper({
formik,
responseRobot,
isImportRobot,
}: ICFWorkspaces): ReactElement {
}: ICFWorkspacesMapper): ReactElement {
const { robotData } = useCreateRobot();

return (
Expand Down
30 changes: 16 additions & 14 deletions src/components/CreateForms/CreateRobotFormStep2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
envOnPremiseFleet,
envOnPremiseRobot,
} from "../../helpers/envProvider";
import CreateRobotFormCancelButton from "../CFCancelButton/CFCancelButton";
import CFCancelButton from "../CFCancelButton/CFCancelButton";
import { CreateEnvironmentFormStep2Validations } from "../../validations/EnvironmentsValidations";
import CFLoader from "../CFLoader/CFLoader";
import CFWorkspaces from "../CFWorkspaces/CFWorkspaces";
import CFWorkspacesMapper from "../CFWorkspacesMapper/CFWorkspacesMapper";
import { CreateRobotFormStep2Validations } from "../../validations/RobotsValidations";
import { IRobotWorkspaces } from "../../interfaces/robotInterfaces";
import { createEnvironment } from "../../toolkit/EnvironmentSlice";
Expand Down Expand Up @@ -279,7 +279,7 @@ export default function CreateRobotFormStep2({
}
formik={formik}
>
<CFWorkspaces
<CFWorkspacesMapper
formik={formik}
responseRobot={responseRobot}
isImportRobot={isImportRobot}
Expand All @@ -288,20 +288,22 @@ export default function CreateRobotFormStep2({
<CFAddWorkspaceButton formik={formik} />

<Fragment>
{!(envOnPremiseRobot && url?.robotName ? true : false) && (
{!(envOnPremiseRobot && url?.robotName) && (
<div className="mt-10 flex w-full flex-col gap-6">
<div className="flex gap-2">
{!isImportRobot && (
<CreateRobotFormCancelButton disabled={formik.isSubmitting} />
<CFCancelButton disabled={formik.isSubmitting} />
)}
<Button
type="submit"
disabled={
!formik?.isValid ||
formik.isSubmitting ||
JSON.stringify(formik.initialValues) ===
JSON.stringify(formik.values) ||
(envOnPremiseRobot && url?.robotName ? true : false)
!!(
!formik?.isValid ||
formik.isSubmitting ||
JSON.stringify(formik.initialValues) ===
JSON.stringify(formik.values) ||
(envOnPremiseRobot && url?.robotName)
)
}
loading={formik.isSubmitting}
className="!h-11 w-full text-xs"
Expand All @@ -313,15 +315,15 @@ export default function CreateRobotFormStep2({
alt="loading"
/>
) : isImportRobot ? (
`Update Robot`
"Update Robot"
) : robotData?.step1?.isDevelopmentMode ? (
envOnPremiseRobot ? (
`Create Application with Workspaces`
"Create Application with Workspaces"
) : (
`Create Robot`
"Create Robot"
)
) : (
`Next Step`
"Next Step"
)
}
/>
Expand Down

0 comments on commit 570bbb0

Please sign in to comment.