Skip to content

Commit

Permalink
p2p/Floating rate feature (binary-com#5494)
Browse files Browse the repository at this point in the history
* Merge branch 'binary-com:master' into floating_rate (binary-com#5080)

* Nijil / DBot - Add multipliers (binary-com#4172)

* Retrigger vercel deployment

* Init dbot multiplier

* Fix es-lint issues

* Add contract update dialog validations

* logic added to hasAllRequiredBlocks for multipliers

* Fix es-lint errors

* Update stop loss block description and label

* Filter out multipliers in quick-strategy

* Fix incorrect rendering of duration/multiplier blocks on workspace when they're dragged out from toolbox

* Fix typos

* Add missing proptypes and other minor refactors

* Fix minor issues + logic

* Fix: trade option block not changing according to the selected trade type once it is dragged to workspace first and then plugged to the trade parameters block

* Fix: Disable trade option block when plugged inside trade parameters

* Remove connection to next statement in trade_defintion_restartonerror block

* Make multiplier_stop_loss and multiplier_take_profit independant blocks + other UX improvement

Description \n1.Make multiplier_stop_loss and multiplier_take_profit input field shadow blocks.  \n2. Add check such that duplicate multiplier_take_profit and multiplier_stop_loss cannot be added to trade_definition_multiplier block. \n3.Show amount limits in trade_definition_multiplier block.

* Cleanup workspace when switching between multiplier and other trade options

* Remove extensice validation for multiplier_stop_loss block

* Show dialog for multiplier contract on stop button click + minor cleanups

* Update stop multiplier dialog content

* Update stop multiplier dialog content and button actions

* Minor bug fix

* Fix stop multiplier dialog buttons styling

* fix: multiplier contract not bought even after disabling TP/SL block inside multiiplier block

* Disable stray blocks and their optional children recursively

* fix: recover all pending transactions on page refresh or if client left page mid-contract

* Restrict TP/SL blocks to multiplier block + add close button logic for dialog component

* Fix profit not showing when it's zero

* Add condition for restricted blocks to enable/disable stack option in context menu

* Optimised proposal_open_contract call on mount of transaction tab

* fix es-lint error

* Update logic for recovering open contracts

* Fix no-unused-vars error

* Refactor code for readability

* Refactor code for readability

* Add logic to handle action of reset button in toolbar

* Remove condition where it enabled the button in run panel while the contract is still closing

* Fix default-case expected test error

* Add note for multiplier block

* Add condition to disable run panel button when multiplier contract is closing

* Fix issue where connectWithContractUpdate tried to destructure undefined at first render

* Add Learn more help content for multiplier trade option block

* Minor change in toggle-card-dialog.jsx file

* Refractored help-content from bot-skeleton to bot-web-ui package and updated help content for multiplier trade option block

* Fix missing key prop error

* Minor change in fix where connectWithContractUpdate tried to destructure undefined

* Show banner for bot MF Real & VRTC

Co-authored-by: Matin shafiei <70938039+matin-binary@users.noreply.github.com>
Co-authored-by: Salar Hafezi <salar@re-work.dev>
Co-authored-by: Matin shafiei <matin@binary.com>

* Hirad/Cfd reset password modal js to ts (binary-com#4706)

* Changed cfd-reset-password-modal container from js to ts

* fix--Auto styling is done on the components

* fix--Separated types from component

* fix--Auto styling is done on the components

* fix--Added a separate type for errors and Changed the type of current_list

* Auto styling is done on the components

* fix--Used Record utility type to improve readability

* fix--Removed redundant imports and duplicate types

* Pulled the latest changes from master

* fix--Replaced ReactElement with ReactNode

* Pulled from master

* Made some changes to pass the tests

* fix--Changed ReactNode to ReactElement to pass the tests

* fix--Shortened one of the types

* Fixed the conflicts

Co-authored-by: Matin shafiei <matin@binary.com>

* Chore: Added NIN option in IDV dropdown for ng clients (binary-com#4970)

* fix: payment info issue (binary-com#4978)

Co-authored-by: Matin shafiei <matin@binary.com>

* Bala/Cleanup dashboard (binary-com#4967)

* refactor: change folder name to appstore

* chore: cleanup dashboard svgs

* refactor: rename to appstore

* remove separate build for dashboard

* refactor: rename to appstore

* cleanup build

* remove appstore assets

* fix: api-types auto generation

* chore: cleanup dashboard

* chore: cleanup appstore build

* chore: fix appstore main file path

* chore: use consistent configs

* chore: refactor store usage to be consistent

* chore: cleanup dist and routes

* chore: remove old routes config

* cleanup routes config

* setup trading-hub path

* cleanup asset_path

* cleanup redirects

* fix ts lint issues

* fix lint issues

* fix lint issue

* fix test issues

* update tsconfig path

* update codeowners

* chore: added a space

* Update README.md

Co-authored-by: Matin shafiei <matin@binary.com>

* Maryia/TrackJS_Avoiding_Pushwoosh_Failed_to_fetch_error (binary-com#4894)

* Maryia/Checking network status before initializing Pushwoosh

* Maryia/refactoring

Co-authored-by: Matin shafiei <matin@binary.com>

* translations: 📚 sync translations with crowdin (binary-com#4987)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* salar / Hotfix/multiplier eu (binary-com#4989)

* Add helper function for EU countries

* Show digital options banner to VRTC-only EU clients

* Add comment to remove duplicate code

* Fix: apply more compliance conditions

* Fix issue for EU residence

* Apply prettier

* Fix mobx issue for residence

* Fix: prevent calls on undefined

* Fix: check for blockly div first

* Apply prettier

* export_components_which_needed_to_be_used_in_app_store (binary-com#4972)

* refactor_payment_agent_component_for_app_store (binary-com#4968)

* translations: 📚 sync translations with crowdin (binary-com#5005)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* refactor: investor password (binary-com#4992)

* Nuri/Refactor: Refactor compare account (binary-com#4969)

* refactor compare account

* retrigger circleci

* retrigger deployment

* removed unused text

* likhith/OrderConfirmCompleted error status displayed on slow n/w (binary-com#4832)

* Resolved: #56123 - OrderConfirmCompleted error status displayed on slow n/w

* Refactored code

* Fixed lint errors

* implemented review comment

* Resolved eslint issues

* Resolved Console.log error

* Added comments to changes

* Resolved lint errors

* Removed unwanted component

* fix storybook build (binary-com#4997)

* MaryiaF/fix: TrackJS error - i.resetVirtualBalance is not a function (binary-com#4892)

* MaryiaF/fix: TrackJS error - i.resetVirtualBalance is not a function

* MaryiaF/fix: TrackJS error - i.resetVirtualBalance is not a function

* Maryia/Fix for styles of POI & POA steps in Settings and CFD modals (binary-com#4761)

* Maryia/fixed styles of poa upload block

* Maryia/fixed cfd poa modal for responsive mode

* Maryia/fix for POI step style in CFD modal

* Maryia/fixed style of upload criteria in CFD modal POA step

* Maryia/refactoring as per deriv app code standard

* Maryia/replaced px with rem

* Maryia/fix for the upload box style requiring nesting inside list

* Maryia/fixed POI styles

* Hirad/Cfd dashboard container JS to TS (binary-com#4941)

* Changed cfd-dashboard container from javascript to typescript

* fix--Fixed the default export of the cfd-dashboard

* Pulled from master

* fix--Invisible tab menu should be fixed

* Auto styling is done

* IDV notification changes and refactoring (binary-com#5001)

* Akmal / Add trustpilot notification (binary-com#4974)

* Add trustpilot notification

* Fix formatting

* Add undefined check

* Vijayasree/Manage Account modal from Cashier Onboarding links are broken on iphoneSE (binary-com#4948)

* Manage Account modal from Cashier Onboarding links are broken on iphone SE

* Manage Account modal from Cashier Onboarding links are broken on iphone SE

* Manage Account modal from Cashier Onboarding links are broken on iphoneSE

* Update account-wizard.scss

Co-authored-by: Matin shafiei <matin@binary.com>

* likhith/Added jest config and test cases for App-Content component (binary-com#4876)

* Added jest config and test cases for App-Content component

* Added test cases for App Content component

* Fixed lint errors

* Removed lint errors and configured webpack

* Reordered webpack extension array

* Implemented review comments

* implemented review comments

* george / added test for "PaymentAgentList" component (binary-com#4825)

* added test for "PaymentAgentList" component

* fixed a spelling error

* refactored code, changed query method

* code refactoring

* george / added tests for OnRampProviderCard (binary-com#4880)

* added tests for OnRampProviderCard

* code refactoring (add data-testid into Icon component)

* naming refactoring data-testid

* naming refactoring

* add new prop (data_testid) to Icon component

* code refactoring using icon prop data_testid

* add prop types for data_testid

* likhith/Removed unused functions from Cashier container and added test cases (binary-com#4821)

* likhith/added testcases to cashier-container

* added loader check test case

* Variable change

* Fixed variable scoping

* Refactored code inline with  naming conventions

* Removed code smells

* Improved code visibility

* Removed unused functionality in CashierComponent

* Removed unused imports

* Removed unused property and improved test cases

* modified input data

* Incorporated review comments

* Incorporated review comments

* Added test cases to order and order-table (binary-com#4916)

* fix test cases because of refactoring the component (binary-com#5029)

* Nijil/Pass correct value to SelectNative value prop from PA dropdown (binary-com#5034)

* fix: pass correct value to SelectNative value prop

* minor refactor

* translations: 📚 sync translations with crowdin (binary-com#5039)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* MaryiaF/fix: bold the menu option when the user has gone by the child… (binary-com#4965)

* MaryiaF/fix: bold the menu option when the user has gone by the child menu items and then navigated one of them to the corresponding page

* MaryiaF/refactor:  solution with switching to the bold menu item

* MaryiaF/chore: revert intent

* MaryiaF/refactor: use Text component instead of spane in toggle-menu-drawer file

* MaryiaF/refactor: remove unuseful  style and change import

* Merge branch 'master' of github.com:binary-com/deriv-app into 57685_2

* MaryiaF/fix: all the sub menus are not supposed to be in bold in first visit, 1 of the sub menu should be bold during the visit

* MaryiaF/fix: condition when the menu item should be bold

* MaryiaF/fix: remove console.log

* Revert "Merge branch 'master' of github.com:binary-com/deriv-app into 57685_2"

This reverts commit 2c19bed.

Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>

* <SearchBox /> test coverage (binary-com#4900)

Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>

* Artsem / <Verification /> test coverage (binary-com#4890)

* <Verification /> test coverage

* remove redundant import

* fix testid naming

* fix testid and elements naming

* remove redundant mockProps()

Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>

* Amina/test_coverage_for_poi-verified_component_in_account_package (binary-com#5006)

* poi-verified-spec

* poi-verified-spec

Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>

* Amina/test_coverage_for_poa_unverified_component_in_account_package (binary-com#4993)

* unverified-spec

* poa-unverified

Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>

* Amina/test coverage for poa-submitted (binary-com#4990)

* test_coverage_for_poa_submitted

* fix

Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>

* george / test coverage for "recent transaction" component (binary-com#4838)

* added tests for RecentTransaction component

* fixed condition for cashier transaction icon

* removed code duplication

* refactored code

* code refactoring (add data-testid into Item component)

* code refactoring

* naming refactoring data-testid

* naming refactoring

* add new prop (data_testid) to Icon component

* code refactoring using icon prop data_testid

* add prop types for data_testid

Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>

* translations: 📚 sync translations with crowdin (binary-com#5048)

Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>

* update branch with master (binary-com#5010)

* Maryia/Set notifications together with each handling of notifications (binary-com#4958)

* Maryia/Set notifications before each handling of notifications

* Maryia/style fix to fit in long FR, ES & PT text on the notification button

* Fix design for DMT5 investor password reset modal (binary-com#4942)

* Ako/ Codecov integration (binary-com#5053)

* build/ add test:ci script to run tests in the ci with different config

* ci/ add codecov github action

* ci/ workflow update

* ci/ update coverage path

* ci/ get coverage over all of the files

* ci/ get coverage on pull request

* Revert "build/ add test:ci script to run tests in the ci with different config"

This reverts commit 2771958.

* doc/ add codecov badge to readme file

* Vijayasree/Crypto icon in withdrawal page is not shown for specific device IOS (binary-com#4976)

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* re-trigger build

* re-trigger build

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Crypto icon in withdrawal page is not shown for specific device IOS

* Sara / Fixed issue with error handling (binary-com#4966)

* Fixed issue with error handling

* Removed extra code

* fixed issue with aggregation methods

* MaryiaF/chore: remove consoles (binary-com#5059)

* Matin/Add: TS files for translation extraction (binary-com#5073)

* remove appstore package from translations (binary-com#5075)

Co-authored-by: Matin shafiei <70938039+matin-binary@users.noreply.github.com>
Co-authored-by: Salar Hafezi <salar@re-work.dev>
Co-authored-by: Matin shafiei <matin@binary.com>
Co-authored-by: hirad-rewok <91878582+hirad-rewok@users.noreply.github.com>
Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>
Co-authored-by: balakrishna-binary <56330681+balakrishna-binary@users.noreply.github.com>
Co-authored-by: Maryia <87321516+maryia-deriv@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>
Co-authored-by: Salar Hafezi <76559464+salarhfz-fs@users.noreply.github.com>
Co-authored-by: Bahar <bahar@firstsource.tech>
Co-authored-by: njazuli-deriv <78890281+njazuli-deriv@users.noreply.github.com>
Co-authored-by: Likhith Kolayari <98398322+likhith-deriv@users.noreply.github.com>
Co-authored-by: Maryia Frantsava <88426229+maryiafrantsava-deriv@users.noreply.github.com>
Co-authored-by: Akmal Djumakhodjaev <akmal@binary.com>
Co-authored-by: vijayasree-deriv <98810931+vijayasree-deriv@users.noreply.github.com>
Co-authored-by: george-usynin-deriv <89790856+george-usynin-deriv@users.noreply.github.com>
Co-authored-by: Artsem Kavaleu <88381164+artsemkavaleu-deriv@users.noreply.github.com>
Co-authored-by: amina-deriv <84661147+amina-deriv@users.noreply.github.com>
Co-authored-by: Niloofar Sadeghi <93518187+niloo-fs@users.noreply.github.com>
Co-authored-by: mitra-fs <64970259+mitra-fs@users.noreply.github.com>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@firstsource.tech>
Co-authored-by: sara-fs <55442058+sara-fs@users.noreply.github.com>
Co-authored-by: Matin shafiei <matin@deriv.com>

* Revert "Merge branch 'binary-com:master' into floating_rate (binary-com#5080)" (binary-com#5081)

This reverts commit 725636b.

* Artsem / Floating rate banner and warning for existing ads (binary-com#4975)

* Add floating rate enable banner and warning icon

* remove extra function call

* remove deprecated conditions

* remove conditional render, add todo comment

* fix Localize settings

* likhith/Created Floating rate custom component (binary-com#4971)

* Created Floating rate custom component

* Removed hardcoded values

* Incorporated review comments

* Reordered functions as per style guide

* Replaced Css units

* Incorporated review comments

* Empty commit

* Minor bug fix

* Renamed functions appropriately

* Incorporated review comments

* Fetching floating rate status from const

* Resolved lint errors

* Incorporated review comments

* incoeporated review comments

* Added syles as per UX

* Added a comment to explian props

* Changed CSS as per BEM standard

* Changes naming conventions

* Implemented review comments

* Refactored code as per comments

* Fixed eslint errors

* Reverted the changes made

* Minor bug fixes

* Added currecnt_focus prop

* likhith/create floating-rate ad (binary-com#4964)

* Floating-rate Ui created

* Added validations to floating-rate component

* Implemented Floating rate component

* Added default values for floating rates based on ad type

* fixed lint issues

* Minor bug fixes

* Added store subscriptions

* Enhanced InputField component and added floating rate store

* Resolved lint errors

* Added changes for My Ad screen

* Added floate-rate

* Added exisiting user update

* Added reaction to my-ad store

* Edit form

* Added edit ad section

* Added switch rate modal

* Added switch ad dialog

* Added banner condition

* Added banner condition

* Empty commit

* Minor bug fixes

* Minor bug fixes

* removed console logs

* Incorporated API changes

* Incorporated review comments

* Removed duplication

* Integrated API with create floting rate ad

* Incorporated review comments

* Added floating rate error messages

* Resolved lint error

* Added styling as per UX

* Minor bug fix in create ad form

* Changes CSS as per BEM

* Resolved lint error

* Added current_focus to input field

* Minor bug fixes for Create ad

* Incorporated review comments

* Minor bug fix

* Removed empty structure

* Removed additional switch state

* Fixed issue with date banner

* Added test cases for Floating rate component

* Removed the empty element and replaced with null

* Incorporated the changes

* fixed incorrect file name

* Trigger Build

* Added as per naming

* Removed localize of 1

* Added review comments

* Incorporated changes

* Replaced string with constant

* Incorporated review comments

* Removed un-necessary div

* Removed css

* Renamed function

* Minor bug fixes and incorporated comments

* Added fallback

* alphabetize observables

* Replaced CSS for Ad status

* Resoled CSS and functionality bugs

* Fixed lint errors

* Resolved lint erros

* Incorporated review comments

* Reduced spacing between the banner

* Formatted user input

* Fixed failing test case

* Added comments to explain functionality

* Fetching date and time from server

* Renamed function

* Refactored code

* Added review comments

* Resolved decimal round off issue

* Fixed Rounding off of decimal digits

* Regex change in psoitive integer check

* Resolved issue with round off to decimal point

* Re-arranged imports

* Fixed the testcase

* Fixed floating_rate input check

* Removed Math.sign

* Reverted decimal change

* Implemented round of logic for decimal places

* refactor: Renamed variables

* fix: Round off issue in Create Ad summary

* fix: resolved decimal point to 2 digits

* Resolved lint errors

* fix: Renamed the function

* chore: Ad display table rate will be calculated from

* fix: test color in dark theme

* fix: label changes b/w fixed and floating

* fix: invoking api call to fetch the changes

* fix: rate synced b/w myads and buy/sell

* fix: range offset validation

* fix: modified rate property in edit ads

* fix: Float rate input suffix

* fix: code formatted

* fix: setting floating rate to 2 decimals on blur

* fix: spacing issue with floating rate input

* Trigger build

* Trigger build

* fix: removed unwanted padding

* fix: added ellipse to fix over lapping

* fix: removed disabling of floating rate field buttons

* fix: resolved issue with error message

* fix: Overlapping CSS issues in Mobile

* fix: added missing background color for dark theme

* fix: removed button highlight in mobile

* fix: button higlight issue

* fix: display of cursor pointer on scroll

* fix: resolved issue with message

* fix: Ad change warning message

* fix: color for dark mode

Co-authored-by: Likhith Kolayari <likhith@deriv.com>

* fix: conflict message not updated

* likhith/created edit my ad screen (binary-com#4988)

* Floating-rate Ui created

* Added validations to floating-rate component

* Implemented Floating rate component

* Added default values for floating rates based on ad type

* fixed lint issues

* Minor bug fixes

* Added store subscriptions

* Enhanced InputField component and added floating rate store

* Resolved lint errors

* Added changes for My Ad screen

* Added floate-rate

* Added exisiting user update

* Added reaction to my-ad store

* Edit form

* Added edit ad section

* Added switch rate modal

* Added switch ad dialog

* Added banner condition

* Added banner condition

* Empty commit

* Implemented edit ads for floating rates

* Inorporated review comment

* minor bug fixes

* Minor bug fixes

* Minor bug fixes

* removed console logs

* Added rae_type prop

* Incorporated API changes

* Incorporated API changes

* Incorporated review comments

* Removed duplication

* Integrated API with create floting rate ad

* Incorporated review comments

* Added floating rate error messages

* Resolved lint error

* Added styling as per UX

* Added styles as per UX

* Refactoring code

* Css changes to summary component

* Trigger Build

* Minor bug fix in Create Ad form

* Minor bug fix in create ad form

* Changes CSS as per BEM

* Resolved lint error

* Added current_focus to input field

* Minor bug fixes for Create ad

* Incorporated review comments

* Minor bug fix

* Removed empty structure

* Removed additional switch state

* Fixed issue with date banner

* Added test cases for Floating rate component

* Removed the empty element and replaced with null

* Incorporated the changes

* fixed incorrect file name

* Trigger Build

* Added as per naming

* Removed localize of 1

* Added review comments

* Incorporated changes

* Replaced string with constant

* Incorporated review comments

* Removed un-necessary div

* Removed css

* Renamed function

* Minor bug fixes and incorporated comments

* Added fallback

* alphabetize observables

* Replaced CSS for Ad status

* Migrated create ad comments to Edit ad

* Resolved lint errors

* Fixed lint issues

* Resoled CSS and functionality bugs

* Fixed lint errors

* Resolved lint erros

* Incorporated review comments

* Reduced spacing between the banner

* Formatted user input

* Fixed failing test case

* Added comments to explain functionality

* Fetching date and time from server

* Renamed function

* Refactored code

* Added review comments

* Resolved decimal round off issue

* Fixed Rounding off of decimal digits

* Added test case for create ad

* Regex change in psoitive integer check

* Added test case to test form values

* Resolved decimal round off issue

* Added test acss to edit form

* Resolved lint errors

* Resolved issue with round off to decimal point

* Re-arranged imports

* Fixed the testcase

* Removed unused imports

* Fixed floating_rate input check

* Removed Math.sign

* Reverted decimal change

* Implemented round of logic for decimal places

* refactor: Renamed variables

* refactor: Added fallback condition

* fix: added a exchange rate fallback condition

* fix: Round off issue in Create Ad summary

* fix: resolved decimal point to 2 digits

* Resolved lint errors

* fix: Renamed the function

* chore: Ad display table rate will be calculated from

* fix: test color in dark theme

* fix: label changes b/w fixed and floating

* fix: invoking api call to fetch the changes

* fix: rate synced b/w myads and buy/sell

* fix: range offset validation

* fix: modified rate property in edit ads

* fix: Float rate input suffix

* fix: code formatted

* fix: setting floating rate to 2 decimals on blur

* fix: spacing issue with floating rate input

* Trigger build

* Trigger build

* fix: removed unwanted padding

* fix: added ellipse to fix over lapping

* incorporated changes

* fix: removed disabling of floating rate field buttons

* fix: resolved issue with error message

* fix: Overlapping CSS issues in Mobile

* fix: added missing background color for dark theme

* fix: removed button highlight in mobile

* fix: button higlight issue

* fix: display of cursor pointer on scroll

* fix: resolved issue with message

* fix: modified display of summary in edit ad component

* fix: removed spec code

* fix: Removed test cases

* chore: reverted old commit

* feat: Added banner for switch rate

* fix: Error message text

* fix: incorporated review comments

* fix: removed unwanted store condition and added subscription to exchange rates

* fix: removed incorrect function call

* fix: added a null check

* fix: refactored code

* ref: Added comments

* ref: Refactored code for performance

* ref: refactored code

* ref: code refactor

* ref: Incorporated review comments

* Trigger Build

* fix: removed fixed size

* fix: resolved conflict

* fix: moved functionality from component to store

* fix: removed unnecessary commenting

* ref: renamed cancel action functions

* ref: refactored code for increated readability

* feat: implemented a function for removing trailing zeros

* ref: refactored the code in edit ad summary

* fix: reverted decimal round off rules

* fix: resolved issue with resetting selected Ad id

* fix: switching ad types in edit

* fix: issue with edit ad switch

* fix: display rate change dialog even when ads are deactivated

* fix: disabled activate ad when past date is passed

* fix: displaying error message based on the required ad type

* fix: banner glitch occurs when data loaded in chunks

* fix: enable ads after switch update

* fix: Form should not be checked for value change when ad switch is triggered

* fix: test to incorporate sign

* fix: implemented dynamic type for field in mobile

* fix: added css to fix disable styling

* fix: enforcing disable bg color for popover

* fix: responsive view of switch ad modal

* fix: added missing theme color for dark mode

* fix: banner width consistancy

* fix: incorporated touched state for Payment method

Co-authored-by: Likhith Kolayari <likhith@deriv.com>

* likhith/Feature  buy sell confirmation (binary-com#5487)

* Floating-rate Ui created

* Added validations to floating-rate component

* Implemented Floating rate component

* Added default values for floating rates based on ad type

* fixed lint issues

* Minor bug fixes

* Added store subscriptions

* Enhanced InputField component and added floating rate store

* Resolved lint errors

* Added changes for My Ad screen

* Added floate-rate

* Added exisiting user update

* Added reaction to my-ad store

* Edit form

* Added edit ad section

* Added switch rate modal

* Added switch ad dialog

* Added banner condition

* Added banner condition

* Empty commit

* Minor bug fixes

* Minor bug fixes

* removed console logs

* Incorporated API changes

* Incorporated review comments

* Removed duplication

* Integrated API with create floting rate ad

* Incorporated review comments

* Added floating rate error messages

* Resolved lint error

* Added styling as per UX

* Minor bug fix in create ad form

* Changes CSS as per BEM

* Resolved lint error

* Added current_focus to input field

* Minor bug fixes for Create ad

* Incorporated review comments

* Minor bug fix

* Removed empty structure

* Removed additional switch state

* Fixed issue with date banner

* Added test cases for Floating rate component

* Removed the empty element and replaced with null

* Incorporated the changes

* fixed incorrect file name

* Trigger Build

* Added as per naming

* Removed localize of 1

* Added review comments

* Incorporated changes

* Replaced string with constant

* Incorporated review comments

* Removed un-necessary div

* Removed css

* Renamed function

* Minor bug fixes and incorporated comments

* Added fallback

* alphabetize observables

* Replaced CSS for Ad status

* Resoled CSS and functionality bugs

* Fixed lint errors

* Resolved lint erros

* Incorporated review comments

* Reduced spacing between the banner

* Formatted user input

* Fixed failing test case

* Added comments to explain functionality

* Fetching date and time from server

* Renamed function

* Refactored code

* Added review comments

* Resolved decimal round off issue

* Fixed Rounding off of decimal digits

* Regex change in psoitive integer check

* Resolved issue with round off to decimal point

* Re-arranged imports

* Fixed the testcase

* Fixed floating_rate input check

* Removed Math.sign

* Reverted decimal change

* Implemented round of logic for decimal places

* refactor: Renamed variables

* fix: Round off issue in Create Ad summary

* fix: resolved decimal point to 2 digits

* Resolved lint errors

* fix: Renamed the function

* chore: Ad display table rate will be calculated from

* fix: test color in dark theme

* fix: label changes b/w fixed and floating

* fix: invoking api call to fetch the changes

* fix: rate synced b/w myads and buy/sell

* fix: range offset validation

* fix: modified rate property in edit ads

* fix: Float rate input suffix

* fix: code formatted

* fix: setting floating rate to 2 decimals on blur

* fix: spacing issue with floating rate input

* Trigger build

* Trigger build

* fix: removed unwanted padding

* fix: added ellipse to fix over lapping

* fix: removed disabling of floating rate field buttons

* fix: resolved issue with error message

* feat: Implemented floating rate for buy/sell

* fix: Overlapping CSS issues in Mobile

* fix: added missing background color for dark theme

* fix: removed button highlight in mobile

* fix: button higlight issue

* fix: display of cursor pointer on scroll

* fix: resolved issue with message

* fix: color for dark mode

* fix: buy/sell modal styling

* fix: render data in accordian

* feat: incorporated expand all accordian

* feat: Implemented Expand & Collapse all feature

* ref: code refactor

* fix: removed console errors

* fix: removed unused prop

* fix: incorporated review comments

* fix: incorporated review comments

* fix: incorporated Expamd all button

* fix: incorrect prop name in accordion component

* fix: incorporated review comments

* ref: Removed code duplication

* ref: refactored the code

* fix: changes px to rem

* fix: incorporated rate change error dialog

* fix: removed unwanted CSS

* fix: renamed porptype in Rate Change modal

* ref: code refactored

* ref:  rate change modal code refactored

* ref: Refactored code

* fix: css issues related to buy-sell dialog

* fix: fixed failing test cases

* fix: Added a error code check to display appropriate popups

* fix: CSS inssues in Buy-sell modal

* fix: css issue of error hintbox

* fix: resolved issue with rounding digit in receive amount

* fix: blocking order creation when balance is low

* fix: css changes to fix disabling form

* fix: modal condition to display low balance

* fix: blocking user from entering value more than balance

* fix: display Form error messages in footer and account balance error in banner

* fix: resolved lint errors

* ref: changed the TODO comment

* ref: fixed the comment

* fix: incorporated subscribeWS method

* fix: resolved failing testcase issue

* fix: removed commented code

* fix: display of incorrect efective rate

* fix: decimal round off

* fix: navigation to buy/sell table when try again is clicked

* fix: buy/sell order dialog title to match the design

* fix: css issues in buy/sell

* fix: design mismatch in order confiormation dialog

* ref: Refactored code to reuse functionality

* fix: removed commented code

* fix: market change update in Advertiser section

* fix: re-render on balance change

* fix: disabling fields when balance is low

* fix: expand/collapse issue

* fix: resolved issue with expand and collapse

* fix: restricted rate input to 8 characters

* fix: resolved console error

* fix: file name

* fix: fixed failing test case

* fix: added order input check against account balance

* fix: css issues in add payment method in buy-sell form

* fix: validation of sell order

* fix: currency format of balance

* fix: re-establish n/w connection on reload

* ref: Incorporated safety null check

* fix: moved low balance banner display to be handled by state

Co-authored-by: Likhith Kolayari <likhith@deriv.com>

* farrah/ removed payment method banner in p2p (binary-com#5755)

* removed transaction time and payment method banners

* removed setting of missing payment methods

* reverted removal of reduced transaction time banner

* likhith/incorporated market rate calculation with 6 decimals (binary-com#5770)

* feat: incorporated market rate calculation with 6 decimals

* ref: refactored code to generate effective rate

* ref: removed commented code

* fix: round off decimal calculation of effective market rate

* fix: formatting decimals in effective rate

* fix: set the form to be dirty when PM is selected

* fix: checking for change when PM methods are modified

* fix: enable button for edit ad

* fix: enabling submit method for buy ads

* fix: decimal round off issue in buy-sell

* fix: display min of 2 decimal points

* fix: displying initial value of buy-sell ad

* Trigger build

* fix: removed unnecessary spacing

* Trigger build

* fix: effective rate round off in Buy/sell

* Trigger build

* fix: setting correct ad type

* fix: display order rate amount

* fix: removed formatted text usage

* fix: removed incorrect round off

* fix: sunc effective_rate calculation b/w FE & BE (binary-com#5910)

* fixed order table row spacing (binary-com#5900)

* fixed post ad button (binary-com#5912)

* farrah/ update received amount if rate has changed (binary-com#5911)

* fixed received amount when rate has changed

* refactor code

* formatted received amount (binary-com#5913)

* farrah/ fixed input amount validation on buy/sell form (binary-com#5928)

* fixed input amount validation

* refactor code

* disabled edit button for temporary banned users (binary-com#5926)

* Remove duplicate setRemount entry

* farrah/ fixed overlapping status in order page (binary-com#5950)

* fixed overlapping status in order page

* refactor code

* farrah/ fixed buy and sell form spacing (binary-com#5899)

* fixed buy and sell form spacing

* fixed banner spacing

* fixed banner spacing in mobile

* fixed spacing on responsive

Co-authored-by: Matin shafiei <70938039+matin-binary@users.noreply.github.com>
Co-authored-by: Salar Hafezi <salar@re-work.dev>
Co-authored-by: Matin shafiei <matin@binary.com>
Co-authored-by: hirad-rewok <91878582+hirad-rewok@users.noreply.github.com>
Co-authored-by: Carol Sachdeva <58209918+carol-binary@users.noreply.github.com>
Co-authored-by: balakrishna-binary <56330681+balakrishna-binary@users.noreply.github.com>
Co-authored-by: Maryia <87321516+maryia-deriv@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com>
Co-authored-by: Salar Hafezi <76559464+salarhfz-fs@users.noreply.github.com>
Co-authored-by: Bahar <bahar@firstsource.tech>
Co-authored-by: njazuli-deriv <78890281+njazuli-deriv@users.noreply.github.com>
Co-authored-by: Likhith Kolayari <98398322+likhith-deriv@users.noreply.github.com>
Co-authored-by: Maryia Frantsava <88426229+maryiafrantsava-deriv@users.noreply.github.com>
Co-authored-by: Akmal Djumakhodjaev <akmal@binary.com>
Co-authored-by: vijayasree-deriv <98810931+vijayasree-deriv@users.noreply.github.com>
Co-authored-by: george-usynin-deriv <89790856+george-usynin-deriv@users.noreply.github.com>
Co-authored-by: Artsem Kavaleu <88381164+artsemkavaleu-deriv@users.noreply.github.com>
Co-authored-by: amina-deriv <84661147+amina-deriv@users.noreply.github.com>
Co-authored-by: Niloofar Sadeghi <93518187+niloo-fs@users.noreply.github.com>
Co-authored-by: mitra-fs <64970259+mitra-fs@users.noreply.github.com>
Co-authored-by: Ali(Ako) Hosseini <ali.hosseini@firstsource.tech>
Co-authored-by: sara-fs <55442058+sara-fs@users.noreply.github.com>
Co-authored-by: Matin shafiei <matin@deriv.com>
Co-authored-by: Likhith Kolayari <likhith@deriv.com>
Co-authored-by: Farrah Mae Ochoa <82315152+farrah-deriv@users.noreply.github.com>
  • Loading branch information
27 people authored and ashrafali-v committed Jul 28, 2022
1 parent 8cc9821 commit 7a7c7ba
Show file tree
Hide file tree
Showing 62 changed files with 2,699 additions and 1,072 deletions.
12 changes: 12 additions & 0 deletions packages/cashier/src/pages/p2p-cashier/p2p-cashier.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { get, init, timePromise } from '_common/server_time';
/* P2P will use the same websocket connection as Deriv/Binary, we need to pass it as a prop */
const P2PCashier = ({
currency,
current_focus,
history,
is_dark_mode_on,
is_logging_in,
Expand All @@ -22,6 +23,8 @@ const P2PCashier = ({
platform,
residence,
setNotificationCount,
setCurrentFocus,
balance,
setOnRemount,
}) => {
const [order_id, setOrderId] = React.useState(null);
Expand Down Expand Up @@ -75,6 +78,7 @@ const P2PCashier = ({
return (
<P2P
client={{ currency, local_currency_config, is_virtual, residence, loginid }}
balance={balance}
history={history}
is_dark_mode_on={is_dark_mode_on}
is_mobile={is_mobile}
Expand All @@ -89,12 +93,16 @@ const P2PCashier = ({
setOrderId={setQueryOrder}
should_show_verification={/verification/.test(location.hash)}
websocket_api={WS}
current_focus={current_focus}
setCurrentFocus={setCurrentFocus}
/>
);
};

P2PCashier.propTypes = {
balance: PropTypes.string,
currency: PropTypes.string,
current_focus: PropTypes.string,
history: PropTypes.object,
is_dark_mode_on: PropTypes.bool,
is_logging_in: PropTypes.bool,
Expand All @@ -106,10 +114,12 @@ P2PCashier.propTypes = {
platform: PropTypes.any,
residence: PropTypes.string,
setNotificationCount: PropTypes.func,
setCurrentFocus: PropTypes.func,
};

export default withRouter(
connect(({ client, common, modules, ui }) => ({
balance: client.balance,
currency: client.currency,
local_currency_config: client.local_currency_config,
loginid: client.loginid,
Expand All @@ -121,5 +131,7 @@ export default withRouter(
setNotificationCount: modules.cashier.general_store.setNotificationCount,
setOnRemount: modules.cashier.general_store.setOnRemount,
is_mobile: ui.is_mobile,
setCurrentFocus: ui.setCurrentFocus,
current_focus: ui.current_focus,
}))(P2PCashier)
);
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const IncrementButtons = ({
min_is_disabled,
is_incrementable_on_long_press,
onLongPressEnd,
type,
}) => {
const interval_ref = React.useRef();
const timeout_ref = React.useRef();
Expand Down Expand Up @@ -56,6 +57,7 @@ const IncrementButtons = ({
onClick={incrementValue}
tabIndex='-1'
aria-label={'Increment value'}
type={type}
{...getPressEvents(incrementValue)}
>
<Icon
Expand All @@ -71,6 +73,7 @@ const IncrementButtons = ({
onClick={decrementValue}
tabIndex='-1'
aria-label={'Decrement value'}
type={type}
{...getPressEvents(decrementValue)}
>
<Icon
Expand All @@ -91,6 +94,7 @@ IncrementButtons.propTypes = {
is_incrementable_on_long_press: PropTypes.bool,
max_is_disabled: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
min_is_disabled: PropTypes.oneOfType([PropTypes.number, PropTypes.bool]),
type: PropTypes.string,
};

export default IncrementButtons;
59 changes: 42 additions & 17 deletions packages/components/src/components/input-field/input-field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ const InputField = ({
ariaLabel,
checked,
className,
classNameDynamicSuffix,
classNameInlinePrefix,
classNameInput,
classNamePrefix,
classNameWrapper,
currency,
current_focus,
data_tip,
data_value,
decimal_point_change,
error_messages,
error_message_alignment,
fractional_digits,
Expand All @@ -37,12 +40,14 @@ const InputField = ({
is_signed = false,
is_unit_at_right = false,
inputmode,
increment_button_type,
label,
max_length,
max_value,
min_value,
name,
format,
onBlur,
onChange,
onClick,
onClickInputWrapper,
Expand All @@ -53,9 +58,9 @@ const InputField = ({
type,
unit,
value,
data_testid,
}) => {
const [local_value, setLocalValue] = React.useState();

const Icon = icon;
const has_error = error_messages && !!error_messages.length;
const max_is_disabled = max_value && (+value >= +max_value || +local_value >= +max_value);
Expand Down Expand Up @@ -135,22 +140,21 @@ const InputField = ({
if (long_press_step) {
const increase_percentage = Math.min(long_press_step, Math.max(long_press_step, 10)) / 10;
const increase = (value * increase_percentage) / 100;
const new_value = parseFloat(+(current_value || 0)) + Math.abs(increase);
const new_value = parseFloat(current_value || 0) + Math.abs(increase);

increment_value = parseFloat(getClampedValue(new_value)).toFixed(decimal_places);
} else if (is_crypto || (!currency && is_float)) {
const new_value = parseFloat(+(current_value || 0)) + parseFloat(1 * 10 ** (0 - decimal_places));
increment_value = parseFloat(new_value).toFixed(decimal_places);
const new_value =
parseFloat(current_value || 0) + parseFloat(1 * 10 ** (0 - (decimal_point_change || decimal_places)));
increment_value = parseFloat(new_value).toFixed(decimal_point_change || decimal_places);
} else {
increment_value = parseFloat(+(current_value || 0) + 1).toFixed(decimal_places);
increment_value = parseFloat((current_value || 0) + 1).toFixed(decimal_places);
}

updateValue(increment_value, !!long_press_step);
};

const calculateDecrementedValue = long_press_step => {
let decrement_value;

const current_value = local_value || value;

const decimal_places = current_value ? getDecimals(current_value) : 0;
Expand All @@ -159,30 +163,38 @@ const InputField = ({
if (long_press_step) {
const decrease_percentage = Math.min(long_press_step, Math.max(long_press_step, 10)) / 10;
const decrease = (value * decrease_percentage) / 100;
const new_value = parseFloat(+(current_value || 0)) - Math.abs(decrease);
const new_value = parseFloat(current_value || 0) - Math.abs(decrease);

decrement_value = parseFloat(getClampedValue(new_value)).toFixed(decimal_places);
} else if (is_crypto || (!currency && is_float)) {
const new_value = parseFloat(+(current_value || 0)) - parseFloat(1 * 10 ** (0 - decimal_places));
decrement_value = parseFloat(new_value).toFixed(decimal_places);
const new_value =
parseFloat(current_value || 0) - parseFloat(1 * 10 ** (0 - (decimal_point_change || decimal_places)));
decrement_value = parseFloat(new_value).toFixed(decimal_point_change || decimal_places);
} else {
decrement_value = parseFloat(+(current_value || 0) - 1).toFixed(decimal_places);
decrement_value = parseFloat((current_value || 0) - 1).toFixed(decimal_places);
}
return decrement_value;
};

const decrementValue = (ev, long_press_step) => {
if (!value || min_is_disabled) return;
if (min_is_disabled) {
return;
}
const decrement_value = calculateDecrementedValue(long_press_step);
if (is_negative_disabled && decrement_value < 0) return;
if (is_negative_disabled && decrement_value < 0) {
return;
}
updateValue(decrement_value, !!long_press_step);
};

const updateValue = (new_value, is_long_press) => {
const formatted_value = format ? format(new_value) : new_value;
let formatted_value = format ? format(new_value) : new_value;
if (is_long_press) {
setLocalValue(formatted_value);
} else {
if (is_signed && /^\d+/.test(formatted_value) && formatted_value > 0) {
formatted_value = `+${formatted_value}`;
}
onChange({ target: { value: formatted_value, name } });
}
};
Expand Down Expand Up @@ -221,8 +233,10 @@ const InputField = ({
{ 'input--error': has_error },
classNameInput
)}
classNameDynamicSuffix={classNameDynamicSuffix}
classNameInlinePrefix={classNameInlinePrefix}
data_tip={data_tip}
data_testid={data_testid}
data_value={data_value}
display_value={display_value}
fractional_digits={fractional_digits}
Expand All @@ -236,6 +250,7 @@ const InputField = ({
is_read_only={is_read_only}
max_length={max_length}
name={name}
onBlur={onBlur}
onClick={onClick}
onKeyPressed={onKeyPressed}
placeholder={placeholder}
Expand All @@ -257,6 +272,7 @@ const InputField = ({
decrementValue={decrementValue}
onLongPressEnd={onLongPressEnd}
is_incrementable_on_long_press={is_incrementable_on_long_press}
type={increment_button_type}
/>
);

Expand All @@ -279,9 +295,13 @@ const InputField = ({
)}
{is_increment_input ? (
<div
className={classNames('dc-input-wrapper', {
'dc-input-wrapper--disabled': !!is_disabled,
})}
className={classNames(
'dc-input-wrapper',
{
'dc-input-wrapper--disabled': !!is_disabled,
},
classNameWrapper
)}
>
{increment_buttons}
{input}
Expand Down Expand Up @@ -318,9 +338,12 @@ InputField.propTypes = {
className: PropTypes.string,
classNameInlinePrefix: PropTypes.string,
classNameInput: PropTypes.string,
classNameDynamicSuffix: PropTypes.string,
classNamePrefix: PropTypes.string,
classNameWrapper: PropTypes.string, // CSS class for the component wrapper
currency: PropTypes.string,
current_focus: PropTypes.string,
decimal_point_change: PropTypes.number, // Specify which decimal point must be updated when the increment/decrement button is pressed
error_messages: PropTypes.array,
error_message_alignment: PropTypes.string,
fractional_digits: PropTypes.number,
Expand All @@ -338,9 +361,11 @@ InputField.propTypes = {
is_read_only: PropTypes.bool,
is_signed: PropTypes.bool,
is_unit_at_right: PropTypes.bool,
increment_button_type: PropTypes.string,
label: PropTypes.string,
max_length: PropTypes.number,
name: PropTypes.string,
onBlur: PropTypes.func,
onChange: PropTypes.func,
onClick: PropTypes.func,
onClickInputWrapper: PropTypes.func,
Expand Down
22 changes: 17 additions & 5 deletions packages/components/src/components/input-field/input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const Input = ({
checked,
className,
classNameInlinePrefix,
classNameDynamicSuffix,
current_focus,
data_value,
data_tip,
Expand All @@ -24,12 +25,14 @@ const Input = ({
is_read_only,
max_length,
name,
onBlur,
onClick,
onKeyPressed,
placeholder,
required,
setCurrentFocus,
type,
data_testid,
}) => {
const ref = React.useRef();
React.useEffect(() => {
Expand All @@ -38,7 +41,12 @@ const Input = ({
}
}, [current_focus, name]);

const onBlur = () => setCurrentFocus(null);
const onBlurHandler = e => {
setCurrentFocus(null);
if (onBlur) {
onBlur(e);
}
};
const onFocus = () => setCurrentFocus(name);

const onChange = e => {
Expand All @@ -59,7 +67,7 @@ const Input = ({
};

return (
<React.Fragment>
<div className={classNameDynamicSuffix}>
{!!inline_prefix && (
<div className={classNameInlinePrefix}>
<span
Expand All @@ -78,12 +86,13 @@ const Input = ({
data-for={`error_tooltip_${name}`}
data-hj-whitelist={is_hj_whitelisted}
data-tip={data_tip}
data-testid={data_testid}
data-value={data_value}
disabled={is_disabled}
id={id}
maxLength={fractional_digits ? max_length + fractional_digits + 1 : max_length}
name={name}
onBlur={onBlur}
onBlur={onBlurHandler}
onChange={onChange}
onClick={onClick}
onFocus={onFocus}
Expand All @@ -94,10 +103,11 @@ const Input = ({
required={required || undefined}
inputMode={inputmode}
type={type === 'number' ? 'text' : type}
value={display_value || ''}
value={display_value ?? ''}
aria-label={ariaLabel}
data-lpignore={type !== 'password'}
/>
</React.Fragment>
</div>
);
};

Expand All @@ -107,6 +117,7 @@ Input.propTypes = {
checked: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
className: PropTypes.string,
classNameInlinePrefix: PropTypes.string,
classNameDynamicSuffix: PropTypes.string,
current_focus: PropTypes.string,
data_tip: PropTypes.string,
data_value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
Expand All @@ -121,6 +132,7 @@ Input.propTypes = {
is_read_only: PropTypes.bool,
max_length: PropTypes.number,
name: PropTypes.string,
onBlur: PropTypes.func,
onClick: PropTypes.func,
onKeyPressed: PropTypes.func,
placeholder: PropTypes.string,
Expand Down
Loading

0 comments on commit 7a7c7ba

Please sign in to comment.