From faf76ae53c1b7ea8b9ba6102b08d9c9476f5d334 Mon Sep 17 00:00:00 2001 From: ram Date: Thu, 7 Nov 2024 20:41:19 +0530 Subject: [PATCH 1/6] Changes for the new asset page --- .../DigitalAssets/components/AssetsCards.js | 117 +++++++++++------- .../DigitalAssets/components/AssetsList.js | 33 +++-- .../DigitalAssets/components/AssetsRow.js | 18 ++- .../DigitalAssets/components/AssetsWrapper.js | 2 +- 4 files changed, 107 insertions(+), 63 deletions(-) diff --git a/web/src/containers/DigitalAssets/components/AssetsCards.js b/web/src/containers/DigitalAssets/components/AssetsCards.js index 56bb76f0a5..0bbe99518d 100644 --- a/web/src/containers/DigitalAssets/components/AssetsCards.js +++ b/web/src/containers/DigitalAssets/components/AssetsCards.js @@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react'; import { connect } from 'react-redux'; import { isMobile } from 'react-device-detect'; import { browserHistory } from 'react-router'; -import { Card, Switch } from 'antd'; +import { Card, Spin, Switch } from 'antd'; import { CaretDownOutlined, CaretUpOutlined, @@ -15,6 +15,7 @@ import icons from 'config/icons/dark'; import { Coin, EditWrapper, IconTitle } from 'components'; import { quicktradePairSelector } from 'containers/QuickTrade/components/utils'; import { Loading } from './utils'; +import { formatCurrencyByIncrementalUnit } from 'utils/currency'; const cardTypes = ['gainers', 'losers', 'newAssets']; const cardTitles = [ @@ -94,56 +95,72 @@ const goToCoinInfo = (symbol, features, quicktradePairs) => { } }; -const renderCards = (data, coins, type, loading, features, quicktradePairs) => - data.map( - ( - { - symbol, - lastPrice, - oneDayPriceDifferencePercent, - oneDayPriceDifferencePercenVal, - }, - index - ) => - loading ? ( - - ) : ( -
goToCoinInfo(symbol, features, quicktradePairs)} - > -
- -
- - {coins[symbol].fullname} - - {symbol.toUpperCase()} -
-
-
-
- - {lastPrice ? `$${lastPrice}` : '-'} - - {renderPercentage( - type === 'newAssets' - ? oneDayPriceDifferencePercenVal - : oneDayPriceDifferencePercent, - type - )} +const renderCards = (data, coins, type, loading, features, quicktradePairs) => { + return data?.length >= 1 ? ( + data?.map( + ( + { + symbol, + lastPrice, + oneDayPriceDifferencePercent, + oneDayPriceDifferencePercenVal, + increment_unit, + }, + index + ) => { + const roundPrice = lastPrice?.split(',')?.join(''); + + return loading ? ( + + ) : ( +
goToCoinInfo(symbol, features, quicktradePairs)} + > +
+ +
+ + {coins[symbol]?.fullname} + + {symbol?.toUpperCase()} +
-
- +
+
+ + {lastPrice + ? `$${formatCurrencyByIncrementalUnit( + roundPrice, + increment_unit + )}` + : '-'} + + {renderPercentage( + type === 'newAssets' + ? oneDayPriceDifferencePercenVal + : oneDayPriceDifferencePercent, + type + )} +
+
+ +
-
- ) + ); + } + ) + ) : ( + + + ); +}; const AssetsCards = ({ coins, @@ -258,6 +275,10 @@ const AssetsCards = ({ : cardTypes[currentIndex] === 'losers' ? 'losers-asset-card' : 'new-asset-card' + } ${ + sortedCoinsData[cardTypes[currentIndex]]?.length === 0 + ? 'text-center' + : '' }`} > {renderCards( @@ -327,7 +348,7 @@ const AssetsCards = ({ : type === 'losers' ? 'losers-asset-card' : 'new-asset-card' - }`} + } ${sortedCoinsData[type]?.length === 0 ? 'text-center' : ''}`} > {renderCards( sortedCoinsData[type], diff --git a/web/src/containers/DigitalAssets/components/AssetsList.js b/web/src/containers/DigitalAssets/components/AssetsList.js index a8de876ef9..1df97480e1 100644 --- a/web/src/containers/DigitalAssets/components/AssetsList.js +++ b/web/src/containers/DigitalAssets/components/AssetsList.js @@ -15,6 +15,7 @@ import { EditWrapper } from 'components'; import STRINGS from 'config/localizedStrings'; import withConfig from 'components/ConfigProvider/withConfig'; import AssetsRow from './AssetsRow'; +import { Spin } from 'antd'; const AssetsList = ({ coinsListData, @@ -246,18 +247,26 @@ const AssetsList = ({ - {getSortedList().map((coinData, index) => ( - - ))} + {getSortedList()?.length >= 1 ? ( + getSortedList()?.map((coinData, index) => ( + + )) + ) : ( + + + + + + )}
diff --git a/web/src/containers/DigitalAssets/components/AssetsRow.js b/web/src/containers/DigitalAssets/components/AssetsRow.js index 09add0c719..a777e2c9da 100644 --- a/web/src/containers/DigitalAssets/components/AssetsRow.js +++ b/web/src/containers/DigitalAssets/components/AssetsRow.js @@ -10,6 +10,7 @@ import { MiniSparkLine } from 'containers/TradeTabs/components/MiniSparkLine'; import { getLastValuesFromParts } from 'utils/array'; import { unique } from 'utils/data'; import { Loading } from './utils'; +import { formatCurrencyByIncrementalUnit } from 'utils/currency'; const AssetsRow = ({ coinData, @@ -32,6 +33,7 @@ const AssetsRow = ({ oneDayPriceDifferencePercent, lastPrice, key, + increment_unit, } = coinData; const getAllAvailableMarkets = (key) => { @@ -94,6 +96,7 @@ const AssetsRow = ({ }; const markets = getAllAvailableMarkets(symbol); + const roundPrice = lastPrice?.split(',')?.join(''); return ( @@ -137,7 +140,12 @@ const AssetsRow = ({ {lastPrice && '$'} - {lastPrice ? lastPrice : '-'} + {lastPrice + ? formatCurrencyByIncrementalUnit( + roundPrice, + increment_unit + ) + : '-'}
{(oneDayPriceDifferencePercent && oneDayPriceDifference) || @@ -200,6 +208,8 @@ const AssetsRow = ({ coins[symbol].market_cap.toLocaleString('en-US', { style: 'currency', currency: 'USD', + minimumFractionDigits: 0, + maximumFractionDigits: 0, }) ) : ( 0 @@ -218,7 +228,9 @@ const AssetsRow = ({ {lastPrice && '$'} - {lastPrice ? lastPrice : '-'} + {lastPrice + ? formatCurrencyByIncrementalUnit(roundPrice, increment_unit) + : '-'}
) : ( @@ -291,6 +303,8 @@ const AssetsRow = ({ coins[symbol].market_cap.toLocaleString('en-US', { style: 'currency', currency: 'USD', + minimumFractionDigits: 0, + maximumFractionDigits: 0, }) ) : ( 0 diff --git a/web/src/containers/DigitalAssets/components/AssetsWrapper.js b/web/src/containers/DigitalAssets/components/AssetsWrapper.js index ef4d74dc05..179d8442b7 100644 --- a/web/src/containers/DigitalAssets/components/AssetsWrapper.js +++ b/web/src/containers/DigitalAssets/components/AssetsWrapper.js @@ -31,7 +31,7 @@ class AssetsWrapper extends Component { data: [], chartData: {}, coinsData: [], - pageSize: 100, + pageSize: 50, page: 0, count: 0, searchValue: '', From 2ea20d0477872a92397e4d94dfa621cad8c6403f Mon Sep 17 00:00:00 2001 From: ram Date: Fri, 8 Nov 2024 21:45:31 +0530 Subject: [PATCH 2/6] Fixed the market chart issue and favourite asset bar expansion issue --- web/src/components/AppBar/PairTabs.js | 27 +++++++++++++++++++++++---- web/src/containers/App/App.js | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/web/src/components/AppBar/PairTabs.js b/web/src/components/AppBar/PairTabs.js index ab898047ef..b12ea5ecbb 100644 --- a/web/src/components/AppBar/PairTabs.js +++ b/web/src/components/AppBar/PairTabs.js @@ -1,5 +1,6 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; +import { bindActionCreators } from 'redux'; import classnames from 'classnames'; import { browserHistory } from 'react-router'; import { Dropdown } from 'antd'; @@ -14,7 +15,10 @@ import withConfig from 'components/ConfigProvider/withConfig'; import { formatToCurrency } from 'utils/currency'; import { MarketsSelector } from 'containers/Trade/utils'; import SparkLine from 'containers/TradeTabs/components/SparkLine'; +import { getSparklines } from 'actions/chartAction'; +import { changeSparkLineChartData } from 'actions/appActions'; +let isMounted = false; class PairTabs extends Component { state = { activePairTab: '', @@ -29,9 +33,6 @@ class PairTabs extends Component { } this.setState({ activePairTab: active }); this.initTabs(pairs, active); - // getSparklines(Object.keys(pairs)).then((chartData) => - // this.props.changeSparkLineChartData(chartData) - // ); } UNSAFE_componentWillReceiveProps(nextProps) { @@ -98,6 +99,7 @@ class PairTabs extends Component { markets, quicktrade, sparkLineChartData, + pairs, } = this.props; const market = markets.find(({ key }) => key === activePairTab) || {}; const { @@ -107,6 +109,13 @@ class PairTabs extends Component { display_name, } = market; + if (activePairTab && !isMounted) { + isMounted = true; + getSparklines(Object.keys(pairs)).then((chartData) => + this.props.changeSparkLineChartData(chartData) + ); + } + const filterQuickTrade = quicktrade.filter(({ type }) => type !== 'pro'); return (
@@ -278,4 +287,14 @@ const mapStateToProps = (state) => { }; }; -export default connect(mapStateToProps)(withConfig(PairTabs)); +const mapDispatchToProps = (dispatch) => ({ + changeSparkLineChartData: bindActionCreators( + changeSparkLineChartData, + dispatch + ), +}); + +export default connect( + mapStateToProps, + mapDispatchToProps +)(withConfig(PairTabs)); diff --git a/web/src/containers/App/App.js b/web/src/containers/App/App.js index e2f5f73687..d0ee8c3f4e 100644 --- a/web/src/containers/App/App.js +++ b/web/src/containers/App/App.js @@ -799,7 +799,7 @@ class App extends Component { onClick={this.resetTimer} onKeyPress={this.resetTimer} /> -
+
{!isChartEmbed && ( Date: Sun, 10 Nov 2024 00:10:02 +0900 Subject: [PATCH 3/6] remove category restriction in transfer from hollaex network utils --- server/utils/hollaex-network-lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/hollaex-network-lib/index.js b/server/utils/hollaex-network-lib/index.js index 627b879b28..ff91d3f01d 100644 --- a/server/utils/hollaex-network-lib/index.js +++ b/server/utils/hollaex-network-lib/index.js @@ -1754,7 +1754,7 @@ class HollaExNetwork { data.email = true; } - if (opts.category && ['stake', 'referral', 'internal'].includes(opts.category)) { + if (opts.category) { data.category = opts.category; } From a6aa8a49d9a37bd8b40cf5515c04bd2894e200d1 Mon Sep 17 00:00:00 2001 From: fetok12 Date: Mon, 11 Nov 2024 20:46:21 +0300 Subject: [PATCH 4/6] User Deletion By Admin --- web/src/containers/Admin/User/AboutData.js | 9 ++++ .../Admin/User/DeleteConfirmation.js | 33 +++++++++++++++ web/src/containers/Admin/User/UserContent.js | 41 ++++++++++++++++++- web/src/containers/Admin/User/actions.js | 9 ++++ 4 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 web/src/containers/Admin/User/DeleteConfirmation.js diff --git a/web/src/containers/Admin/User/AboutData.js b/web/src/containers/Admin/User/AboutData.js index d462b95268..8c51428e1e 100644 --- a/web/src/containers/Admin/User/AboutData.js +++ b/web/src/containers/Admin/User/AboutData.js @@ -461,6 +461,7 @@ const AboutData = ({ freezeAccount, verifyEmail, recoverUser, + deleteUser, onChangeSuccess, allIcons = {}, userTiers, @@ -639,6 +640,14 @@ const AboutData = ({
Account is active
+
{ + deleteUser(); + }} + > + Delete user +
( + +
+
+
+ +
+

+ User Delete +

+
+
+
+ Email: + {userData.email} +
+
Are you sure you want to delete this user?
+
+
+ +
+
+
+); + +export default DeletionConfirmation; diff --git a/web/src/containers/Admin/User/UserContent.js b/web/src/containers/Admin/User/UserContent.js index 3db46b0b4b..93b305922f 100644 --- a/web/src/containers/Admin/User/UserContent.js +++ b/web/src/containers/Admin/User/UserContent.js @@ -30,10 +30,12 @@ import { activateUser, verifyUser, recoverUser, + deleteUser, requestTiers, } from './actions'; import UserMetaForm from './UserMetaForm'; import PaymentMethods from './PaymentMethods'; +import DeletionConfirmation from './DeleteConfirmation'; // import Flagger from '../Flaguser'; // import Notes from './Notes'; @@ -45,6 +47,7 @@ class UserContent extends Component { state = { showVerifyEmailModal: false, showRecoverModal: false, + showDeleteModal: false, userTiers: {}, }; @@ -218,6 +221,24 @@ class UserContent extends Component { }); }; + handleDeleteUser = () => { + const { userInformation = {}, refreshData } = this.props; + const postValues = { + user_id: parseInt(userInformation.id, 10), + }; + + deleteUser(postValues) + .then((res) => { + refreshData({ ...postValues, activated: false }); + this.setState({ showDeleteModal: false }); + }) + .catch((err) => { + const _error = + err.data && err.data.message ? err.data.message : err.message; + message.error(_error); + }); + }; + openVerifyEmailModal = () => { this.setState({ showVerifyEmailModal: true, @@ -230,6 +251,12 @@ class UserContent extends Component { }); }; + openDeleteUserModel = () => { + this.setState({ + showDeleteModal: true, + }); + }; + renderTabBar = (props, DefaultTabBar) => { if (this.props.isConfigure) return
; return ; @@ -252,7 +279,12 @@ class UserContent extends Component { referral_history_config, } = this.props; - const { showVerifyEmailModal, showRecoverModal, userTiers } = this.state; + const { + showVerifyEmailModal, + showRecoverModal, + showDeleteModal, + userTiers, + } = this.state; const { id, @@ -354,6 +386,7 @@ class UserContent extends Component { freezeAccount={this.freezeAccount} verifyEmail={this.openVerifyEmailModal} recoverUser={this.openRecoverUserModel} + deleteUser={this.openDeleteUserModel} kycPluginName={kycPluginName} requestUserData={requestUserData} refreshAllData={refreshAllData} @@ -470,6 +503,12 @@ class UserContent extends Component { onConfirm={this.handleRecoverUser} userData={userInformation} /> + this.setState({ showRecoverModal: false })} + onConfirm={this.handleDeleteUser} + userData={userInformation} + />
); } diff --git a/web/src/containers/Admin/User/actions.js b/web/src/containers/Admin/User/actions.js index 3dee3d6e04..764ed70048 100644 --- a/web/src/containers/Admin/User/actions.js +++ b/web/src/containers/Admin/User/actions.js @@ -214,6 +214,15 @@ export const recoverUser = (values) => { return requestAuthenticated('/admin/user/restore', options); }; +export const deleteUser = (values) => { + const options = { + method: 'DELETE', + body: JSON.stringify(values), + }; + + return requestAuthenticated('/admin/user', options); +}; + export const performVerificationLevelUpdate = (values) => { const options = { method: 'POST', From 0381e7edcfc2fed29469a71fb74356d5b377b9b4 Mon Sep 17 00:00:00 2001 From: fetok12 Date: Thu, 14 Nov 2024 14:41:08 +0300 Subject: [PATCH 5/6] fix p2p payment details query --- server/utils/hollaex-tools-lib/tools/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/hollaex-tools-lib/tools/user.js b/server/utils/hollaex-tools-lib/tools/user.js index 0bc5a20917..a2c9650b8b 100644 --- a/server/utils/hollaex-tools-lib/tools/user.js +++ b/server/utils/hollaex-tools-lib/tools/user.js @@ -3403,7 +3403,7 @@ const getPaymentDetails = async (user_id, opts = { const query = { where: { created_at: timeframe, - user_id, + ...(user_id && { user_id }), ...(opts.is_p2p && { is_p2p: opts.is_p2p }), ...(opts.is_fiat_control && { is_fiat_control: opts.is_fiat_control }), ...(opts.status && { status: opts.status }) From f8652330ea72e7ba666c2c5be14a3cc5d59d0006 Mon Sep 17 00:00:00 2001 From: fetok12 Date: Thu, 14 Nov 2024 15:03:57 +0300 Subject: [PATCH 6/6] fix p2p cache after update --- server/utils/hollaex-tools-lib/tools/p2p.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/utils/hollaex-tools-lib/tools/p2p.js b/server/utils/hollaex-tools-lib/tools/p2p.js index 6aff25db5d..5074cda368 100644 --- a/server/utils/hollaex-tools-lib/tools/p2p.js +++ b/server/utils/hollaex-tools-lib/tools/p2p.js @@ -117,7 +117,7 @@ const fetchP2PDeals = async (opts = { } }); } else { - const p2pDeals = await client.getAsync(`p2p-deals${opts.user_id}`); + const p2pDeals = await client.getAsync(`p2p-deals${opts.user_id || 'all'}`); if (p2pDeals) return JSON.parse(p2pDeals); else { @@ -138,7 +138,7 @@ const fetchP2PDeals = async (opts = { } } - await client.setexAsync(`p2p-deals${opts.user_id}`, 30, JSON.stringify(deals)); + await client.setexAsync(`p2p-deals${opts.user_id || 'all'}`, 30, JSON.stringify(deals)); return deals; } @@ -352,6 +352,7 @@ const updateP2PDeal = async (data) => { } }); await client.delAsync(`p2p-deals${merchant_id}`); + await client.delAsync(`p2p-dealsall`); await getModel('p2pDeal').update({ status }, { where : { id : edited_ids }}); return { message : 'success' }; } @@ -410,7 +411,7 @@ const updateP2PDeal = async (data) => { }; await client.delAsync(`p2p-deals${merchant_id}`); - + await client.delAsync(`p2p-dealsall`); return p2pDeal.update(data, { fields: [ 'merchant_id', @@ -446,6 +447,8 @@ const deleteP2PDeal = async (removed_ids, user_id) => { }; await client.delAsync(`p2p-deals${user_id}`); + await client.delAsync(`p2p-dealsall`); + const promises = deals.map(async (deal) => { return await deal.destroy(); });