Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

773 UI Show Considered UTXOs before performing transaction #788

Closed
Closed
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ad3a363
Implemented UTXO Selection Modal
amitx13 Jun 2, 2024
e4e62da
Done with the suggested changes in ShowUtxos
amitx13 Jun 3, 2024
4908185
minor bug fixing
amitx13 Jun 3, 2024
fa05a01
Fixed Undefined tag issue , Refactor Jar Selection logic & some minor…
amitx13 Jun 8, 2024
e002690
Updated deposit tag , Refactor ShowUtxos & added few comments
amitx13 Jun 9, 2024
827fff2
Fixed recommended changes
amitx13 Jun 13, 2024
6bebf84
Made UTXO list scrollable after 5 entries for better usability
amitx13 Jun 26, 2024
e8623d1
Fixed ShowUtxos and reused it in PaymentConfirmModal for UTXOs review
amitx13 Jun 27, 2024
ba7bb0b
Implemented suggested changes and made it reusable
amitx13 Jun 27, 2024
65d573d
bug fixing
amitx13 Jun 27, 2024
1eebac7
Implemented Show Selected UTXOs before performing transaction
amitx13 Jun 27, 2024
dc4bcf4
empty utxos bug fixed
amitx13 Jun 27, 2024
3a0f378
Implemented UTXO Selection Modal
amitx13 Jun 2, 2024
27fca6d
Done with the suggested changes in ShowUtxos
amitx13 Jun 3, 2024
276e9a8
minor bug fixing
amitx13 Jun 3, 2024
80c32f9
Fixed Undefined tag issue , Refactor Jar Selection logic & some minor…
amitx13 Jun 8, 2024
b4df045
Updated deposit tag , Refactor ShowUtxos & added few comments
amitx13 Jun 9, 2024
40edf9e
Fixed recommended changes
amitx13 Jun 13, 2024
3d17216
Made UTXO list scrollable after 5 entries for better usability
amitx13 Jun 26, 2024
d024caa
Fixed ShowUtxos and reused it in PaymentConfirmModal for UTXOs review
amitx13 Jun 27, 2024
abe5adf
Implemented suggested changes and made it reusable
amitx13 Jun 27, 2024
1228c99
bug fixing
amitx13 Jun 27, 2024
3ae26ea
empty utxos bug fixed
amitx13 Jun 27, 2024
67fd5bf
Implemented suggested changes
amitx13 Jul 5, 2024
38f5d58
Added default sorting i.e by Date(Confirmations)
amitx13 Jul 5, 2024
afa470d
Added tooltip for confirmation
amitx13 Jul 5, 2024
366004e
Update src/components/App.tsx
amitx13 Jul 8, 2024
d18e3ed
Improved loading logic, Improved Modal.tsx, Reviewed and enhanced tex…
amitx13 Jul 14, 2024
9996488
Prevent unnecessary /display requests each time the modal is opened
amitx13 Jul 16, 2024
0c1f36a
Merge branch '765-ui-implement-utxo-selection-modal' into 773-ui-show…
amitx13 Jul 16, 2024
f5f228a
UTXOs are only visible in case of sweep
amitx13 Jul 16, 2024
d06ba06
feat(config): ability to customize "max sweep fee change" setting (#793)
theborakompanioni Jul 16, 2024
a2c5211
dev(regtest): update bitcoin core from v26 to v27 (#795)
theborakompanioni Jul 19, 2024
8b29431
feat: quick freeze/unfreeze UTXOs on send page (#771)
amitx13 Jul 22, 2024
4d74ab2
feat: unit and visibility toggle on main wallet view (#806)
theborakompanioni Aug 6, 2024
76d0903
bug fixing
amitx13 Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions public/sprite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 15 additions & 4 deletions src/components/Balance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,28 @@ interface BalanceComponentProps {
symbol?: JSX.Element
showSymbol?: boolean
frozen?: boolean
isColorChange?: boolean
frozenSymbol?: boolean
}

const BalanceComponent = ({
symbol,
showSymbol = true,
frozen = false,
isColorChange = false,
frozenSymbol = true,
children,
}: PropsWithChildren<BalanceComponentProps>) => {
return (
<span
className={classNames(styles.balance, 'balance-hook', 'd-inline-flex align-items-center', {
className={classNames('balance-hook', 'd-inline-flex align-items-center', {
[styles.frozen]: frozen,
[styles.balance]: !isColorChange,
})}
>
{children}
{showSymbol && symbol}
{frozen && FROZEN_SYMBOL}
{frozen && frozenSymbol && FROZEN_SYMBOL}
</span>
)
}
Expand All @@ -75,7 +80,9 @@ const BitcoinBalance = ({ value, ...props }: BitcoinBalanceProps) => {
return (
<BalanceComponent symbol={BTC_SYMBOL} {...props}>
<span
className={`${styles.bitcoinAmount} slashed-zeroes`}
className={classNames(`slashed-zeroes`, {
[styles.bitcoinAmount]: !props.isColorChange,
})}
data-testid="bitcoin-amount"
data-integer-part-is-zero={integerPartIsZero}
data-fractional-part-starts-with-zero={fractionalPartStartsWithZero}
Expand All @@ -101,7 +108,11 @@ type SatsBalanceProps = Omit<BalanceComponentProps, 'symbol'> & { value: number
const SatsBalance = ({ value, ...props }: SatsBalanceProps) => {
return (
<BalanceComponent symbol={SAT_SYMBOL} {...props}>
<span className={`${styles.satsAmount} slashed-zeroes`} data-testid="sats-amount" data-raw-value={value}>
<span
className={classNames(`slashed-zeroes`, { [styles.satsAmount]: !props.isColorChange })}
data-testid="sats-amount"
data-raw-value={value}
>
{formatSats(value)}
</span>
</BalanceComponent>
Expand Down
22 changes: 18 additions & 4 deletions src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type BaseModalProps = {
onCancel: () => void
backdrop?: rb.ModalProps['backdrop']
size?: rb.ModalProps['size']
showCloseButtonAndRemoveClassName?: boolean
}
const BaseModal = ({
isShown,
Expand All @@ -18,6 +19,7 @@ const BaseModal = ({
onCancel,
size,
backdrop = 'static',
showCloseButtonAndRemoveClassName = false,
}: PropsWithChildren<BaseModalProps>) => {
return (
<rb.Modal
Expand All @@ -31,8 +33,11 @@ const BaseModal = ({
size={size}
className={styles.modal}
>
<rb.Modal.Header className={styles['modal-header']}>
<rb.Modal.Title className={styles['modal-title']}>{title}</rb.Modal.Title>
<rb.Modal.Header
className={!showCloseButtonAndRemoveClassName && styles['modal-header']}
closeButton={showCloseButtonAndRemoveClassName}
>
<rb.Modal.Title className={!showCloseButtonAndRemoveClassName && styles['modal-title']}>{title}</rb.Modal.Title>
</rb.Modal.Header>
{children}
</rb.Modal>
Expand Down Expand Up @@ -65,9 +70,18 @@ const InfoModal = ({

export type ConfirmModalProps = BaseModalProps & {
onConfirm: () => void
disabled?: boolean
confirmVariant?: string
}

const ConfirmModal = ({ children, onCancel, onConfirm, ...baseModalProps }: PropsWithChildren<ConfirmModalProps>) => {
const ConfirmModal = ({
children,
onCancel,
onConfirm,
disabled = false,
confirmVariant = 'outline-dark',
...baseModalProps
}: PropsWithChildren<ConfirmModalProps>) => {
const { t } = useTranslation()

return (
Expand All @@ -82,7 +96,7 @@ const ConfirmModal = ({ children, onCancel, onConfirm, ...baseModalProps }: Prop
<Sprite symbol="cancel" width="26" height="26" />
<div>{t('modal.confirm_button_reject')}</div>
</rb.Button>
<rb.Button variant="outline-dark" onClick={() => onConfirm()}>
<rb.Button variant={confirmVariant} onClick={() => onConfirm()} disabled={disabled}>
{t('modal.confirm_button_accept')}
</rb.Button>
</rb.Modal.Footer>
Expand Down
14 changes: 13 additions & 1 deletion src/components/PaymentConfirmModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ interface PaymentDisplayInfo {
numCollaborators?: number
feeConfigValues?: FeeValues
showPrivacyInfo?: boolean
showSelectedUtxos?: boolean
}

interface PaymentConfirmModalProps extends ConfirmModalProps {
Expand All @@ -80,6 +81,7 @@ export function PaymentConfirmModal({
numCollaborators,
feeConfigValues,
showPrivacyInfo = true,
showSelectedUtxos = false,
},
children,
...confirmModalProps
Expand Down Expand Up @@ -207,7 +209,17 @@ export function PaymentConfirmModal({
</rb.Col>
</rb.Row>
)}
{children && (
{showSelectedUtxos && (
<rb.Row className="mt-3">
<rb.Col xs={4} md={3} className="text-end">
<strong>{t('show_utxos.selected_utxos')}</strong>
</rb.Col>
<rb.Col xs={8} md={9}>
{children}
</rb.Col>
</rb.Row>
)}
{!showSelectedUtxos && children && (
<rb.Row>
<rb.Col xs={12}>{children}</rb.Col>
</rb.Row>
Expand Down
9 changes: 8 additions & 1 deletion src/components/Send/SendForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
isValidNumCollaborators,
} from './helpers'
import { AccountBalanceSummary } from '../../context/BalanceSummary'
import { WalletInfo } from '../../context/WalletContext'
import { WalletInfo, CurrentWallet, Utxo } from '../../context/WalletContext'
import { useSettings } from '../../context/SettingsContext'
import styles from './SendForm.module.css'
import { TxFeeInputField, validateTxFee } from '../settings/TxFeeInputField'
Expand Down Expand Up @@ -214,13 +214,15 @@ export interface SendFormValues {
txFee?: TxFee
isCoinJoin: boolean
numCollaborators?: number
selectedUtxos?: Array<Utxo>
}

interface InnerSendFormProps {
props: FormikProps<SendFormValues>
className?: string
isLoading: boolean
walletInfo?: WalletInfo
wallet: CurrentWallet
loadNewWalletAddress: (props: { signal: AbortSignal; jarIndex: JarIndex }) => Promise<Api.BitcoinAddress>
minNumCollaborators: number
feeConfigValues?: FeeValues
Expand All @@ -233,6 +235,7 @@ const InnerSendForm = ({
className,
isLoading,
walletInfo,
wallet,
loadNewWalletAddress,
minNumCollaborators,
feeConfigValues,
Expand Down Expand Up @@ -272,6 +275,7 @@ const InnerSendForm = ({
name="sourceJarIndex"
label={t('send.label_source_jar')}
walletInfo={walletInfo}
wallet={wallet}
isLoading={isLoading}
disabled={disabled}
variant={showCoinjoinPreconditionViolationAlert ? 'warning' : 'default'}
Expand Down Expand Up @@ -375,6 +379,7 @@ type SendFormProps = Omit<InnerSendFormProps, 'props' | 'className'> & {
onSubmit: (values: SendFormValues) => Promise<void>
formRef?: React.Ref<FormikProps<SendFormValues>>
blurred?: boolean
wallet: CurrentWallet
}

export const SendForm = ({
Expand All @@ -383,6 +388,7 @@ export const SendForm = ({
formRef,
blurred = false,
walletInfo,
wallet,
minNumCollaborators,
...innerProps
}: SendFormProps) => {
Expand Down Expand Up @@ -446,6 +452,7 @@ export const SendForm = ({
props={props}
className={blurred ? styles.blurred : undefined}
walletInfo={walletInfo}
wallet={wallet}
minNumCollaborators={minNumCollaborators}
{...innerProps}
/>
Expand Down
79 changes: 79 additions & 0 deletions src/components/Send/ShowUtxos.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
.joinedUtxoAndCjout {
background-color: #27ae600d !important;
color: #27ae60 !important;
}

.frozenUtxo {
background-color: #2d9cdb0d !important;
color: #2d9cdb !important;
}

.depositUtxo {
background-color: none !important;
color: var(--bs-modal-color) !important;
}

.changeAndReuseUtxo {
background-color: #eb57570d !important;
color: #eb5757 !important;
}

.subTitle {
color: #777777 !important;
}

.utxoTagDeposit {
color: #999999;
border: 1px solid #bbbbbb;
background-color: #dedede !important;
border-radius: 0.35rem;
padding: 0rem 0.25rem;
}

.utxoTagJoinedAndCjout {
border: 1px solid #27ae60;
background-color: #c6eed7 !important;
border-radius: 0.35rem;
padding: 0rem 0.25rem;
}

.utxoTagFreeze {
border: 1px solid #2d9cdb;
background-color: #bce7ff !important;
border-radius: 0.35rem;
padding: 0rem 0.25rem;
}

.utxoTagChangeAndReuse {
border: 1px solid #eb5757;
background-color: #fac7c7 !important;
border-radius: 0.35rem;
padding: 0rem 0.25rem;
}

.squareToggleButton {
appearance: none;
width: 22px;
height: 22px;
border-radius: 3px;
border: 1px solid var(--bs-body-color);
margin-top: 0.45rem;
}

.selected {
visibility: visible !important;
background-color: var(--bs-body-color);
}

.squareFrozenToggleButton {
appearance: none;
width: 22px;
height: 22px;
border-radius: 3px;
border: 1px solid #2d9cdb;
margin-top: 0.45rem;
}

.utxoListDisplayHeight {
max-height: 17.6rem;
}
Loading