feat(client): enable step wizard on infrastructure and pagespeed create pages
This commit is contained in:
1 parent
420c103f41
commit
01c3870b22
1 file changed
+8
-5
@@ -234,6 +234,9 @@ const CreateMonitorPage = () => {
|
|||||||
}, [location.pathname]);
|
}, [location.pathname]);
|
||||||
|
|
||||||
const showTypeSelector = pageType === "uptime" && !isEditMode;
|
const showTypeSelector = pageType === "uptime" && !isEditMode;
|
||||||
|
// The multi-step wizard applies to every create flow; only the monitor-type
|
||||||
|
// radio is uptime-specific. Edit mode keeps the flat form.
|
||||||
|
const isWizard = !isEditMode;
|
||||||
const defaultType: MonitorType =
|
const defaultType: MonitorType =
|
||||||
pageType === "pagespeed"
|
pageType === "pagespeed"
|
||||||
? "pagespeed"
|
? "pagespeed"
|
||||||
@@ -267,7 +270,7 @@ const CreateMonitorPage = () => {
|
|||||||
// Multi-step wizard, uptime create only (showTypeSelector). Other flows
|
// Multi-step wizard, uptime create only (showTypeSelector). Other flows
|
||||||
// keep the flat form, where showStep() is always true.
|
// keep the flat form, where showStep() is always true.
|
||||||
const [currentStep, setCurrentStep] = useState(0);
|
const [currentStep, setCurrentStep] = useState(0);
|
||||||
const showStep = (step: number) => !showTypeSelector || currentStep === step;
|
const showStep = (step: number) => !isWizard || currentStep === step;
|
||||||
|
|
||||||
const watchedType = watch("type") as MonitorType;
|
const watchedType = watch("type") as MonitorType;
|
||||||
const watchedUseAdvancedMatching = watch("useAdvancedMatching") as boolean;
|
const watchedUseAdvancedMatching = watch("useAdvancedMatching") as boolean;
|
||||||
@@ -362,7 +365,7 @@ const CreateMonitorPage = () => {
|
|||||||
refetch={refetchMonitor}
|
refetch={refetchMonitor}
|
||||||
onDelete={handleDeleteClick}
|
onDelete={handleDeleteClick}
|
||||||
/>
|
/>
|
||||||
{showTypeSelector && (
|
{isWizard && (
|
||||||
<StepProgress
|
<StepProgress
|
||||||
steps={totalSteps}
|
steps={totalSteps}
|
||||||
current={currentStep}
|
current={currentStep}
|
||||||
@@ -1335,9 +1338,9 @@ const CreateMonitorPage = () => {
|
|||||||
|
|
||||||
<Stack
|
<Stack
|
||||||
direction="row"
|
direction="row"
|
||||||
justifyContent={showTypeSelector ? "space-between" : "flex-end"}
|
justifyContent={isWizard ? "space-between" : "flex-end"}
|
||||||
>
|
>
|
||||||
{showTypeSelector && (
|
{isWizard && (
|
||||||
<Button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
@@ -1348,7 +1351,7 @@ const CreateMonitorPage = () => {
|
|||||||
{t("common.buttons.back")}
|
{t("common.buttons.back")}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{showTypeSelector && currentStep < totalSteps - 1 ? (
|
{isWizard && currentStep < totalSteps - 1 ? (
|
||||||
<Button
|
<Button
|
||||||
key="wizard-next"
|
key="wizard-next"
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
Reference in new issue
Block a user