From 8706dee0e6157649e927600a82f8297f61a658f4 Mon Sep 17 00:00:00 2001 From: HENRY Date: Thu, 5 Jan 2023 14:55:21 +0800 Subject: [PATCH] fix: Change Rise/Fall contract from displaying Higher/Lower --- src/javascript/app/pages/trade/price.js | 13 ++++++++- .../app/pages/user/view_popup/view_popup.js | 28 +++++++------------ src/templates/app/trade/explanation.jsx | 6 ++-- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/javascript/app/pages/trade/price.js b/src/javascript/app/pages/trade/price.js index c8d7447893c4f..894628c065620 100644 --- a/src/javascript/app/pages/trade/price.js +++ b/src/javascript/app/pages/trade/price.js @@ -197,7 +197,18 @@ const Price = (() => { const currency = CommonFunctions.getVisibleElement('currency'); if (!h4) return; - const display_text = type && contract_type ? contract_type[type] : ''; + + const form_name = Defaults.get('formname'); + let display_text = type && contract_type ? contract_type[type] : ''; + + if (form_name === 'risefall' || form_name === 'callputequal') { + if (type === 'CALL' || type === 'CALLE') { + display_text = localize('Rise'); + } else { + display_text = localize('Fall'); + } + } + if (display_text) { h4.setAttribute('class', `contract_heading ${type}`); CommonFunctions.elementTextContent(h4, display_text); diff --git a/src/javascript/app/pages/user/view_popup/view_popup.js b/src/javascript/app/pages/user/view_popup/view_popup.js index 2832c505e251f..3306930bf3ca4 100644 --- a/src/javascript/app/pages/user/view_popup/view_popup.js +++ b/src/javascript/app/pages/user/view_popup/view_popup.js @@ -2,6 +2,7 @@ const moment = require('moment'); const ViewPopupUI = require('./view_popup.ui'); const Highchart = require('../../trade/charts/highchart'); const Callputspread = require('../../trade/callputspread'); +const Defaults = require('../../trade/defaults'); const DigitDisplay = require('../../trade/digit_trade'); const Lookback = require('../../trade/lookback'); const Reset = require('../../trade/reset'); @@ -84,16 +85,16 @@ const ViewPopup = (() => { showContract(); }; - const ContractTypeDisplay = (() => { - let contract_type_display; + const ContractTypeDisplay = () => { + const form_name = Defaults.get('formname'); - const initContractTypeDisplay = () => ({ + return { ASIANU : localize('Asian Up'), ASIAND : localize('Asian Down'), - CALL : localize('Higher'), - CALLE : localize('Higher or equal'), - PUT : localize('Lower'), - PUTE : localize('Lower or equal'), + CALL : form_name === 'risefall' ? localize('Rise') : localize('Higher'), + CALLE : localize('Rise or equal'), + PUT : form_name === 'risefall' ? localize('Fall') : localize('Lower'), + PUTE : localize('Fall or equal'), DIGITMATCH : localize('Digit Matches'), DIGITDIFF : localize('Digit Differs'), DIGITODD : localize('Digit Odd'), @@ -120,24 +121,15 @@ const ViewPopup = (() => { RUNLOW : localize('Only Downs'), MULTUP : localize('Multiplier Up'), MULTDOWN : localize('Multiplier Down'), - }); - - return { - get: () => { - if (!contract_type_display) { - contract_type_display = initContractTypeDisplay(); - } - return contract_type_display; - }, }; - })(); + }; const showContract = () => { if (!$container) { $container = makeTemplate(); } - containerSetText('trade_details_contract_type', ContractTypeDisplay.get()[contract.contract_type]); + containerSetText('trade_details_contract_type', ContractTypeDisplay()[contract.contract_type]); containerSetText('trade_details_purchase_price', formatMoney(contract.currency, contract.buy_price)); containerSetText('trade_details_multiplier', formatMoney(contract.currency, multiplier, false, 3, 2)); if (Lookback.isLookback(contract.contract_type)) { diff --git a/src/templates/app/trade/explanation.jsx b/src/templates/app/trade/explanation.jsx index 169348bcbd190..7a336a3959ca4 100644 --- a/src/templates/app/trade/explanation.jsx +++ b/src/templates/app/trade/explanation.jsx @@ -59,9 +59,9 @@ const Explanation = () => (

{it.L('Winning the contract')}

-

{it.L('If you select "Higher", you win the payout if the exit spot is strictly higher than the entry spot.')}

-

{it.L('If you select "Lower", you win the payout if the exit spot is strictly lower than the entry spot.')}

-

{it.L('If you select "Allow equals", you win the payout if exit spot is higher than or equal to entry spot for "Higher". Similarly, you win the payout if exit spot is lower than or equal to entry spot for "Lower".')}

+

{it.L('If you select "Rise", you win the payout if the exit spot is strictly higher than the entry spot.')}

+

{it.L('If you select "Fall", you win the payout if the exit spot is strictly lower than the entry spot.')}

+

{it.L('If you select "Allow equals", you win the payout if exit spot is higher than or equal to entry spot for "Rise". Similarly, you win the payout if exit spot is lower than or equal to entry spot for "Fall".')}