From b9afc61c6e53ac845b8e5247e55ae70333262d62 Mon Sep 17 00:00:00 2001 From: Sorin Chis Date: Thu, 4 Jul 2024 15:13:56 +0200 Subject: [PATCH 01/10] change config when cancel dialog --- .../app/containers/wallet/staking/CardanoStakingPage.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/yoroi-extension/app/containers/wallet/staking/CardanoStakingPage.js b/packages/yoroi-extension/app/containers/wallet/staking/CardanoStakingPage.js index 0922fa01ac..e4dcbc3292 100644 --- a/packages/yoroi-extension/app/containers/wallet/staking/CardanoStakingPage.js +++ b/packages/yoroi-extension/app/containers/wallet/staking/CardanoStakingPage.js @@ -56,8 +56,14 @@ class CardanoStakingPage extends Component { @observable notificationElementId: string = ''; cancel: void => void = () => { + const selectedWallet = this.props.stores.wallets.selected; + this.props.stores.delegation.setPoolTransitionConfig(selectedWallet, { + shouldUpdatePool: false, + show: 'idle', + }); this.props.actions.ada.delegationTransaction.reset.trigger({ justTransaction: true }); }; + async componentWillUnmount() { this.props.actions.ada.delegationTransaction.reset.trigger({ justTransaction: false }); await this.props.actions.ada.delegationTransaction.setPools.trigger([]); From 2bbe4953f3a0e21a9682b3d68862f34550ac5077 Mon Sep 17 00:00:00 2001 From: Sorin Chis Date: Fri, 5 Jul 2024 14:35:31 +0200 Subject: [PATCH 02/10] fix swap input focus border width --- packages/yoroi-extension/app/components/swap/SwapInput.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/yoroi-extension/app/components/swap/SwapInput.js b/packages/yoroi-extension/app/components/swap/SwapInput.js index 8c946a5708..2fe99f07c7 100644 --- a/packages/yoroi-extension/app/components/swap/SwapInput.js +++ b/packages/yoroi-extension/app/components/swap/SwapInput.js @@ -75,7 +75,7 @@ export default function SwapInput({ component="fieldset" sx={{ borderStyle: 'solid', - borderWidth: tokenInfo.id?.length > 0 && error ? '2px' : '1px', + borderWidth: (tokenInfo.id?.length > 0 && error) || focusState.value ? '2px' : '1px', borderColor: error ? 'magenta.500' : isFocusedColor, borderRadius: '8px', p: '16px', @@ -88,6 +88,7 @@ export default function SwapInput({ bgcolor: 'common.white', columnGap: '6px', rowGap: '8px', + maxHeight: '95px', '&:hover': { borderColor: !error && 'grayscale.max', }, From a5281e46867728873ea81494b50c8362f198e62d Mon Sep 17 00:00:00 2001 From: Sorin Chis Date: Tue, 9 Jul 2024 11:12:30 +0300 Subject: [PATCH 03/10] add swap orders empty cases --- .../revamp/no-complete-orders.inline.svg | 280 ++++++++++++++++++ .../images/revamp/no-open-orders.inline.svg | 272 +++++++++++++++++ .../swap/orders/NoCompleteOrders.js | 15 + .../containers/swap/orders/NoOpenOrders.js | 18 ++ .../app/containers/swap/orders/OrdersPage.js | 30 +- 5 files changed, 612 insertions(+), 3 deletions(-) create mode 100644 packages/yoroi-extension/app/assets/images/revamp/no-complete-orders.inline.svg create mode 100644 packages/yoroi-extension/app/assets/images/revamp/no-open-orders.inline.svg create mode 100644 packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js create mode 100644 packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js diff --git a/packages/yoroi-extension/app/assets/images/revamp/no-complete-orders.inline.svg b/packages/yoroi-extension/app/assets/images/revamp/no-complete-orders.inline.svg new file mode 100644 index 0000000000..7e20803d45 --- /dev/null +++ b/packages/yoroi-extension/app/assets/images/revamp/no-complete-orders.inline.svg @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/yoroi-extension/app/assets/images/revamp/no-open-orders.inline.svg b/packages/yoroi-extension/app/assets/images/revamp/no-open-orders.inline.svg new file mode 100644 index 0000000000..8dc949e7bd --- /dev/null +++ b/packages/yoroi-extension/app/assets/images/revamp/no-open-orders.inline.svg @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js b/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js new file mode 100644 index 0000000000..e9b932d4bd --- /dev/null +++ b/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js @@ -0,0 +1,15 @@ +import { Stack, Typography } from '@mui/material'; +import { ReactComponent as NoCompleteOders } from '../../../assets/images/revamp/no-complete-orders.inline.svg'; + +const NoCompleteOrders = () => { + return ( + + + + No orders completed yet + + + ); +}; + +export default NoCompleteOrders; diff --git a/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js b/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js new file mode 100644 index 0000000000..58daccbbb7 --- /dev/null +++ b/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js @@ -0,0 +1,18 @@ +import { Stack, Typography } from '@mui/material'; +import { ReactComponent as NoOpenOders } from '../../../assets/images/revamp/no-open-orders.inline.svg'; + +const NoOpenOrders = () => { + return ( + + + + No orders available yet + + + Start doing the swap operations to see your open orders here + + + ); +}; + +export default NoOpenOrders; diff --git a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js index 388a1a96d2..1abd960d2a 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js +++ b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js @@ -26,6 +26,14 @@ import type { CardanoConnectorSignRequest } from '../../../connector/types'; import { genLookupOrFail } from '../../../stores/stateless/tokenHelpers'; import moment from 'moment'; import { signTransactionHex } from '../../../api/ada/transactions/signTransactionHex'; +import type { StoresAndActionsProps } from '../../../types/injectedProps.types'; +import { truncateAddressShort } from '../../../utils/formatters'; +import { Quantities } from '../../../utils/quantities'; +import ExplorableHashContainer from '../../widgets/ExplorableHashContainer'; +import NoCompleteOrders from './NoCompleteOrders'; +import NoOpenOrders from './NoOpenOrders'; +import { useRichOrders } from './hooks'; +import { createFormattedTokenValues } from './util'; type ColumnContext = {| completedOrders: boolean, @@ -378,8 +386,21 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node { .map(c => resolveValueOrGetter(c.width ?? 'auto', columnContext)) .join(' '); + const isOpenOrdersEmpty = openOrders?.length === 0 && !showCompletedOrders; + const isCompleteOrdersEmpty = completedOrders?.length === 0 && showCompletedOrders; + + const handleColumnNames = () => { + if (isOpenOrdersEmpty) { + return []; + } + if (isCompleteOrdersEmpty) { + return []; + } + return columnNames; + }; + return ( - <> + + )} - + {isOpenOrdersEmpty && } + {isCompleteOrdersEmpty && } + ); } From 99b4f6e1cdcfdf75b3cf3d90821294e091e566a2 Mon Sep 17 00:00:00 2001 From: Sorin Chis Date: Tue, 9 Jul 2024 13:55:12 +0300 Subject: [PATCH 04/10] fix spacings --- .../app/containers/swap/orders/NoCompleteOrders.js | 4 ++-- .../app/containers/swap/orders/NoOpenOrders.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js b/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js index e9b932d4bd..a578ffccc7 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js +++ b/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js @@ -3,9 +3,9 @@ import { ReactComponent as NoCompleteOders } from '../../../assets/images/revamp const NoCompleteOrders = () => { return ( - + - + No orders completed yet diff --git a/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js b/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js index 58daccbbb7..56dc058b59 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js +++ b/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js @@ -3,9 +3,9 @@ import { ReactComponent as NoOpenOders } from '../../../assets/images/revamp/no- const NoOpenOrders = () => { return ( - + - + No orders available yet From f157bfc22b33351524965f6090eadcf6ea7ecf87 Mon Sep 17 00:00:00 2001 From: Sorin Chis Date: Tue, 9 Jul 2024 15:16:55 +0300 Subject: [PATCH 05/10] add missing import --- .../yoroi-extension/app/containers/swap/orders/OrdersPage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js index 1abd960d2a..d549039974 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js +++ b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js @@ -34,6 +34,7 @@ import NoCompleteOrders from './NoCompleteOrders'; import NoOpenOrders from './NoOpenOrders'; import { useRichOrders } from './hooks'; import { createFormattedTokenValues } from './util'; +import type { FormattedTokenValue } from './util'; type ColumnContext = {| completedOrders: boolean, From 109d9d4b1040b6aa9a46618a6007f5e7edb18d82 Mon Sep 17 00:00:00 2001 From: Sorin Chis Date: Tue, 9 Jul 2024 15:19:27 +0300 Subject: [PATCH 06/10] fix missing imports --- .../yoroi-extension/app/containers/swap/orders/OrdersPage.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js index d549039974..c19b295182 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js +++ b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js @@ -35,6 +35,8 @@ import NoOpenOrders from './NoOpenOrders'; import { useRichOrders } from './hooks'; import { createFormattedTokenValues } from './util'; import type { FormattedTokenValue } from './util'; +import type { MappedOrder } from './hooks'; +import type { RemoteTokenInfo } from '../../../api/ada/lib/state-fetch/types'; type ColumnContext = {| completedOrders: boolean, From 2114a2b935444a86b7c6007b5c8c590c3ae46f3b Mon Sep 17 00:00:00 2001 From: Sorin Chis Date: Tue, 9 Jul 2024 15:43:10 +0300 Subject: [PATCH 07/10] add annotation --- .../app/containers/swap/orders/NoCompleteOrders.js | 5 ++++- .../app/containers/swap/orders/NoOpenOrders.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js b/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js index a578ffccc7..dd87e5d358 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js +++ b/packages/yoroi-extension/app/containers/swap/orders/NoCompleteOrders.js @@ -1,7 +1,10 @@ +// @flow + import { Stack, Typography } from '@mui/material'; import { ReactComponent as NoCompleteOders } from '../../../assets/images/revamp/no-complete-orders.inline.svg'; +import type { Node } from 'react'; -const NoCompleteOrders = () => { +const NoCompleteOrders = (): Node => { return ( diff --git a/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js b/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js index 56dc058b59..6527f20e97 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js +++ b/packages/yoroi-extension/app/containers/swap/orders/NoOpenOrders.js @@ -1,7 +1,10 @@ +// @flow + import { Stack, Typography } from '@mui/material'; +import type { Node } from 'react'; import { ReactComponent as NoOpenOders } from '../../../assets/images/revamp/no-open-orders.inline.svg'; -const NoOpenOrders = () => { +const NoOpenOrders = (): Node => { return ( From d1c6a3a244abee457e4c695d937183fc9266347d Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Sat, 13 Jul 2024 13:27:23 +0300 Subject: [PATCH 08/10] after merge fix --- .../app/containers/swap/orders/OrdersPage.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js index c19b295182..8ef706a69d 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js +++ b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js @@ -26,17 +26,8 @@ import type { CardanoConnectorSignRequest } from '../../../connector/types'; import { genLookupOrFail } from '../../../stores/stateless/tokenHelpers'; import moment from 'moment'; import { signTransactionHex } from '../../../api/ada/transactions/signTransactionHex'; -import type { StoresAndActionsProps } from '../../../types/injectedProps.types'; -import { truncateAddressShort } from '../../../utils/formatters'; -import { Quantities } from '../../../utils/quantities'; -import ExplorableHashContainer from '../../widgets/ExplorableHashContainer'; import NoCompleteOrders from './NoCompleteOrders'; import NoOpenOrders from './NoOpenOrders'; -import { useRichOrders } from './hooks'; -import { createFormattedTokenValues } from './util'; -import type { FormattedTokenValue } from './util'; -import type { MappedOrder } from './hooks'; -import type { RemoteTokenInfo } from '../../../api/ada/lib/state-fetch/types'; type ColumnContext = {| completedOrders: boolean, From bd958de39e6c876affef1564ca300667174a4e6b Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Sat, 13 Jul 2024 16:53:57 +0300 Subject: [PATCH 09/10] simplified code a bit --- .../app/containers/swap/orders/OrdersPage.js | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js index 8ef706a69d..390112fc31 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js +++ b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js @@ -380,18 +380,9 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node { .map(c => resolveValueOrGetter(c.width ?? 'auto', columnContext)) .join(' '); - const isOpenOrdersEmpty = openOrders?.length === 0 && !showCompletedOrders; - const isCompleteOrdersEmpty = completedOrders?.length === 0 && showCompletedOrders; - - const handleColumnNames = () => { - if (isOpenOrdersEmpty) { - return []; - } - if (isCompleteOrdersEmpty) { - return []; - } - return columnNames; - }; + const isDisplayOpenOrdersEmpty = openOrders?.length === 0 && !showCompletedOrders; + const isDisplayCompletedOrdersEmpty = completedOrders?.length === 0 && showCompletedOrders; + const safeColumnNames = isDisplayOpenOrdersEmpty || isDisplayCompletedOrdersEmpty ? [] : columnNames; return ( @@ -415,7 +406,7 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node {
)} - {isOpenOrdersEmpty && } - {isCompleteOrdersEmpty && } + {isDisplayOpenOrdersEmpty && } + {isDisplayCompletedOrdersEmpty && } ); } From bd636fc507bb5f4894e97444cafe34c6681763b2 Mon Sep 17 00:00:00 2001 From: vantuz-subhuman Date: Sat, 13 Jul 2024 16:55:14 +0300 Subject: [PATCH 10/10] readability --- .../yoroi-extension/app/containers/swap/orders/OrdersPage.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js index 390112fc31..985d688ada 100644 --- a/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js +++ b/packages/yoroi-extension/app/containers/swap/orders/OrdersPage.js @@ -380,8 +380,8 @@ export default function SwapOrdersPage(props: StoresAndActionsProps): Node { .map(c => resolveValueOrGetter(c.width ?? 'auto', columnContext)) .join(' '); - const isDisplayOpenOrdersEmpty = openOrders?.length === 0 && !showCompletedOrders; - const isDisplayCompletedOrdersEmpty = completedOrders?.length === 0 && showCompletedOrders; + const isDisplayOpenOrdersEmpty = !showCompletedOrders && openOrders?.length === 0; + const isDisplayCompletedOrdersEmpty = showCompletedOrders && completedOrders?.length === 0; const safeColumnNames = isDisplayOpenOrdersEmpty || isDisplayCompletedOrdersEmpty ? [] : columnNames; return (