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]);
|
||||
|
||||
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 =
|
||||
pageType === "pagespeed"
|
||||
? "pagespeed"
|
||||
@@ -267,7 +270,7 @@ const CreateMonitorPage = () => {
|
||||
// Multi-step wizard, uptime create only (showTypeSelector). Other flows
|
||||
// keep the flat form, where showStep() is always true.
|
||||
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 watchedUseAdvancedMatching = watch("useAdvancedMatching") as boolean;
|
||||
@@ -362,7 +365,7 @@ const CreateMonitorPage = () => {
|
||||
refetch={refetchMonitor}
|
||||
onDelete={handleDeleteClick}
|
||||
/>
|
||||
{showTypeSelector && (
|
||||
{isWizard && (
|
||||
<StepProgress
|
||||
steps={totalSteps}
|
||||
current={currentStep}
|
||||
@@ -1335,9 +1338,9 @@ const CreateMonitorPage = () => {
|
||||
|
||||
<Stack
|
||||
direction="row"
|
||||
justifyContent={showTypeSelector ? "space-between" : "flex-end"}
|
||||
justifyContent={isWizard ? "space-between" : "flex-end"}
|
||||
>
|
||||
{showTypeSelector && (
|
||||
{isWizard && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outlined"
|
||||
@@ -1348,7 +1351,7 @@ const CreateMonitorPage = () => {
|
||||
{t("common.buttons.back")}
|
||||
</Button>
|
||||
)}
|
||||
{showTypeSelector && currentStep < totalSteps - 1 ? (
|
||||
{isWizard && currentStep < totalSteps - 1 ? (
|
||||
<Button
|
||||
key="wizard-next"
|
||||
type="button"
|
||||
|
||||
Reference in new issue
Block a user