-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1038 from alleslabs/feature/cfe-580-custom-networ…
…ks-options [CFE-580] Feature: custom networks options
- Loading branch information
Showing
13 changed files
with
145 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { Flex } from "@chakra-ui/react"; | ||
import { useState } from "react"; | ||
|
||
import ActionPageContainer from "lib/components/ActionPageContainer"; | ||
import { CustomNetworkFooterCta } from "lib/components/custom-network"; | ||
import { CustomIcon } from "lib/components/icon"; | ||
import { CelatoneSeo } from "lib/components/Seo"; | ||
|
||
import { AddNetworkStepper } from "./components/AddNetworkStepper"; | ||
import GasFeeDetails from "./components/GasFeeDetails"; | ||
import NetworkDetails from "./components/NetworkDetails"; | ||
import SupportedFeatures from "./components/SupportedFeatures"; | ||
import WalletRegistry from "./components/WalletRegistry"; | ||
|
||
export const AddNetworkManual = () => { | ||
const [currentStep, setCurrentStep] = useState(0); | ||
|
||
const steps = [ | ||
<NetworkDetails key="network-details" />, | ||
<SupportedFeatures key="supported-features" />, | ||
<GasFeeDetails key="gas-fee-details" />, | ||
<WalletRegistry key="wallet-registry" />, | ||
]; | ||
|
||
const nextStep = () => { | ||
if (currentStep < steps.length - 1) { | ||
setCurrentStep(currentStep + 1); | ||
} | ||
}; | ||
|
||
const prevStep = () => { | ||
if (currentStep > 0) { | ||
setCurrentStep(currentStep - 1); | ||
} | ||
}; | ||
|
||
const leftButtonProps = { | ||
label: "Previous", | ||
action: prevStep, | ||
variant: "outline-secondary", | ||
isDisabled: currentStep === 0, | ||
}; | ||
|
||
const rightButtonProps = { | ||
label: "Next", | ||
action: nextStep, | ||
variant: "primary", | ||
isDisabled: currentStep === steps.length - 1, | ||
rightIcon: <CustomIcon name="chevron-right" />, | ||
}; | ||
|
||
return ( | ||
<> | ||
<CelatoneSeo pageName="Add Minitias" /> | ||
<Flex direction="column" position="relative" w="full"> | ||
<Flex position="sticky" top={0} left={0} w="full" zIndex={2}> | ||
<AddNetworkStepper currentStep={currentStep} /> | ||
</Flex> | ||
<ActionPageContainer width={640}> | ||
{steps[currentStep]} | ||
</ActionPageContainer> | ||
<CustomNetworkFooterCta | ||
leftButtonProps={leftButtonProps} | ||
rightButtonProps={rightButtonProps} | ||
/> | ||
</Flex> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,44 @@ | ||
import { Flex } from "@chakra-ui/react"; | ||
import { useState } from "react"; | ||
import { Alert, AlertDescription, Flex, Heading, Text } from "@chakra-ui/react"; | ||
|
||
import { useInternalNavigate } from "lib/app-provider"; | ||
import ActionPageContainer from "lib/components/ActionPageContainer"; | ||
import { CustomNetworkFooterCta } from "lib/components/custom-network"; | ||
import { CustomIcon } from "lib/components/icon"; | ||
import { ButtonCard } from "lib/components/ButtonCard"; | ||
import { CelatoneSeo } from "lib/components/Seo"; | ||
|
||
import { AddNetworkStepper } from "./components/AddNetworkStepper"; | ||
import GasFeeDetails from "./components/GasFeeDetails"; | ||
import NetworkDetails from "./components/NetworkDetails"; | ||
import SupportedFeatures from "./components/SupportedFeatures"; | ||
import WalletRegistry from "./components/WalletRegistry"; | ||
|
||
export const AddNetwork = () => { | ||
const [currentStep, setCurrentStep] = useState(0); | ||
|
||
const steps = [ | ||
<NetworkDetails key="network-details" />, | ||
<SupportedFeatures key="supported-features" />, | ||
<GasFeeDetails key="gas-fee-details" />, | ||
<WalletRegistry key="wallet-registry" />, | ||
]; | ||
|
||
const nextStep = () => { | ||
if (currentStep < steps.length - 1) { | ||
setCurrentStep(currentStep + 1); | ||
} | ||
}; | ||
|
||
const prevStep = () => { | ||
if (currentStep > 0) { | ||
setCurrentStep(currentStep - 1); | ||
} | ||
}; | ||
|
||
const leftButtonProps = { | ||
label: "Previous", | ||
action: prevStep, | ||
variant: "outline-secondary", | ||
isDisabled: currentStep === 0, | ||
}; | ||
|
||
const rightButtonProps = { | ||
label: "Next", | ||
action: nextStep, | ||
variant: "primary", | ||
isDisabled: currentStep === steps.length - 1, | ||
rightIcon: <CustomIcon name="chevron-right" />, | ||
}; | ||
const navigate = useInternalNavigate(); | ||
|
||
return ( | ||
<> | ||
<ActionPageContainer> | ||
<CelatoneSeo pageName="Add Minitias" /> | ||
<Flex direction="column" position="relative" w="full"> | ||
<Flex position="sticky" top={0} left={0} w="full" zIndex={2}> | ||
<AddNetworkStepper currentStep={currentStep} /> | ||
<Flex direction="column" gap={12}> | ||
<Flex direction="column" gap={4} textAlign="center"> | ||
<Heading as="h4" variant="h4"> | ||
Add Custom Minitia | ||
</Heading> | ||
<Alert my={4} p={3} variant="info"> | ||
<AlertDescription> | ||
<Text color="text.dark" textAlign="center" lineHeight="normal"> | ||
Please note that the custom Minitia you add on our website will | ||
only be stored locally on your device. | ||
</Text> | ||
</AlertDescription> | ||
</Alert> | ||
</Flex> | ||
<Flex direction="column" gap={4}> | ||
<ButtonCard | ||
title="Fill in Network Details Manually" | ||
description="Add new Minitia through fill in each configuration manually" | ||
onClick={() => navigate({ pathname: "/add-network/manual" })} | ||
/> | ||
{/* // TODO: Open this code to enable import JSON option entry point */} | ||
{/* <ButtonCard | ||
title="Import JSON" | ||
description="Import available JSON that contains all the configuration" | ||
onClick={() => navigate({ pathname: "/add-network/json" })} | ||
/> */} | ||
</Flex> | ||
<ActionPageContainer width={640}> | ||
{steps[currentStep]} | ||
</ActionPageContainer> | ||
<CustomNetworkFooterCta | ||
leftButtonProps={leftButtonProps} | ||
rightButtonProps={rightButtonProps} | ||
/> | ||
</Flex> | ||
</> | ||
</ActionPageContainer> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { AddNetworkManual } from "lib/pages/add-network-manual"; | ||
|
||
export default AddNetworkManual; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { AddNetworkManual } from "lib/pages/add-network-manual"; | ||
|
||
export default AddNetworkManual; |