-
Notifications
You must be signed in to change notification settings - Fork 910
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallet): Backed Up Transactions Warning
- Loading branch information
1 parent
d03c7da
commit a2f49f2
Showing
11 changed files
with
301 additions
and
22 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
93 changes: 93 additions & 0 deletions
93
components/brave_wallet_ui/components/extension/transactions-backed-up-warning/index.tsx
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,93 @@ | ||
import * as React from 'react' | ||
|
||
// Components | ||
import { NavButton } from '../' | ||
import { Checkbox } from 'brave-ui' | ||
import { getLocale } from '../../../../common/locale' | ||
|
||
// Styled Components | ||
import { | ||
StyledWrapper, | ||
Title, | ||
Description, | ||
LearnMoreButton, | ||
CheckboxRow, | ||
ClearButton, | ||
ClearButtonText, | ||
LoadIcon, | ||
CheckboxText | ||
} from './style' | ||
|
||
export interface Props { | ||
onContinue: (clearTransactions: boolean) => void | ||
} | ||
|
||
function TransactionsBackedUpWarning (props: Props) { | ||
const { onContinue } = props | ||
const [clearTransactions, setClearTransactions] = React.useState<boolean>(false) | ||
const [isClearing, setIsClearing] = React.useState<boolean>(false) | ||
|
||
const onCheckClearTransactions = (key: string, selected: boolean) => { | ||
if (key === 'clearTransactions') { | ||
setClearTransactions(selected) | ||
} | ||
} | ||
|
||
const onClickContinue = () => { | ||
if (clearTransactions) { | ||
setIsClearing(true) | ||
} | ||
onContinue(clearTransactions) | ||
} | ||
|
||
const onClickLearnMore = () => { | ||
chrome.tabs.create({ url: 'https://support.brave.com/hc/en-us/articles/4537540021389' }, () => { | ||
if (chrome.runtime.lastError) { | ||
console.error('tabs.create failed: ' + chrome.runtime.lastError.message) | ||
} | ||
}) | ||
} | ||
|
||
return ( | ||
<StyledWrapper> | ||
<Title>{getLocale('braveWalletBackedUpTransactionsTitle')}</Title> | ||
<Description>{getLocale('braveWalletBackedUpTransactionsDescription')}</Description> | ||
<LearnMoreButton onClick={onClickLearnMore}>{getLocale('braveWalletWelcomePanelButton')}</LearnMoreButton> | ||
<CheckboxRow> | ||
<Checkbox | ||
children={<CheckboxText data-key='clearTransactions'>{getLocale('braveWalletBackedUpTransactionsCheckbox')}</CheckboxText>} | ||
size='small' | ||
value={{ clearTransactions: clearTransactions }} | ||
onChange={onCheckClearTransactions} | ||
/> | ||
</CheckboxRow> | ||
{ | ||
isClearing ? ( | ||
<ClearButton> | ||
<ClearButtonText> | ||
{getLocale('braveWalletBackedUpTransactionsClearingButton')} | ||
</ClearButtonText> | ||
<LoadIcon /> | ||
</ClearButton> | ||
) : ( | ||
<NavButton | ||
disabled={isClearing} | ||
buttonType={ | ||
clearTransactions | ||
? 'danger' | ||
: 'primary' | ||
} | ||
text={ | ||
clearTransactions | ||
? getLocale('braveWalletBackedUpTransactionsClearButton') | ||
: getLocale('braveWalletButtonContinue') | ||
} | ||
onSubmit={onClickContinue} | ||
/> | ||
) | ||
} | ||
</StyledWrapper > | ||
) | ||
} | ||
|
||
export default TransactionsBackedUpWarning |
89 changes: 89 additions & 0 deletions
89
components/brave_wallet_ui/components/extension/transactions-backed-up-warning/style.ts
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,89 @@ | ||
import styled from 'styled-components' | ||
import { LoaderIcon } from 'brave-ui/components/icons' | ||
import { WalletButton } from '../../shared/style' | ||
|
||
export const StyledWrapper = styled.div` | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
` | ||
|
||
export const Title = styled.span` | ||
font-family: Poppins; | ||
font-size: 15px; | ||
line-height: 20px; | ||
letter-spacing: 0.01em; | ||
font-weight: 600; | ||
color: ${(p) => p.theme.color.text01}; | ||
margin-bottom: 10px; | ||
` | ||
|
||
export const Description = styled.span` | ||
font-family: Poppins; | ||
font-size: 14px; | ||
line-height: 18px; | ||
letter-spacing: 0.01em; | ||
color: ${(p) => p.theme.color.text02}; | ||
width: 80%; | ||
text-align: center; | ||
margin-bottom: 6px; | ||
` | ||
|
||
export const LearnMoreButton = styled(WalletButton)` | ||
cursor: pointer; | ||
outline: none; | ||
background: none; | ||
border: none; | ||
font-family: Poppins; | ||
font-size: 14px; | ||
line-height: 18px; | ||
letter-spacing: 0.01em; | ||
color: ${(p) => p.theme.color.interactive05}; | ||
margin: 0px; | ||
padding: 0px; | ||
` | ||
|
||
export const CheckboxRow = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
flex-direction: row; | ||
margin: 20px 0px; | ||
width: 70%; | ||
` | ||
|
||
export const CheckboxText = styled.span` | ||
font-size: 8px; | ||
line-height: 20px; | ||
color: ${(p) => p.theme.color.text02}; | ||
` | ||
|
||
export const ClearButton = styled(WalletButton)` | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 7px 22px; | ||
border: none; | ||
box-sizing: border-box; | ||
border-radius: 40px; | ||
background-color: ${(p) => p.theme.color.errorBorder}; | ||
opacity: .4; | ||
` | ||
|
||
export const ClearButtonText = styled.span` | ||
font-weight: 600; | ||
font-size: 13px; | ||
line-height: 20px; | ||
color: ${(p) => p.theme.palette.white}; | ||
margin-right: 4px; | ||
` | ||
|
||
export const LoadIcon = styled(LoaderIcon)` | ||
color: ${p => p.theme.palette.white}; | ||
height: 25px; | ||
width: 25px; | ||
` |
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
Oops, something went wrong.