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

ui: markets page rework #25

Merged
merged 82 commits into from
Jan 1, 2025
Merged

Conversation

norwnd
Copy link
Owner

@norwnd norwnd commented Nov 24, 2024

This is a port of decred#2043 onto the latest master of https://github.com/norwnd/dcrdex,

but really it's a full rework of /markets page (with major code refactoring) because additionally this PR implements order-form even further:

  • adding qty slider
  • disabling mouse scrolling on number inputs
  • making user interactions to conform to a certain sequence (as opposed to user randomly throwing in different values at the form, hoping they'd stick - this fails occasionally because it doesn't prevent all kinds of race conditions)
  • making elements on the form bigger (hence easier to use)
  • a bunch of QoL improvements from ui: order form compacting decred/dcrdex#2003
  • etc.

but also makes a bunch of changes like:

  • some additional cleanup after rebase (onto latest master branch of https://github.com/norwnd/dcrdex)
  • some cleanup after we've removed depth-chart (in master branch of https://github.com/norwnd/dcrdex)
  • getting rid of market orders form(s) in UI
  • limit order form is now split in 2 separate forms (buy and sell), this helps with addressing and discovering bugs related to order form in simpler manner
  • order buy/sell form has now been moved under candle chart (similar to Binance)
  • wallet widget has been removed from "markets" page (it adds unnecessary bulk) to keep it clean, plus a bunch of other small unnecessary things have been removed (such as drop-down arrow on pending/historical orders)
  • addresses issues related to mouse-scrolling over input HTML elements (especially those related to type/nodeType number that results into number changing - which is almost always undesirable behavior to have)
  • reworked order-book, matches table, candle chart to get the most of out those (adding usability features and such)
  • removed/cleaned-up a bunch of irrelevant/globally-applied styles that mess with lots of views/forms
  • implemented proper price/qty formatting, such that everything aligns nicely (and so we don't have to trade-off decimal precision vs ugly rendering)

@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch from 728ee3c to 7a6a0ef Compare November 24, 2024 21:23
@norwnd norwnd changed the title ui: order-form responsive validation ui: markets page rework (mainly order-form) Nov 26, 2024
@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch 13 times, most recently from 2f75b77 to c0a9128 Compare December 1, 2024 13:09
@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch 3 times, most recently from 6422729 to a321067 Compare December 8, 2024 11:03
@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch 7 times, most recently from 6cea86b to b55b0f0 Compare December 10, 2024 10:49
@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch 4 times, most recently from 3422c6f to 02f0afe Compare December 21, 2024 15:59
norwnd added 14 commits December 30, 2024 14:18
… overview view background distinct from created bot configurations
…ger being relevant (eg. order in submitting status)
…t (for simpler readability) and only show recent (24h in the past) matches; also rework order-book mid-section
…rs previuosly); add completed orders views (and extend order filtering API to support the use-case of fetching trully relevant orders); format quantities on open/completed views to lot size; finally, minor adjustments to relevant html/css have been made
@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch from 2afafdb to 62dad15 Compare December 30, 2024 12:18
@norwnd norwnd changed the title ui: markets page rework (mainly order-form) ui: markets page rework Dec 30, 2024
@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch from 03aeed8 to aa6ede6 Compare December 30, 2024 13:27
@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch 5 times, most recently from 518c812 to 114610a Compare December 31, 2024 11:21
… (also display fiat rate alongside); improve the way stuck EVM transactions are handled so that fee-bumps actually work; respects user-configured MaxFee estimate for redeems
@norwnd norwnd force-pushed the rebased-ui-order-form-responsive-validation branch from 114610a to adb9438 Compare December 31, 2024 11:28
@norwnd
Copy link
Owner Author

norwnd commented Jan 1, 2025

Merging since this functionality is mostly done, minor adjustments/fixes that follow can go directly to master

@norwnd norwnd merged commit 24e4ffc into master Jan 1, 2025
9 of 15 checks passed
norwnd added a commit that referenced this pull request Jan 18, 2025
* ui: markets page rework (mainly order-form)

* fix rate conversion(s), get rid of swap options views (and rework showVerify), get rid of translations as unnecessary burden

* fix decimal number inputs (getting rid of number in favor of text + additional js validation)

* turn off selection history for order-forms

* handle balance update notes properly

* rework market list

* minor visual adjustments (margins and such)

* add reference fiat rate in orange

* move order-forms under candle chart

* fix scaling with browser zoom

* fix total calculation for buy/sell forms

* order-form: resolve some edge-cases around invalid inputs

* refactor number parsing for rate/qty fields, allow for comma

* rework active orders section to only show active/relevant orders

* order-form: optimize buy/sell buttons

* refactor out unnecessary delay param

* rework slider to make it more vibrant, general order form improvements & bug fixes (element alignment and such)

* markets: shrink header a bit, limit order book-side size to 14 so we don't have to scroll UI

* improve rate/qty fields parsing

* improve slider handling

* markets: adding order to book-side should be smooth

* markets: rework header, rework spot-price display

* minor sell slider fix

* minor markets-header adjustments

* markets: misc adjustments (mostly header)

* order-form default price should be best buy/sell (not mid-gap)

* form-label should not affect cursor

* rework market header (mostly to simplify code involved), format total in/out properly, make candle-chart scaling/zooming smooth (add more zoom-levels)

* get rid of redundant trading limits info, remove what's left of wallet locking in UI, adjust markets header

* fix number formatting all across UI

* introduce a work-around for insanely high server-configured rate-step

* refactor matches table code, swap column order for more clear signal, add asset symbols to clarify what Rate/Size are

* refactor qty parsing (order-form)

* refactor rate/coin formatting, format qty to lot size (in order-book, matches table)

* reverse rate/qty columns in order-book to make qty easier to read

* use precise to-lot formatting where it makes sense

* rework order-book to highlight order relevance (based on quantity and price)

* fix typo/bug with converting floating-point numbers to atomic numbers (which are always integers)

* (when formatting decimals in UI) don't show comma since it's confusing when combined with decimal dot

* candle chart refactoring/adjustments (mostly related to making scrolling smooth, adjusting paddings, and moving price labels to a separate column on the right); plus minor bug fixes unrelated to candle chart

* candle-chart: make scrolling smoother

* fix forms formatting

* candle-chart: fixes & adjustments (proper life-cycle handling)

* variuos adjustments to make things pretty

* re-arrange stats on market header (mostly around bison/fiat price), fix the way candles/market is loaded

* markets: remove order-acceleration functionality since it doesn't belong on this page (we can accelerate on order-view if necessary), add a bunch of missing await calls

* add tooltips for bison/external prices, display external price on the order-book as well

* use defined constant instead of hardcoded value (for colors), make MM overview view background distinct from created bot configurations

* order-form: make use of change handler for price/qty inputs to address some quirks of current implementation

* minor adjustments

* handle edge-case related to user order still showing in UI but no longer being relevant (eg. order in submitting status)

* adjust the way candlesLoaded notification gets handled in UI to make it fully symmetric

* matches table - update Age column to be a timestamp in hh-mm-ss format (for simpler readability) and only show recent (24h in the past) matches; also rework order-book mid-section

* use more compact date-time for display on candle chart (when candle is hovered)

* rework market page UI colors, minor mics adjustments

* update the way order-book looks, add % delta relative to external price

* remove last match data from order-book to keep it clean and simple

* order-book: periodically update price delta(s)

* cut margins for date-time displayed on candle chart (when candle is hovered), adjust profit threshold

* display negative price delta with opposite color to make it clearly visible in UI

* refactor code around recent matches & open orders (called active orders previuosly); add completed orders views (and extend order filtering API to support the use-case of fetching trully relevant orders); format quantities on open/completed views to lot size; finally, minor adjustments to relevant html/css have been made

* update OrderReader.StatusString func to correspond to what we have in JS

* properly count/display total/locked wallet balances

* fix incorrect fee displayed in UI for user-prompt action to bump fees (also display fiat rate alongside); improve the way stuck EVM transactions are handled so that fee-bumps actually work; respects user-configured MaxFee estimate for redeems

---------

Co-authored-by: norwnd <norwnd>
norwnd added a commit that referenced this pull request Jan 18, 2025
* add build scripts, add work-around for poor order-book sync between client and server, mm bot rework of basic strategy to make it competitive, relax requirements for POL reserved/locked for fees, get rid of depth chart, other UI cleanup

* fix typos (introduced when removing depth-chart)

* improve order placement (add safety, adjust logs)

* allow to configure profit threshold between 0.1 and 4% (from 2% max allowed previously)

* mm bot improvements, rework previous solution for displaying own order book orders to be complete

* mm bot should make 1-sided placements only, skew mm bot algo to resits (not follow) rapid market price changes

* mm bot adjustments

* mm bot adjustments

* perform Bison mid-gap rate sanity check only when mid-gap rate is available

* work-around for annoying bug that Bison wallet doesn't recover from

* makefile: make a by default

* update fiat rates more frequently

* only check for slippage when we can get mid-gap rate

* better checks for bad prices from fiat oracles

* remove locale artifacts

* better validation for oracle volume

* revert: update fiat rates more frequently (we can't fetch fiat rates more frequently due to aggressive rate limiting)

* disable server-enforced max-fee limit restriction

* add Binance as fiat-rate source, disable other fiat-rate sources for now

* enforce user-configured max-fee-rate value properly

* revert inconsistent change

* improve trade validation (keep it powerful, but not intrusive)

* have pprof on by default

* refuse to use any other rate than wallet-provided

* (refactor) refuse to use any other rate than wallet-provided

* revert last commit since not every wallet is a FeeRater we still have to fall back to other rate-sources occasionally

* update fiat rates more frequently (note, this works with Binance rate source only since other sources have strict rate limits)

* btc: better differentiate between transaction types when identifying unknown transaction

* align btc implementation with zec

* rework slippage warning

* mm bot shouldn't rely on Bison book being present (use oracle/fiat rate only as reference point)

* fix typo in trade-validation code that results into panic

* ui: markets page rework (#25)

* ui: markets page rework (mainly order-form)

* fix rate conversion(s), get rid of swap options views (and rework showVerify), get rid of translations as unnecessary burden

* fix decimal number inputs (getting rid of number in favor of text + additional js validation)

* turn off selection history for order-forms

* handle balance update notes properly

* rework market list

* minor visual adjustments (margins and such)

* add reference fiat rate in orange

* move order-forms under candle chart

* fix scaling with browser zoom

* fix total calculation for buy/sell forms

* order-form: resolve some edge-cases around invalid inputs

* refactor number parsing for rate/qty fields, allow for comma

* rework active orders section to only show active/relevant orders

* order-form: optimize buy/sell buttons

* refactor out unnecessary delay param

* rework slider to make it more vibrant, general order form improvements & bug fixes (element alignment and such)

* markets: shrink header a bit, limit order book-side size to 14 so we don't have to scroll UI

* improve rate/qty fields parsing

* improve slider handling

* markets: adding order to book-side should be smooth

* markets: rework header, rework spot-price display

* minor sell slider fix

* minor markets-header adjustments

* markets: misc adjustments (mostly header)

* order-form default price should be best buy/sell (not mid-gap)

* form-label should not affect cursor

* rework market header (mostly to simplify code involved), format total in/out properly, make candle-chart scaling/zooming smooth (add more zoom-levels)

* get rid of redundant trading limits info, remove what's left of wallet locking in UI, adjust markets header

* fix number formatting all across UI

* introduce a work-around for insanely high server-configured rate-step

* refactor matches table code, swap column order for more clear signal, add asset symbols to clarify what Rate/Size are

* refactor qty parsing (order-form)

* refactor rate/coin formatting, format qty to lot size (in order-book, matches table)

* reverse rate/qty columns in order-book to make qty easier to read

* use precise to-lot formatting where it makes sense

* rework order-book to highlight order relevance (based on quantity and price)

* fix typo/bug with converting floating-point numbers to atomic numbers (which are always integers)

* (when formatting decimals in UI) don't show comma since it's confusing when combined with decimal dot

* candle chart refactoring/adjustments (mostly related to making scrolling smooth, adjusting paddings, and moving price labels to a separate column on the right); plus minor bug fixes unrelated to candle chart

* candle-chart: make scrolling smoother

* fix forms formatting

* candle-chart: fixes & adjustments (proper life-cycle handling)

* variuos adjustments to make things pretty

* re-arrange stats on market header (mostly around bison/fiat price), fix the way candles/market is loaded

* markets: remove order-acceleration functionality since it doesn't belong on this page (we can accelerate on order-view if necessary), add a bunch of missing await calls

* add tooltips for bison/external prices, display external price on the order-book as well

* use defined constant instead of hardcoded value (for colors), make MM overview view background distinct from created bot configurations

* order-form: make use of change handler for price/qty inputs to address some quirks of current implementation

* minor adjustments

* handle edge-case related to user order still showing in UI but no longer being relevant (eg. order in submitting status)

* adjust the way candlesLoaded notification gets handled in UI to make it fully symmetric

* matches table - update Age column to be a timestamp in hh-mm-ss format (for simpler readability) and only show recent (24h in the past) matches; also rework order-book mid-section

* use more compact date-time for display on candle chart (when candle is hovered)

* rework market page UI colors, minor mics adjustments

* update the way order-book looks, add % delta relative to external price

* remove last match data from order-book to keep it clean and simple

* order-book: periodically update price delta(s)

* cut margins for date-time displayed on candle chart (when candle is hovered), adjust profit threshold

* display negative price delta with opposite color to make it clearly visible in UI

* refactor code around recent matches & open orders (called active orders previously); add completed orders views (and extend order filtering API to support the use-case of fetching truly relevant orders); format quantities on open/completed views to lot size; finally, minor adjustments to relevant html/css have been made

* update OrderReader.StatusString func to correspond to what we have in JS

* properly count/display total/locked wallet balances

* fix incorrect fee displayed in UI for user-prompt action to bump fees (also display fiat rate alongside); improve the way stuck EVM transactions are handled so that fee-bumps actually work; respects user-configured MaxFee estimate for redeems

* mm: enforce oracle/fiat price confluence, add USDT-derived oracle markets, bump HTTP response read limit to allow for fetching oracle rates (for certain markets the amount of data to fetch is just higher)

* fix 1d on completed history view, don't show active orders in completed history (these are shown in open orders section)

* make duration labels on Candle chart less distracting (by setting opacity below 1)

* improve the way immediate-match warning works, prevent MM bot from placing immediately matching orders (as a safety precaution)

* mics improvements (mostly adding await & adjusting font sizes), adjust red/green colors on markets page, use Binance-like own order market (orange dot) since it's nice and clean compared to everything else I've tried

* put completed orders section right below open orders section

* instrument a.sh with pprof everywhere

* don't initiate swap if wallet-supported rate is too low when swap needs to happen (it's better than overpaying in fees, or initiating swap and refunding it eventually due to swap tx never being mined)

* use 2x fee cap (wallet configuration setting) for Swap transaction type since it's under sever time limit for trade to execute successfully

* adjust the way wallets handle fees (swap, max cap, etc.)

* filter out inactive orders (open orders section)

* set reasonable default fee cap for ETH and POL wallets

* adjust wallet readiness checks on buy/sell order forms

* increase EVM providers request timeouts so we can better tolerate temporary networking delays (also reducing user notifications spam)

* markets page, cancelling order should happen immediately without additional popup

* use age instead of time column for recent matches (since time is hard to make sense of when matches aren't happening constantly all the time), but format it slightly differently from how it was

* minor fixes & adjustments

* update README to describe how this project is different from upstream, as well as how to build & run it from source code

* increase eth/pol timeouts some more

* add make l - a shortcut for make run

* fix typo in buy/sell order form event handlers

* adjust font size for fiat rate in the header (markets page)

* improve the way order buy/sell forms are initialized (also handling un-synced wallets better)

* wallets: better fit for fee estimates

* core: initialize with retries (tolerating failure to connect to DEX server on startup on the very first try)

* poke notes: remove redundant info

* wallets: make sense of fiat price displayed on wallets view

* slider adjustments to account for some edge cases
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.

1 participant