Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

1032/filter tokens orders widget #1097

Merged
merged 26 commits into from
Jun 15, 2020

Conversation

W3stside
Copy link
Contributor

@W3stside W3stside commented Jun 11, 2020

Closes #1032

Dependent on #1094

To test: head to /orders or /trade page and filter tokens by address/symbol/name

useOrders:

  • Changes hook to call for token details inside useEffect and replace OrderRow's previous responsibility on this
  • orders returned now adhere to DetailedAuctionElement interface which is AuctionElement + TokenDetails for both buyToken and sellToken

Filter at work - /orders:
Screenshot from 2020-06-11 11-54-44

/trade:
Screenshot from 2020-06-11 11-55-49

@ghost
Copy link

ghost commented Jun 11, 2020

Travis automatic deployment:
https://pr1097--dexreact.review.gnosisdev.com

Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

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

Nice, although the tooltip should show when you filter also by text, right?

See how it's 1 result in both screenshots, but only one shows the tooltip

Screenshot at Jun 11 13-15-57

Screenshot at Jun 11 13-16-12

@W3stside
Copy link
Contributor Author

W3stside commented Jun 11, 2020

Nice, although the tooltip should show when you filter also by text, right?

See how it's 1 result in both screenshots, but only one shows the tooltip

Screenshot at Jun 11 13-15-57 Screenshot at Jun 11 13-16-12

I didn't add it here since users will look up 1 token at a time ussually? or no? i can re-add it

Clarification: i only added the filter to the hide-zero-balance toggle, not the search filter

src/hooks/useOrders.ts Outdated Show resolved Hide resolved
src/hooks/usePendingOrders.ts Outdated Show resolved Hide resolved
@anxolin
Copy link
Contributor

anxolin commented Jun 11, 2020

Additional comment (discussed in the chat):

Can we also include orderId as part of the filter. It's just super convenient.
Also what leandro did in the trades with the HTML5 data to see the order id would be good

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Loved the filtered count detail.

screenshot_2020-06-11_09-46-15

Small points though:

  1. Why is the right side border rounded up instead of rounded down? I would expect it to round away from the search bar
    (edit: just noticed on Anxo's image it's rounded as I would expect. FF problems, then...)
  2. It should say orders instead of tokens

src/components/OrdersWidget/index.tsx Outdated Show resolved Hide resolved
src/api/exchange/ExchangeApi.ts Show resolved Hide resolved
@W3stside W3stside force-pushed the 1032/filter-tokens-orders-widget branch from 1c37028 to 8dcb855 Compare June 12, 2020 11:35
@alfetopito
Copy link
Contributor

I still see it upside down :/

screenshot_2020-06-12_08-24-49

@W3stside
Copy link
Contributor Author

@alfetopito fixed it, wasn't moz related but dumb (me) related, good catch!

src/components/OrdersWidget/index.tsx Outdated Show resolved Hide resolved
src/components/OrdersWidget/index.tsx Outdated Show resolved Hide resolved
@alfetopito
Copy link
Contributor

@alfetopito fixed it, wasn't moz related but dumb (me) related, good catch!

Still there. Do you have anything local pending git push?

@W3stside
Copy link
Contributor Author

@alfetopito fixed it, wasn't moz related but dumb (me) related, good catch!

Still there. Do you have anything local pending git push?

indeed ;)

@W3stside W3stside merged commit ae225ad into useDataFilter Jun 15, 2020
W3stside added a commit that referenced this pull request Jun 15, 2020
* filteredOrders -> classifiedOrders (name change)

* useSearchFilter hook

* useDataFilter as a more generic hoook instead of 2 hooks: useHideData and useSearchFilter

* add filters to DepositWidget

* dont use event on filter toggle

* removed useHideZero

* useDataFilter: PR comments addressed

1. memoised all the things (necessary)
2. export handlers obj
3. logic opt - cleaner readability

* memoised filter params, better filter logic

* 1032/filter tokens orders widget (#1097)

* grab token details inside useOrders

1. use service
2. populate here to filter later
3. created DetailedAuctionElement type

* remove async logic of fetching tokens from OrderRow inside fetchTokens

* export BalanceTools

* pass BalanceTools and DetauledAuction/PendingElement into OrdersWidget

* get detailed info from pendingOrders hook

* BalanceTools added with cehckbox and css changed to keep box on top

* added FormMessage to show filter amount

1. added useDataFilter to OrderWidget

* CSS: removed duped code, added styling

* css fix on text color FormMessage

* move BalanceTools into FilterTools component

1. re-add h5 title to TradeWidget (was removed to try adding as prop)

* Add FilterTools to DepositWidget

* add FilterTools to OrdersWidget + misc changes

1. add isWidget prop to flag smaller size

* prop isWidget

* simplify filter fn

* include data-order-id to each tr

* added id filtering

1. made filtering into fn for ease

* fixed dataFiter props after rebase

* DepositWidget: show filter results on search

* Promise.all inside useOrder/PendingOrders

* FilterTools resultName prop

* move inline CSS to OrdersWidget.styled

* fix missing border-radius for trade pg

* use correct TokenDetails from `types`

* no need for cast after fixed TokenDetails

* return null custom filter fn on empty string

thanks @Velenir

* use TokenDetails from types
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants