From 5842191a54d98cff4a28e9e1c017f01ddec6c90c Mon Sep 17 00:00:00 2001 From: Arnab Sen Date: Thu, 13 Oct 2022 20:14:42 +0530 Subject: [PATCH 01/13] feat: swapping tokens functionality [WIP] Integrated the API calls for the Swap Token functionality --- cysync/src/constants/routes.ts | 3 + .../src/designSystem/iconGroups/changelly.tsx | 19 ++ .../iconGroups/checkmarkSuccess.tsx | 13 + .../src/designSystem/iconGroups/download.tsx | 22 ++ cysync/src/designSystem/iconGroups/swap.tsx | 14 + cysync/src/pages/mainApp/index.tsx | 3 + cysync/src/pages/mainApp/sidebar/index.tsx | 19 +- .../mainApp/sidebar/swap/HorizontalTabs.tsx | 58 ++++ .../src/pages/mainApp/sidebar/swap/index.tsx | 62 ++++ .../sidebar/swap/panels/HistoryPanel.tsx | 212 +++++++++++++ .../panels/dialogs/SwapCompletedDialog.tsx | 122 ++++++++ .../dialogs/VerifySwapDetailsDialog.tsx | 264 ++++++++++++++++ .../swap/panels/dialogs/exchangeProgress.tsx | 136 +++++++++ .../sidebar/swap/panels/dialogs/received.tsx | 161 ++++++++++ .../panels/dialogs/transactionDetails.tsx | 99 ++++++ .../panels/exchange/NetworkFeeDetails.tsx | 172 +++++++++++ .../swap/panels/exchange/SwapDetailsForm.tsx | 252 ++++++++++++++++ .../sidebar/swap/panels/exchange/index.tsx | 284 ++++++++++++++++++ cysync/src/store/hooks/index.ts | 1 + cysync/src/store/hooks/useExchange.ts | 58 ++++ 20 files changed, 1973 insertions(+), 1 deletion(-) create mode 100644 cysync/src/designSystem/iconGroups/changelly.tsx create mode 100644 cysync/src/designSystem/iconGroups/checkmarkSuccess.tsx create mode 100644 cysync/src/designSystem/iconGroups/download.tsx create mode 100644 cysync/src/designSystem/iconGroups/swap.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/HorizontalTabs.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/index.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/HistoryPanel.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/dialogs/SwapCompletedDialog.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/dialogs/VerifySwapDetailsDialog.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/dialogs/exchangeProgress.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/dialogs/received.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/dialogs/transactionDetails.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/exchange/NetworkFeeDetails.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/exchange/SwapDetailsForm.tsx create mode 100644 cysync/src/pages/mainApp/sidebar/swap/panels/exchange/index.tsx create mode 100644 cysync/src/store/hooks/useExchange.ts diff --git a/cysync/src/constants/routes.ts b/cysync/src/constants/routes.ts index ead25673..bd09d0d6 100644 --- a/cysync/src/constants/routes.ts +++ b/cysync/src/constants/routes.ts @@ -26,6 +26,9 @@ const routes = { }, tutorial: { index: '/tutorial' + }, + swap: { + index: '/swap' } }; diff --git a/cysync/src/designSystem/iconGroups/changelly.tsx b/cysync/src/designSystem/iconGroups/changelly.tsx new file mode 100644 index 00000000..1a665c4d --- /dev/null +++ b/cysync/src/designSystem/iconGroups/changelly.tsx @@ -0,0 +1,19 @@ +import * as React from 'react'; +import { SVGProps } from 'react'; + +const Changelly = (props: SVGProps) => ( + + + +); + +export default Changelly; diff --git a/cysync/src/designSystem/iconGroups/checkmarkSuccess.tsx b/cysync/src/designSystem/iconGroups/checkmarkSuccess.tsx new file mode 100644 index 00000000..f7698e5d --- /dev/null +++ b/cysync/src/designSystem/iconGroups/checkmarkSuccess.tsx @@ -0,0 +1,13 @@ +import * as React from 'react'; + +const checkmarkSuccess = () => ( + + + + +); + +export default checkmarkSuccess; diff --git a/cysync/src/designSystem/iconGroups/download.tsx b/cysync/src/designSystem/iconGroups/download.tsx new file mode 100644 index 00000000..faf8f6a6 --- /dev/null +++ b/cysync/src/designSystem/iconGroups/download.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { SVGProps } from 'react'; + +const Download = (props: SVGProps) => ( + + + +); + +export default Download; diff --git a/cysync/src/designSystem/iconGroups/swap.tsx b/cysync/src/designSystem/iconGroups/swap.tsx new file mode 100644 index 00000000..22f0a492 --- /dev/null +++ b/cysync/src/designSystem/iconGroups/swap.tsx @@ -0,0 +1,14 @@ +import React from 'react'; + +const swap = (props: { color: string }) => { + return ( + + + + ); +}; + +export default swap; diff --git a/cysync/src/pages/mainApp/index.tsx b/cysync/src/pages/mainApp/index.tsx index f843238e..aa096baf 100644 --- a/cysync/src/pages/mainApp/index.tsx +++ b/cysync/src/pages/mainApp/index.tsx @@ -13,6 +13,7 @@ import Navbar from './navbar'; import Sidebar from './sidebar'; import Portfolio from './sidebar/portfolio'; import Settings from './sidebar/settings'; +import Swap from './sidebar/swap'; import Transaction from './sidebar/transaction'; import Tutorial from './sidebar/tutorial'; import Wallet from './sidebar/wallet'; @@ -127,6 +128,8 @@ const MainApp: React.FC = () => { element={} /> + } /> + } diff --git a/cysync/src/pages/mainApp/sidebar/index.tsx b/cysync/src/pages/mainApp/sidebar/index.tsx index 86616588..9987b3ef 100644 --- a/cysync/src/pages/mainApp/sidebar/index.tsx +++ b/cysync/src/pages/mainApp/sidebar/index.tsx @@ -25,6 +25,7 @@ import colors from '../../../designSystem/designConstants/colors'; import LastTransaction from '../../../designSystem/iconGroups/lastTransaction'; import Portfolio from '../../../designSystem/iconGroups/portfolio'; import Settings from '../../../designSystem/iconGroups/settings'; +import Swap from '../../../designSystem/iconGroups/swap'; import Tutorial from '../../../designSystem/iconGroups/tutorial'; import Wallet from '../../../designSystem/iconGroups/wallet'; import { useFeedback, useWallets } from '../../../store/provider'; @@ -184,6 +185,10 @@ const TabValues = [ tab: 2, route: Routes.wallet.index }, + { + tab: 10, // this is a dummy value for the Swap tab + route: Routes.swap.index //TODO: Update the route + }, { tab: 5, route: Routes.transactions.index @@ -259,7 +264,6 @@ const Sidebar = () => { const handleChange = (_event: React.ChangeEvent | undefined, val: number) => { setValue(val); const tab = TabValues.find(elem => elem.tab === val); - if (tab) { // If wallet tab is selected, route to the first wallet if (tab.tab === 2 && walletData && walletData.length > 0) { @@ -376,6 +380,19 @@ const Sidebar = () => { + } //TODO: Update the icon + /> + } + /> +