-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
135 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Bip44Path } from "@namada/types"; | ||
import React, { useState } from "react"; | ||
import { AdvancedOptionsMenu } from "./AdvancedOptionsMenu"; | ||
import Bip39PassphraseForm from "./Bip39PassphraseForm"; | ||
import Bip44Form from "./Bip44Form"; | ||
|
||
type Props = { | ||
path: Bip44Path; | ||
passphrase: string; | ||
setPath: (path: Bip44Path) => void; | ||
setPassphrase: (passphrase: string) => void; | ||
}; | ||
|
||
export enum Option { | ||
Menu = "menu", | ||
Passphrase = "passphrase", | ||
Path = "path", | ||
} | ||
|
||
export const AdvancedOptions: React.FC<Props> = ({ | ||
path, | ||
passphrase, | ||
setPath, | ||
setPassphrase, | ||
}) => { | ||
const [view, setView] = useState<Option>(Option.Menu); | ||
|
||
return ( | ||
<div className="bg-black"> | ||
{view === Option.Menu && ( | ||
<AdvancedOptionsMenu | ||
onPathClick={() => setView(Option.Path)} | ||
onPassphraseClick={() => setView(Option.Passphrase)} | ||
/> | ||
)} | ||
{view === Option.Path && <Bip44Form path={path} setPath={setPath} />} | ||
{view === Option.Passphrase && ( | ||
<Bip39PassphraseForm | ||
passphrase={passphrase} | ||
setPassphrase={setPassphrase} | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; |
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,18 @@ | ||
import { Stack } from "@namada/components"; | ||
import React from "react"; | ||
|
||
type Props = { | ||
onPathClick: () => void; | ||
onPassphraseClick: () => void; | ||
}; | ||
export const AdvancedOptionsMenu: React.FC<Props> = ({ | ||
onPathClick, | ||
onPassphraseClick, | ||
}) => { | ||
return ( | ||
<Stack as="ul" gap={2} direction="vertical" className="[&_li]:text-white"> | ||
<li onClick={onPathClick}>Set Custom Derivation Path</li> | ||
<li onClick={onPassphraseClick}>Import with BIP39 Passphrase</li> | ||
</Stack> | ||
); | ||
}; |
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,42 @@ | ||
import React from "react"; | ||
|
||
import { Alert, Input, Stack } from "@namada/components"; | ||
|
||
type Props = { | ||
passphrase: string; | ||
setPassphrase: (passphrase: string) => void; | ||
}; | ||
|
||
const Bip39PassphraseForm: React.FC<Props> = ({ | ||
passphrase, | ||
setPassphrase, | ||
}) => { | ||
return ( | ||
<div className="flex flex-col w-full px-3"> | ||
<div className="mb-2 [&_input]:w-[92%]"> | ||
<div className="my-3"> | ||
<Alert type={"warning"} title={"Please note"} className="mb-3"> | ||
<Stack gap={6}> | ||
<p className="text-[13px] leading-[1.25] text-white"> | ||
This import option is only users who have created a Namada | ||
account using the Namada protocol CLI v.0.17.0 or older, and | ||
used a BIP39 passphrase. Do not input your Namada extension | ||
password | ||
</p> | ||
<Input | ||
data-testid="setup-import-keys-passphrase-input" | ||
label="Enter your passphrase" | ||
placeholder="Optional passphrase for your seed phrase." | ||
hideIcon={true} | ||
onChange={(e) => setPassphrase(e.target.value)} | ||
value={passphrase} | ||
/> | ||
</Stack> | ||
</Alert> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Bip39PassphraseForm; |
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