From 56ef23b7d147ccd4b65f87ba68a2891145f00b3c Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Thu, 14 Sep 2023 12:58:45 +0100 Subject: [PATCH] fix linting --- nym-connect/desktop/Cargo.lock | 2 +- nym-connect/desktop/src/growth.tsx | 30 ++++++++++--------- nym-connect/desktop/src/log.tsx | 9 ++++-- nym-wallet/package.json | 2 +- .../Delegation/DelegationActions.tsx | 2 +- .../components/Delegation/DelegationList.tsx | 21 ++----------- .../src/components/Rewards/RewardsSummary.tsx | 10 +++---- nym-wallet/src/context/delegations.tsx | 4 +-- nym-wallet/src/log.tsx | 9 ++++-- 9 files changed, 40 insertions(+), 49 deletions(-) diff --git a/nym-connect/desktop/Cargo.lock b/nym-connect/desktop/Cargo.lock index 9e3096872a..632e47acec 100644 --- a/nym-connect/desktop/Cargo.lock +++ b/nym-connect/desktop/Cargo.lock @@ -4026,7 +4026,7 @@ dependencies = [ [[package]] name = "nym-connect" -version = "1.1.20" +version = "1.1.21" dependencies = [ "anyhow", "bip39", diff --git a/nym-connect/desktop/src/growth.tsx b/nym-connect/desktop/src/growth.tsx index d90a8bb462..683b49c2e1 100644 --- a/nym-connect/desktop/src/growth.tsx +++ b/nym-connect/desktop/src/growth.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import ReactDOM from 'react-dom'; +import { createRoot } from 'react-dom/client'; import { ErrorBoundary } from 'react-error-boundary'; import { ClientContextProvider } from './context/main'; import { ErrorFallback } from './components/Error'; @@ -7,17 +7,19 @@ import { NymShipyardTheme } from './theme'; import { TestAndEarnPopup } from './components/Growth/TestAndEarnPopup'; import { TestAndEarnContextProvider } from './components/Growth/context/TestAndEarnContext'; -const root = document.getElementById('root-growth'); +const elem = document.getElementById('root-growth'); -ReactDOM.render( - - - - - - - - - , - root, -); +if (elem) { + const root = createRoot(elem); + root.render( + + + + + + + + + , + ); +} diff --git a/nym-connect/desktop/src/log.tsx b/nym-connect/desktop/src/log.tsx index cd17271368..ffce19c1d9 100644 --- a/nym-connect/desktop/src/log.tsx +++ b/nym-connect/desktop/src/log.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import ReactDOM from 'react-dom'; +import { createRoot } from 'react-dom/client'; import { ErrorBoundary } from 'react-error-boundary'; import { LogViewer } from './components/LogViewer'; import { ErrorFallback } from './components/ErrorFallback'; @@ -13,6 +13,9 @@ const Log = () => ( ); -const root = document.getElementById('root-log'); +const elem = document.getElementById('root-log'); -ReactDOM.render(, root); +if (elem) { + const root = createRoot(elem); + root.render(); +} diff --git a/nym-wallet/package.json b/nym-wallet/package.json index daf25e8142..6563f39079 100644 --- a/nym-wallet/package.json +++ b/nym-wallet/package.json @@ -31,7 +31,7 @@ "@nymproject/mui-theme": "^1.0.0", "@nymproject/react": "^1.0.0", "@nymproject/types": "^1.0.0", - "@nymproject/node-tester": ">=1.2.0-rc.1 || ^1", + "@nymproject/node-tester": ">=1.2.0-rc.5", "@storybook/react": "^6.5.15", "@tauri-apps/api": "^1.2.0", "@tauri-apps/tauri-forage": "^1.0.0-beta.2", diff --git a/nym-wallet/src/components/Delegation/DelegationActions.tsx b/nym-wallet/src/components/Delegation/DelegationActions.tsx index c605d319ed..3aa9364d98 100644 --- a/nym-wallet/src/components/Delegation/DelegationActions.tsx +++ b/nym-wallet/src/components/Delegation/DelegationActions.tsx @@ -89,7 +89,7 @@ export const DelegationsActionsMenu: FCWithChildren<{ /> } onClick={() => handleActionSelect('undelegate')} /> C} onClick={() => handleActionSelect('redeem')} diff --git a/nym-wallet/src/components/Delegation/DelegationList.tsx b/nym-wallet/src/components/Delegation/DelegationList.tsx index 19a412f667..c5e0a896dd 100644 --- a/nym-wallet/src/components/Delegation/DelegationList.tsx +++ b/nym-wallet/src/components/Delegation/DelegationList.tsx @@ -1,16 +1,5 @@ import React from 'react'; -import { - Box, - Stack, - Table, - TableBody, - TableCell, - TableContainer, - TableHead, - TableRow, - TableSortLabel, - Typography, -} from '@mui/material'; +import { Box, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, TableSortLabel } from '@mui/material'; import { visuallyHidden } from '@mui/utils'; import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; import { orderBy as _orderBy } from 'lodash'; @@ -20,7 +9,6 @@ import { isDelegation, isPendingDelegation, TDelegations } from '../../context/d import { DelegationItem } from './DelegationItem'; import { PendingDelegationItem } from './PendingDelegationItem'; import { LoadingModal } from '../Modals/LoadingModal'; -import { InfoTooltip } from '../InfoToolTip'; type Order = 'asc' | 'desc'; type AdditionalTypes = { profit_margin_percent: number; operating_cost: number }; @@ -48,12 +36,7 @@ const headCells: HeadCell[] = [ { id: 'stake_saturation', label: 'Stake saturation', sortable: true, align: 'left' }, { id: 'delegated_on_iso_datetime', - label: ( - - - Delegated on - - ), + label: 'Delegated on', sortable: true, align: 'left', }, diff --git a/nym-wallet/src/components/Rewards/RewardsSummary.tsx b/nym-wallet/src/components/Rewards/RewardsSummary.tsx index 2353c16b66..c6e48b395c 100644 --- a/nym-wallet/src/components/Rewards/RewardsSummary.tsx +++ b/nym-wallet/src/components/Rewards/RewardsSummary.tsx @@ -1,8 +1,8 @@ -import React, { useMemo } from 'react'; +import React from 'react'; import { CircularProgress, Stack, Typography } from '@mui/material'; import { useTheme } from '@mui/material/styles'; -import { InfoTooltip } from '../InfoToolTip'; import { useDelegationContext } from 'src/context/delegations'; +import { InfoTooltip } from '../InfoToolTip'; export const RewardsSummary: FCWithChildren<{ isLoading?: boolean; @@ -16,21 +16,21 @@ export const RewardsSummary: FCWithChildren<{ - + Total delegations: {isLoading ? : totalDelegationsAndRewards || '-'} - + Original delegations: {isLoading ? : totalDelegation || '-'} - + Total rewards: {isLoading ? : totalRewards || '-'} diff --git a/nym-wallet/src/context/delegations.tsx b/nym-wallet/src/context/delegations.tsx index 670ebba312..5f235e0703 100644 --- a/nym-wallet/src/context/delegations.tsx +++ b/nym-wallet/src/context/delegations.tsx @@ -111,13 +111,13 @@ export const DelegationContextProvider: FC<{ }, })); - const totalDelegationsAndRewards = (+data.total_delegations.amount + +data.total_rewards.amount).toFixed(6); + const delegationsAndRewards = (+data.total_delegations.amount + +data.total_rewards.amount).toFixed(6); setPendingDelegations(pending); setDelegations([...items, ...pendingOnNewNodes]); setTotalDelegations(`${data.total_delegations.amount} ${data.total_delegations.denom}`); setTotalRewards(`${data.total_rewards.amount} ${data.total_rewards.denom}`); - setTotalDelegationsAndRewards(`${totalDelegationsAndRewards} ${data.total_delegations.denom}`); + setTotalDelegationsAndRewards(`${delegationsAndRewards} ${data.total_delegations.denom}`); } catch (e) { Console.error(e); } diff --git a/nym-wallet/src/log.tsx b/nym-wallet/src/log.tsx index 5b4055d5be..8fc9f166c1 100644 --- a/nym-wallet/src/log.tsx +++ b/nym-wallet/src/log.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import ReactDOM from 'react-dom'; +import { createRoot } from 'react-dom/client'; import { ErrorBoundary } from 'react-error-boundary'; import { LogViewer } from './components/LogViewer'; import { ErrorFallback } from './components'; @@ -13,6 +13,9 @@ const Log = () => ( ); -const root = document.getElementById('root-log'); +const elem = document.getElementById('root-log'); -ReactDOM.render(, root); +if (elem) { + const root = createRoot(elem); + root.render(); +}