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

Refactor/show utxos #805

Closed
wants to merge 36 commits into from
Closed
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ddada6d
Implemented UTXO Selection Modal
amitx13 Jun 2, 2024
4c5be8f
Done with the suggested changes in ShowUtxos
amitx13 Jun 3, 2024
162d89e
minor bug fixing
amitx13 Jun 3, 2024
08e1355
added spend file
barrytra Jun 7, 2024
e1a7858
Merge branch 'master' of https://github.com/barrytra/jam into epic/re…
barrytra Jun 7, 2024
a5e21fb
Fixed Undefined tag issue , Refactor Jar Selection logic & some minor…
amitx13 Jun 8, 2024
c3c2aa1
Updated deposit tag , Refactor ShowUtxos & added few comments
amitx13 Jun 9, 2024
16786f6
ui: FB modal body ui changed
barrytra Jun 9, 2024
2851b7a
ui(FB): improved design of new FB modal
barrytra Jun 10, 2024
cf5263a
ui:(FB) added timeLock address component
barrytra Jun 11, 2024
df3345b
ui:(FB) back button instead of cancel button
barrytra Jun 13, 2024
2430b95
ui: added subtitles for steps except 3
barrytra Jun 13, 2024
3d1533f
Fixed recommended changes
amitx13 Jun 13, 2024
6e2dff5
fix(ui): subtitle fix
barrytra Jun 14, 2024
fca9d31
ui(fb): improved select Date UI
barrytra Jun 21, 2024
9464524
select utxos UI done
barrytra Jun 26, 2024
7fff743
Made UTXO list scrollable after 5 entries for better usability
amitx13 Jun 26, 2024
a9988ba
Fixed ShowUtxos and reused it in PaymentConfirmModal for UTXOs review
amitx13 Jun 27, 2024
eead604
Implemented suggested changes and made it reusable
amitx13 Jun 27, 2024
01ca815
bug fixing
amitx13 Jun 27, 2024
027f0d9
empty utxos bug fixed
amitx13 Jun 27, 2024
54c18fa
select Utxos UI initiated
barrytra Jun 28, 2024
7407e9d
Merge branch '765-ui-implement-utxo-selection-modal' of https://githu…
barrytra Jun 28, 2024
0d1a32c
separted frozen and unfrozen utxos
barrytra Jun 29, 2024
54df16f
FB: checkbox enabled for third step
barrytra Jul 2, 2024
b58db8a
Merge pull request #1 from joinmarket-webui/master
barrytra Jul 2, 2024
f22a5a8
Merge branch 'master' of https://github.com/barrytra/jam into epic/re…
barrytra Jul 2, 2024
5df6c02
Merge branch 'epic/redesign' of https://github.com/barrytra/jam into …
barrytra Jul 2, 2024
bf25a49
removed warnings
barrytra Jul 2, 2024
ccf1e9a
Merge branch 'joinmarket-webui:master' into epic/redesign
barrytra Jul 7, 2024
f55c748
Merge branch 'devel' of https://github.com/joinmarket-webui/jam
barrytra Jul 30, 2024
06947d6
refactor: showUtxos
barrytra Jul 30, 2024
8820a8f
removed warnings
barrytra Jul 30, 2024
7bd9b19
fixes
barrytra Jul 30, 2024
7312dd1
fixes
barrytra Jul 30, 2024
7b00d69
added index as parameter
barrytra Aug 3, 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
14 changes: 7 additions & 7 deletions src/components/Send/ShowUtxos.tsx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface ShowUtxosProps {
interface UtxoRowProps {
utxo: Utxo
utxoIndex: number
onToggle?: (index: number, isFrozen: boolean) => void
onToggle?: (utxoIndex: number, utxo: Utxo) => void
isFrozen: boolean
settings: Settings
showRadioButton: boolean
Expand All @@ -43,7 +43,7 @@ interface UtxoRowProps {

interface UtxoListDisplayProps {
utxos: Array<Utxo>
onToggle?: (index: number, isFrozen: boolean) => void
onToggle?: (utxoIndex: number, utxo: Utxo) => void
settings: Settings
showRadioButton: boolean
showBackgroundColor: boolean
Expand Down Expand Up @@ -104,7 +104,7 @@ const UtxoRow = memo(
walletInfo,
t,
}: UtxoRowProps) => {
const { address: utxoAddress, confirmations, value, checked, frozen } = utxo
const { address: utxoAddress, confirmations, value, checked } = utxo

const address = useMemo(() => formatAddress(utxoAddress), [utxoAddress])
const conf = useMemo(() => formatConfirmations(confirmations), [confirmations])
Expand Down Expand Up @@ -151,7 +151,7 @@ const UtxoRow = memo(
className={classNames(rowAndTagClass.row, 'cursor-pointer', {
'bg-transparent': !showBackgroundColor,
})}
onClick={() => onToggle && onToggle(utxoIndex, frozen)}
onClick={() => onToggle && onToggle(utxoIndex, utxo)}
>
{showRadioButton && (
<Cell>
Expand All @@ -160,7 +160,7 @@ const UtxoRow = memo(
type="checkbox"
checked={checked}
onChange={() => {
onToggle && onToggle(utxoIndex, isFrozen)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will happen to isFrozen that we're not getting from above, how would you handle frozen utxo and non-frozen utxo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utxo will contain all the properties of the particularly selected utxo. So to access isFrozen property we can use utxo.isFrozen. Basically we are trying to access whole utxo instead of just one of its property isFrozen.

onToggle && onToggle(utxoIndex, utxo)
}}
className={classNames(isFrozen ? styles.squareFrozenToggleButton : styles.squareToggleButton, {
[styles.selected]: checked,
Expand Down Expand Up @@ -296,8 +296,8 @@ const ShowUtxos = ({

// Handler to toggle UTXO selection
const handleUtxoCheckedState = useCallback(
(utxoIndex: number, isFrozen: boolean) => {
if (!isFrozen) {
(utxoIndex: number, utxo: Utxo) => {
if (!utxo.frozen) {
const utxos = unFrozenUtxos.map((utxo: Utxo, i: number) =>
i === utxoIndex ? { ...utxo, checked: !utxo.checked } : utxo,
)
Expand Down