-
Notifications
You must be signed in to change notification settings - Fork 298
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
[DTRA] Kate/Maryia/DTRA-1279/Redesign: Positions page #15234
[DTRA] Kate/Maryia/DTRA-1279/Redesign: Positions page #15234
Conversation
….com:kate-deriv/deriv-app into maryia/positions_redesign/tabs-and-empty-pages
…bs-and-empty-pages Maryia/positions-redesign/Tabs + background + initialized EmptyMessage component
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
A production App ID was automatically generated for this PR. (log)
Click here to copy & paste above information.
|
🚨 Lighthouse report for the changes in this PR:
Lighthouse ran with https://deriv-app-git-fork-kate-deriv-maryia-katedtra-1279redesi-fc452e.binary.sx/ |
…50) * feat: redirect to trade upon button click on the empty page * test: EmptyMessage
…b + make redirectTo prop optional in ContractCard (#79) * fix: place loading after contract cards sections * chore: make redirection optional when clicking on contract card
* feat: add partial range * refactor: tests * refactor: callback
…te/DTRA-1279/redesign_position_page
…te/DTRA-1279/redesign_position_page
Quality Gate passedIssues Measures |
⏳ Generating Lighthouse report... |
Changes:
- To add Positions page for DTrader Redesign
Detailed specs:
<PositionsContent />
:This is the content for Open and Closed tabs which differs based on the value of
isClosedTab
prop.Elements
:Filters. It's displayed only if a user has any positions:
<ContractTypeFilter/>
,<ContractTypeFilter/>
and<TimeFilter/>
.NOTE:
PositionContent
with the help offilterPositions()
from/AppV2/Utils
.handleDateChange
method that callsprofit_table
API fromProfitTableStore
.useTradeTypeFilter
hook returnscontractTypeFilter
based on the selected tab, which means that filters work independently in each tab.Total profit loss:
<TotalProfitLoss />
is always rendered together with the list of contract cards.Contract cards:
<ContractCardList />
,<ContractCardsSections />
, which adds date separators to<ContractCardList />
because in Closed tab we need to group cards based on their purchase dates.Empty page placeholder:
<EmptyPositions />
is rendered if the user has no positions.Loading:
<Loading />
is rendered while positions are being loaded, i.e. when it's still unknown whether or not the user has any positions and which content we need to show:<EmptyPositions />
or Contract cards.Positions data
:Positions are used as
filteredPositions
based on various initial data depending on a selected tab, and after filtration if applicable:- Open tab:
active_positions
taken fromPortfolioStore
,- Closed tab:
closedPositions
mapped based on data fromProfitTableStore
.<ContractTypeFilter />
:Its purpose is to detect options selected by a user and to pass them to a parent via
setContractTypeFilter
callback.The component's structure is based on
<Chip />
and<ActionSheet/>
, which contains<Checkboxes/>
.Default checked options are provided by
contractTypeFilter
prop, and the list of all options is taken fromavailableContracts
, which is temporarily hardcoded and supposed to be based on the contracts that are actually available for a user instead.When a user checks some options, they will be stored in the component's state until the moment when the user clicks 'Apply'.
When 'Apply' is clicked, an array with the chosen options gets passed to a parent via
setContractTypeFilter
callback for 2 purposes:1. to set the filter value into
PositionsStore
;2. to be used to filter positions in
PositionsContent
.<TimeFilter />
:Its purpose is to detect a newly selected time option and set it in the
PositionsStore
, so thatprofit_table
API call returns filtered positions from BE side.The component's structure is based on
<Chip />
,<ActionSheet/>
, which contains<RadioGroup/>
, andDateRangePicker
(calendar fromQuill UI
).A user can select one option from
RadioButtons
, which are rendered based on thetimeFilterList
array, or pick a custom date range from theDateRangePicker
.A selected option will be set to the
PositionsStore
viasetTimeFilter
or viasetCustomTimeRangeFilter
, and passed tohandleDateChange
for BE filtration.By clicking on 'Reset' button, a user can remove all time filters: time filters in the
PositionsStore
will be replaced with empty strings, andprofit_table
API will be called for all closed contracts.<ContractCard />
:Displays contract data.
It can have Action Buttons:
- Open tab: a card has action buttons (
Close
, orCancel
&Close
) that get revealed when a user swipes to the left on the card,- Closed tab: a card has no action buttons since the positions can no longer be closed.
<ContractCardList />
:It can have Buttons Demo:
- Open tab: on the first opening of the Open tab, the list of cards has a demo, i.e. animation that quickly reveals and hides action buttons on the first card on the list, so that a user is aware of their availability.
- Closed tab: no demo since there are no action buttons.
Screenshots:
Test coverage
:IMPORTANT NOTICE:
This page is subject to improvement.
Edge cases, e.g. forward starting contracts handling, dark theme, etc. are not part of this PR.
Further improvements to UI and behavior will be done moving forward.
This PR can be considered as an initial implementation.