-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallet): Enhanced Transaction Submission Status Panels
- Loading branch information
1 parent
4b0f291
commit 896d742
Showing
32 changed files
with
1,309 additions
and
584 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
4 changes: 0 additions & 4 deletions
4
components/brave_wallet_ui/assets/svg-icons/error-circle-icon.svg
This file was deleted.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
.../components/extension/post-confirmation/cancel_transaction/cancel_transaction.stories.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,42 @@ | ||
// Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
import * as React from 'react' | ||
|
||
// Mocks | ||
import { | ||
mockTransactionInfo // | ||
} from '../../../../stories/mock-data/mock-transaction-info' | ||
|
||
// Components | ||
import { | ||
WalletPanelStory // | ||
} from '../../../../stories/wrappers/wallet-panel-story-wrapper' | ||
import { CancelTransaction } from './cancel_transaction' | ||
|
||
// Styled Components | ||
import { LongWrapper } from '../../../../stories/style' | ||
import { PanelWrapper } from '../../../../panel/style' | ||
|
||
export const _CancelTransaction = { | ||
render: () => { | ||
return ( | ||
<WalletPanelStory> | ||
<PanelWrapper | ||
width={390} | ||
height={650} | ||
> | ||
<LongWrapper padding='0px'> | ||
<CancelTransaction | ||
onBack={() => alert('Back clicked')} | ||
transaction={mockTransactionInfo} | ||
/> | ||
</LongWrapper> | ||
</PanelWrapper> | ||
</WalletPanelStory> | ||
) | ||
} | ||
} | ||
|
||
export default { component: CancelTransaction } |
11 changes: 11 additions & 0 deletions
11
..._ui/components/extension/post-confirmation/cancel_transaction/cancel_transaction.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,11 @@ | ||
// Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
import styled from 'styled-components' | ||
import Button from '@brave/leo/react/button' | ||
import * as leo from '@brave/leo/tokens/css/variables' | ||
|
||
export const CancelButton = styled(Button)` | ||
--leo-button-color: ${leo.color.button.errorBackground}; | ||
` |
79 changes: 79 additions & 0 deletions
79
...allet_ui/components/extension/post-confirmation/cancel_transaction/cancel_transaction.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,79 @@ | ||
// Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
import * as React from 'react' | ||
|
||
// Types | ||
import { SerializableTransactionInfo } from '../../../../constants/types' | ||
|
||
// Utils | ||
import { getLocale } from '$web-common/locale' | ||
import { getCoinFromTxDataUnion } from '../../../../utils/network-utils' | ||
|
||
// Hooks | ||
import { | ||
useCancelTransactionMutation // | ||
} from '../../../../common/slices/api.slice' | ||
|
||
// Components | ||
import { PostConfirmationHeader } from '../common/post_confirmation_header' | ||
|
||
// Styled components | ||
import { CancelButton } from './cancel_transaction.style' | ||
import { Wrapper, Title } from '../common/common.style' | ||
import { Column, Row, Text } from '../../../shared/style' | ||
|
||
interface Props { | ||
transaction: SerializableTransactionInfo | ||
onBack: () => void | ||
} | ||
|
||
export const CancelTransaction = (props: Props) => { | ||
const { transaction, onBack } = props | ||
|
||
// Computed | ||
const txCoinType = getCoinFromTxDataUnion(transaction.txDataUnion) | ||
|
||
// Hooks | ||
const [cancelTx] = useCancelTransactionMutation() | ||
|
||
// Methods | ||
const onClickCancelTransaction = () => { | ||
cancelTx({ | ||
coinType: txCoinType, | ||
chainId: transaction.chainId, | ||
transactionId: transaction.id | ||
}) | ||
} | ||
|
||
return ( | ||
<Wrapper | ||
fullWidth={true} | ||
fullHeight={true} | ||
alignItems='center' | ||
justifyContent='space-between' | ||
> | ||
<PostConfirmationHeader onBack={onBack} /> | ||
<Column | ||
fullWidth={true} | ||
padding='0px 24px' | ||
gap='8px' | ||
> | ||
<Title>{getLocale('braveWalletTransactionCancel')}</Title> | ||
<Text | ||
textSize='14px' | ||
textColor='primary' | ||
isBold={false} | ||
> | ||
{getLocale('braveWalletCancelTransactionDescription')} | ||
</Text> | ||
</Column> | ||
<Row padding='16px'> | ||
<CancelButton onClick={onClickCancelTransaction}> | ||
{getLocale('braveWalletTransactionCancel')} | ||
</CancelButton> | ||
</Row> | ||
</Wrapper> | ||
) | ||
} |
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
56 changes: 56 additions & 0 deletions
56
...rave_wallet_ui/components/extension/post-confirmation/common/post_confirmation_header.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,56 @@ | ||
// Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
import * as React from 'react' | ||
import Icon from '@brave/leo/react/icon' | ||
import LeoButton from '@brave/leo/react/button' | ||
|
||
// Utils | ||
import { getLocale } from '$web-common/locale' | ||
|
||
// Styled Components | ||
import { HeaderButton, HeaderIcon } from './common.style' | ||
import { Row } from '../../../shared/style' | ||
|
||
interface Props { | ||
onClose?: () => void | ||
onBack?: () => void | ||
showHelp?: boolean | ||
} | ||
|
||
export const PostConfirmationHeader = (props: Props) => { | ||
const { onClose, onBack, showHelp } = props | ||
|
||
return ( | ||
<Row | ||
padding='16px' | ||
justifyContent={onBack || showHelp ? 'space-between' : 'flex-end'} | ||
> | ||
{showHelp && ( | ||
<div> | ||
<LeoButton | ||
kind='outline' | ||
size='tiny' | ||
> | ||
<Icon | ||
slot='icon-before' | ||
name='help-outline' | ||
/> | ||
{getLocale('braveWalletGetHelp')} | ||
</LeoButton> | ||
</div> | ||
)} | ||
{onBack && ( | ||
<HeaderButton onClick={onBack}> | ||
<HeaderIcon name='arrow-left' /> | ||
</HeaderButton> | ||
)} | ||
{onClose && ( | ||
<HeaderButton onClick={onClose}> | ||
<HeaderIcon name='close' /> | ||
</HeaderButton> | ||
)} | ||
</Row> | ||
) | ||
} |
Oops, something went wrong.