Skip to content

Commit

Permalink
Account backup UI fixes (#3270)
Browse files Browse the repository at this point in the history
### What
Implemented UI changes requested in:
#3266

### Testing
- test if changes requested in linked PR were applied correctly

Latest build:
[extension-builds-3270](https://github.com/tahowallet/extension/suites/12183072896/artifacts/643338009)
(as of Wed, 12 Apr 2023 12:00:49 GMT).
  • Loading branch information
kkosiorowska authored Apr 13, 2023
2 parents c363fc0 + 96fb837 commit 06ce3ac
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 55 deletions.
10 changes: 9 additions & 1 deletion ui/components/AccountsBackup/RevealMnemonic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { exportMnemonic } from "@tallyho/tally-background/redux-slices/keyrings"
import { setSnackbarMessage } from "@tallyho/tally-background/redux-slices/ui"
import React, { ReactElement, useEffect, useState } from "react"
import { useTranslation } from "react-i18next"
import classNames from "classnames"
import { useBackgroundDispatch } from "../../hooks"
import SharedButton from "../Shared/SharedButton"
import SharedSecretText from "../Shared/SharedSecretText"
Expand Down Expand Up @@ -63,7 +64,11 @@ export default function RevealMnemonic({

return (
<>
<div className="mnemonic_container">
<div
className={classNames("mnemonic_container", {
small: splitIndex === 6,
})}
>
<SharedSecretText
text={
<MnemonicList
Expand Down Expand Up @@ -96,6 +101,9 @@ export default function RevealMnemonic({
display: flex;
height: 370px;
}
.mnemonic_container.small {
height: 240px;
}
`}</style>
</>
)
Expand Down
7 changes: 4 additions & 3 deletions ui/components/AccountsBackup/ShowMnemonic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,10 @@ export default function ShowMnemonic({
flex-direction: column;
align-items: center;
justify-content: space-between;
height: 91%;
height: calc(100% - 19px);
box-sizing: border-box;
gap: 16px;
padding: 0 24px 24px;
padding: 0 24px 16px;
overflow: scroll;
}
.content {
Expand Down Expand Up @@ -167,7 +168,7 @@ export default function ShowMnemonic({
color: var(--green-40);
}
.account_list {
margin: 16px -16px 0;
margin: 16px -4px 0;
display: flex;
flex-direction: column;
gap: 16px;
Expand Down
5 changes: 3 additions & 2 deletions ui/components/AccountsBackup/ShowPrivateKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ export default function ShowPrivateKey({
flex-direction: column;
align-items: center;
justify-content: space-between;
height: 91%;
padding: 0 24px 24px;
height: calc(100% - 35px);
box-sizing: border-box;
padding: 0 24px 10px;
}
.content {
box-sizing: border-box;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,47 +194,48 @@ function WalletTypeHeader({
</div>
{sectionTitle}
</h2>
{accountType !== AccountType.ReadOnly && (
<SharedDropdown
toggler={(toggle) => (
<SharedIcon
color="var(--green-40)"
customStyles="cursor: pointer;"
width={24}
onClick={() => toggle()}
icon="settings.svg"
/>
)}
options={[
{
key: "edit",
icon: "icons/s/edit.svg",
label: t("accounts.accountItem.editName"),
onClick: () => setShowEditMenu(true),
},
onClickAddAddress && {
key: "addAddress",
onClick: () => {
if (areKeyringsUnlocked) {
onClickAddAddress()
} else {
history.push("/keyring/unlock")
}
{accountType !== AccountType.ReadOnly &&
accountType !== AccountType.PrivateKey && (
<SharedDropdown
toggler={(toggle) => (
<SharedIcon
color="var(--green-40)"
customStyles="cursor: pointer;"
width={24}
onClick={() => toggle()}
icon="settings.svg"
/>
)}
options={[
{
key: "edit",
icon: "icons/s/edit.svg",
label: t("accounts.accountItem.editName"),
onClick: () => setShowEditMenu(true),
},
icon: "icons/s/add.svg",
label: t("accounts.notificationPanel.addAddress"),
},
hasMnemonic && isEnabled(FeatureFlags.SUPPORT_PRIV_KEYS)
? {
key: "showMnemonic",
onClick: () => setShowExportMnemonicMenu(true),
icon: "icons/s/lock-bold.svg",
label: t("accounts.accountItem.showMnemonic.header"),
}
: undefined,
]}
/>
)}
onClickAddAddress && {
key: "addAddress",
onClick: () => {
if (areKeyringsUnlocked) {
onClickAddAddress()
} else {
history.push("/keyring/unlock")
}
},
icon: "icons/s/add.svg",
label: t("accounts.notificationPanel.addAddress"),
},
hasMnemonic && isEnabled(FeatureFlags.SUPPORT_PRIV_KEYS)
? {
key: "showMnemonic",
onClick: () => setShowExportMnemonicMenu(true),
icon: "icons/s/lock-bold.svg",
label: t("accounts.accountItem.showMnemonic.header"),
}
: undefined,
]}
/>
)}
</header>
<SharedSlideUpMenu
size="custom"
Expand Down
2 changes: 1 addition & 1 deletion ui/components/Send/NFTCollectionAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default function NFTCollectionAccordion({
}
.nft_list {
padding: 10px 0 12px;
padding: 10px 8px 12px;
display: flex;
flex-direction: column;
gap: 8px;
Expand Down
1 change: 0 additions & 1 deletion ui/components/Shared/SharedAccordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ export default function SharedAccordion({
transition: max-height ${DELAY}ms ease-out,
opacity var(--content-fade-in-duration, 130ms) ease-in;
opacity: 0;
padding: 0 8px;
}
.accordion_content.visible {
max-height: ${height + 10}px;
Expand Down
8 changes: 4 additions & 4 deletions ui/components/Shared/SharedButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,16 @@ export default function SharedButton(
background-color: #ffffff;
}
.gray {
color: var(--green-60);
color: var(--green-20);
}
.gray .icon_button {
background-color: var(--green-60);
background-color: var(--green-20);
}
.gray:hover {
color: var(--green-40);
color: var(--green-20);
}
.gray:hover .icon_button {
background-color: var(--green-40);
background-color: var(--green-20);
}
.error {
color: var(--error);
Expand Down
2 changes: 1 addition & 1 deletion ui/components/TopMenu/TopMenuConnectedDAppInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function ConnectionDAppGuideline({
justify-content: space-between;
}
.panel_wrap {
padding: ${showWalletConnectInfo ? "16px 8px" : "0 8px 16px"};
padding: ${showWalletConnectInfo ? "16px" : "0 16px 16px"};
}
.wallet_connect_info p {
margin: 0;
Expand Down
7 changes: 6 additions & 1 deletion ui/pages/Onboarding/Tabbed/ImportPrivateKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ export default function ImportPrivateKey(props: Props): ReactElement {
keyPrefix: "onboarding.tabbed.addWallet.importPrivateKey",
})

const onInputChange = useCallback((pk: string) => {
setPrivateKey(pk)
setErrorMessage("")
}, [])

const importWallet = useCallback(async () => {
const trimmedPrivateKey = privateKey.toLowerCase().trim()
if (validatePrivateKey(trimmedPrivateKey)) {
Expand All @@ -60,7 +65,7 @@ export default function ImportPrivateKey(props: Props): ReactElement {
return (
<>
<SharedSeedInput
onChange={(pk) => setPrivateKey(pk)}
onChange={onInputChange}
label={t("inputLabel")}
errorMessage={errorMessage}
/>
Expand Down
7 changes: 6 additions & 1 deletion ui/pages/Onboarding/Tabbed/ImportSeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export default function ImportSeed(props: Props): ReactElement {

const history = useHistory()

const onInputChange = useCallback((seed: string) => {
setRecoveryPhrase(seed)
setErrorMessage("")
}, [])

useEffect(() => {
if (areKeyringsUnlocked && keyringImport === "done" && isImporting) {
setIsImporting(false)
Expand Down Expand Up @@ -109,7 +114,7 @@ export default function ImportSeed(props: Props): ReactElement {
</div>
)}
<SharedSeedInput
onChange={(seed) => setRecoveryPhrase(seed)}
onChange={onInputChange}
label={t("inputLabel")}
errorMessage={errorMessage}
/>
Expand Down

0 comments on commit 06ce3ac

Please sign in to comment.