Skip to content

Conversation

@kate-deriv
Copy link
Contributor

@kate-deriv kate-deriv commented Mar 14, 2024

Changes:

  • Refactored filtration logic for contract cards in Recent Positions. Now we are not showing unsupported contracts (currently the only unsupported contracts are CALLSPREAD/Spread Up and PUTSPREAD/Spread Down which are not available at all our platforms) and forward starting contracts, which haven't started yet. Forward starting contracts, which already HAVE started, are shown.
  • Created 2 functions-helpers, which checked if contract has started or not. First one, hasContractStarted is based on contract_info fields (it's comparing current_spot_time and date_start) and used in such places as position-drawer-card, position-drawer, open-positions. Second one, hasForwardContractStarted function accepts shortcode, extracting start_time from shortcode and compare with Date.now(). Is used in statement, because there we have no access to contract_info.
  • Refactored toggling function for Open Positions and Statement: notification will disappear in 5 sec .
  • Refactored Open Positions: for forward starting contracts, which haven't started yet, added new text notification. For started ones enabled Contract Details Page.
  • Refactored Trade Table: hided ongoing forward starting contracts and shown only closed ones. For the last ones enabled Contract Details Page.
  • Refactored Statement: for forward starting contracts, which haven't started yet, added new text notification. For started ones enabled Contract Details Page.
  • Removed unused logic.
  • Refactor tests and add new ones.

Screenshots:

Screenshot 2024-03-15 at 4 34 37 PM Screenshot 2024-03-14 at 4 51 33 PM Screenshot 2024-03-14 at 4 52 46 PM Screenshot 2024-03-14 at 4 52 55 PM

@vercel
Copy link

vercel bot commented Mar 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
deriv-app ✅ Ready (Inspect) Visit Preview Mar 22, 2024 0:36am

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2024

A production App ID was automatically generated for this PR. (log)

Click here to copy & paste above information.
- **PR**: [https://github.com/binary-com/deriv-app/pull/14181](https://github.com/binary-com/deriv-app/pull/14181)
- **URLs**:
    - **w/ App ID + Server**: https://deriv-app-git-fork-kate-deriv-kate-dtra-934forwardstarti-07af52.binary.sx?qa_server=red.derivws.com&app_id=32925
    - **Original**: https://deriv-app-git-fork-kate-deriv-kate-dtra-934forwardstarti-07af52.binary.sx
- **App ID**: `32925`

@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2024

🚨 Lighthouse report for the changes in this PR:

Category Score
🔺 Performance 27
🟢 Accessibility 90
🟢 Best practices 92
🟧 SEO 81
🟧 PWA 78

Lighthouse ran with https://deriv-app-git-fork-kate-deriv-kate-dtra-934forwardstarti-07af52.binary.sx/

@coveralls
Copy link

coveralls commented Mar 14, 2024

Coverage Status

coverage: 38.73% (-0.4%) from 39.179%
when pulling e733e6e on kate-deriv:kate/DTRA-934/forward_starting_contract
into eb95584 on binary-com:master.

maryia-deriv
maryia-deriv previously approved these changes Mar 20, 2024
maryia-deriv
maryia-deriv previously approved these changes Mar 20, 2024
isForwardStartingBuyTransaction(
row.action_type,
row.shortcode,
row.purchase_time || row.transaction_time
Copy link
Contributor

@maryia-deriv maryia-deriv Mar 21, 2024

Choose a reason for hiding this comment

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

Can we pass a single row param and destructure/use the properties we need inside isForwardStartingBuyTransaction? :)
same in data-table.tsx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But row object has a lot of fields, a we need only 3. What are the benefits of passing all object? Moreover, in that case it won't be obvious which exactly information do we need

const contract_type = extractInfoFromShortcode(row_obj.shortcode)?.category?.toUpperCase();
const unsupportedContractConfig = getUnsupportedContracts()[contract_type as TUnsupportedContractType];
const shouldShowForwardStartingNotification =
isForwardStarting(row_obj.shortcode, row_obj.purchase_time || row_obj.transaction_time) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we pass a single row_obj param to isForwardStarting and take all necessary properties from it inside isForwardStarting? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please, refer to answer #14181 (comment)

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed

Issues
4 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@github-actions
Copy link
Contributor

Generating Lighthouse report...

@balakrishna-deriv balakrishna-deriv merged commit cd6d05b into deriv-com:master Mar 26, 2024
Dhruv-deriv pushed a commit to Dhruv-deriv/deriv-app that referenced this pull request Mar 26, 2024
…trader (deriv-com#14181)

* feat: enable forward starting contracts on descktop and modify filtration in recen positions

* feat: add filtration for mobiile recent positions and refactor failing tests

* refactor: comments

* refactor: modify checking function

* refactor: rename function

* refactor: improve type of function arguments

* refactor: add tests and remove codesmells

* refactor: add timer for hidding notification

* refactor: remove code smells

* refactor: remove unused code

* refactor: fix failing test

* refactor: extract logic into the hook

* chore: rename and remove extra spaces

* refactor: extract duplictaed filtration logic

* fix: allow display of manually sold forward contract before starting

* refactor: add tests for new function

* refactor: apply suggestions regarding destructurization

* refactor: apply suggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants