Skip to content

Commit

Permalink
Merge pull request #1064 from alleslabs/fix/cancel-custom-minitia-btn
Browse files Browse the repository at this point in the history
Fix(utils): update handleprevious in usenetwork stepper
  • Loading branch information
Poafs1 authored Aug 5, 2024
2 parents 96a8a10 + c65cf79 commit 536e373
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Bug fixes

- [#1064](https://github.com/alleslabs/celatone-frontend/pull/1064) Fix cancel button in add custom minitia page
- [#1068](https://github.com/alleslabs/celatone-frontend/pull/1068) Add fetching bech32 prefix from lcd and disable close success modal on overlay click
- [#1067](https://github.com/alleslabs/celatone-frontend/pull/1067) Add gas fee details to support more decimal digits and add default value
- [#1066](https://github.com/alleslabs/celatone-frontend/pull/1066) Remove add custom minitia supported feature step and add vm type in network detail
Expand Down
12 changes: 10 additions & 2 deletions src/lib/pages/custom-network/manual/hooks/useNetworkStepper.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useRouter } from "next/router";
import { useEffect } from "react";

import { useCelatoneApp } from "lib/app-provider";
import { useCelatoneApp, useInternalNavigate } from "lib/app-provider";

export const useNetworkStepper = (limit: number, handleSubmit: () => void) => {
const router = useRouter();
const navigate = useInternalNavigate();
const currentStep = router.query.step;
const { currentChainId } = useCelatoneApp();

Expand Down Expand Up @@ -38,7 +39,14 @@ export const useNetworkStepper = (limit: number, handleSubmit: () => void) => {
)
: handleSubmit();

const handlePrevious = () => router.back();
const handlePrevious = () => {
if (Number(currentStep) === 1) {
navigate({ pathname: "/custom-network/add" });
return;
}

router.back();
};

return {
currentStepIndex: Number(currentStep) - 1,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/pages/custom-network/manual/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ export const AddNetworkManual = () => {
cancelButton={{
onClick: handlePrevious,
variant: "outline-secondary",
leftIcon: hasPrevious ? (
<CustomIcon name="chevron-left" boxSize={4} />
) : undefined,
}}
cancelLabel={hasPrevious ? "Previous" : "Cancel"}
actionButton={{
Expand Down

0 comments on commit 536e373

Please sign in to comment.