From 669e559a1ca3862fc055521761f5d7a2e6441fb3 Mon Sep 17 00:00:00 2001 From: meenakshi-deriv <104189801+meenakshi-deriv@users.noreply.github.com> Date: Thu, 18 Jul 2024 14:10:51 +0400 Subject: [PATCH] Meenu add parser for section message (#682) * fix: added parser for section msg notes * fix: added parser for texts * fix: removed optional check for data * fix: refactor function * fix: refactor --- src/javascript/app/pages/trade/purchase.jsx | 37 ++++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/javascript/app/pages/trade/purchase.jsx b/src/javascript/app/pages/trade/purchase.jsx index 3fb9ef9ccd0..ca4380884bc 100644 --- a/src/javascript/app/pages/trade/purchase.jsx +++ b/src/javascript/app/pages/trade/purchase.jsx @@ -2,6 +2,7 @@ /* eslint-disable no-console */ import React, { useEffect, useState } from 'react'; import ReactDOM from 'react-dom'; +import parse from 'html-react-parser'; import { Button, CaptionText, SectionMessage, Skeleton, Text, Tooltip } from '@deriv-com/quill-ui'; import { LabelPairedArrowLeftMdRegularIcon, LabelPairedXmarkMdRegularIcon } from '@deriv/quill-icons/LabelPaired'; import { StandaloneCircleInfoRegularIcon } from '@deriv/quill-icons/Standalone'; @@ -89,6 +90,8 @@ const Purchase = () => { ); }; + const parseData = (rawData) => !rawData ? '' : parse(rawData); + const triggerClick = (id) => document.getElementById(id).click(); if (showPopup){ @@ -209,7 +212,7 @@ const Purchase = () => { {data?.cd_payoutLabel}
- + {parseData(data.cd_payout)}
@@ -217,7 +220,7 @@ const Purchase = () => { {localize('Purchase price')}
- + {parseData(data.cd_purchasePrice)}
@@ -258,7 +261,7 @@ const Purchase = () => { {data?.cd_indicativeLabel}
- + {parseData(data.cd_indicativePrice)}
@@ -266,7 +269,7 @@ const Purchase = () => { {data?.cd_profitLossLabel}
- + {parseData(data.cd_profitLoss)}
@@ -277,14 +280,14 @@ const Purchase = () => { {data?.cd_sellMsg && (
- } /> + } />
)} ) : ( data?.cd_infoMsg && (
- } /> + } />
) )} @@ -295,7 +298,7 @@ const Purchase = () => {