Skip to content

Conversation

@lissavxo
Copy link
Collaborator

Related to #848

Description

Added a selector in CSV export to split the transaction by currency

Test plan

  • Test export csv all currencies and single currency

@lissavxo lissavxo force-pushed the feat/update-csv-download branch from dba2c8d to 8a0b023 Compare September 10, 2024 02:28
Copy link
Member

@Klakurka Klakurka left a comment

Choose a reason for hiding this comment

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

  • USD/CAD is going to be an account setting. What I meant here was to have BCH and XEC split out.
  • The dropdown label appears in the dropdown list but isn't clickable:
    image - you can just add a hidden attribute.
  • Cursor should be the pointer when hovering over the dropdown buttons.

@lissavxo lissavxo requested a review from Klakurka September 16, 2024 20:38
Copy link
Member

@Klakurka Klakurka left a comment

Choose a reason for hiding this comment

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

  • Only show a currency in the dropdown if the button actually has an address for that currency.
  • Only show the dropdown at all if the button has addresses for 2 or more currencies.
  • The filename when selection 'All Currencies' has two - instead of 1.
  • Let's change the filename to [button name]-transactions instead of [button id]-all-transactions (or [button id]-xec-transactions when XEC-only is selected).

@lissavxo lissavxo requested a review from Klakurka September 19, 2024 06:20
Copy link
Collaborator

@chedieck chedieck left a comment

Choose a reason for hiding this comment

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

Looks good, only some small changes in the code.

As for the pointer cursor in the dropdown, it would require to refactor the dropdown as something other than an actual <select> dropdown (such as a list of <li> elements) because using CSS to set the cursor as pointer in an actual dropdown doesn't work: the dropdown is rendered by the operating system, not the browser.

We could just ignore it but TBH I think would be way nicer UX if the cursor was really a pointer, since the experience of selecting something that is actually a button feels weird.

try {
const response = await fetch(`/api/paybutton/download/transactions/${paybutton.id}`)
let url = `/api/paybutton/download/transactions/${paybutton.id}`
const isCurrencyEmpty = (value: string): boolean => (value === '')
Copy link
Collaborator

Choose a reason for hiding this comment

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

This abstraction seems overly complicated since it's only used once, here right after its defined.
Why not use a simple if (currency === '') below?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because I am using it in two places and I changed a bit to add undefined check too

Klakurka
Klakurka previously approved these changes Sep 20, 2024
Klakurka
Klakurka previously approved these changes Sep 20, 2024
Copy link
Member

@Klakurka Klakurka left a comment

Choose a reason for hiding this comment

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

Looks good to me.

We just need a way to get CAD working even if it's by manually setting it in the db for the account that generates the CSV.

const networkId = await getNetworkIdFromSlug(slug ?? NETWORK_TICKERS.ecash)
networkIdArray = [networkId]
}
const transactionsGrouped = await fetchTransactionsByPaybuttonIdGroupedByNetwork(paybutton.id, networkIdArray)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need them grouped if you just ungroup it afterwards? This variable is not used anywhere further.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is to separate/group by network

return transactions
}

export async function fetchTransactionsByPaybuttonIdGroupedByNetwork (
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is created to be used in a place where the grouping is not relevant. I don't get why it exists, but in any case would be better if it took the txs list, not the button and networkids as a parameter.

Copy link
Collaborator Author

@lissavxo lissavxo Sep 23, 2024

Choose a reason for hiding this comment

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

grouping is relevant, we order by date and group by network.. this way we separate the txs list by network

@Klakurka Klakurka merged commit 056553b into master Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants