diff --git a/nym-wallet/package.json b/nym-wallet/package.json index 526a1385b4..66c1dd7f84 100644 --- a/nym-wallet/package.json +++ b/nym-wallet/package.json @@ -45,6 +45,7 @@ "react-error-boundary": "^3.1.3", "react-hook-form": "^7.14.2", "react-router-dom": "6", + "react-to-print": "^2.14.7", "semver": "^6.3.0", "string-to-color": "^2.2.2", "use-clipboard-copy": "^0.2.0", diff --git a/nym-wallet/src/components/TestMyNode/Results/index.tsx b/nym-wallet/src/components/TestMyNode/Results/index.tsx index 6c94f7618e..a5b6e04bb9 100644 --- a/nym-wallet/src/components/TestMyNode/Results/index.tsx +++ b/nym-wallet/src/components/TestMyNode/Results/index.tsx @@ -1,10 +1,11 @@ -import React from 'react'; +import React, { useRef } from 'react'; import { ArrowForward, CheckCircleOutline, Description, Download } from '@mui/icons-material'; import { Box, Button, Card, Chip, CircularProgress, Divider, Grid, Stack, Typography } from '@mui/material'; import format from 'date-fns/format'; import { ResultsCard } from '../components/ResultsCard'; import { ResultsCardDetail } from '../components/ResultsCardDetail'; import { NodePath } from 'src/svg-icons/node-path'; +import { useReactToPrint } from 'react-to-print'; export type Layer = '1' | '2' | '3' | 'gateway'; @@ -76,27 +77,33 @@ export const Results = ({ packetsSent: string; packetsReceived: string; layer: '1' | '2' | '3' | 'gateway'; -}) => ( - <> - - - - Test date - - {format(new Date(), 'dd/MM/yyyy HH:mm')} - - - - - - +}) => { + const ref = useRef(null); + const handleSaveToPdf = useReactToPrint({ documentTitle: 'Test results', content: () => ref.current }); + return ( + <> + + + + Test date + + {format(new Date(), 'dd/MM/yyyy HH:mm')} + + + + + + + + + + + + + - - - - - - - - -); + + ); +}; diff --git a/nym-wallet/src/pages/bonding/node-settings/index.tsx b/nym-wallet/src/pages/bonding/node-settings/index.tsx index 4701e38e3d..c443c1823f 100644 --- a/nym-wallet/src/pages/bonding/node-settings/index.tsx +++ b/nym-wallet/src/pages/bonding/node-settings/index.tsx @@ -14,7 +14,7 @@ import { AppContext, urls } from 'src/context/main'; import { NodeGeneralSettings } from './general-settings'; import { UnbondModal } from '../../../components/Bonding/modals/UnbondModal'; import { nodeSettingsNav } from './node-settings.constant'; -import { TestNode } from 'src/pages/test-my-node'; +import { TestNode } from 'src/pages/bonding/node-settings/test-my-node'; export const NodeSettings = () => { const [confirmationDetails, setConfirmationDetails] = useState(); diff --git a/nym-wallet/src/pages/test-my-node/index.tsx b/nym-wallet/src/pages/bonding/node-settings/test-my-node/index.tsx similarity index 100% rename from nym-wallet/src/pages/test-my-node/index.tsx rename to nym-wallet/src/pages/bonding/node-settings/test-my-node/index.tsx diff --git a/nym-wallet/src/pages/index.ts b/nym-wallet/src/pages/index.ts index 325fe541a2..2976b7890a 100644 --- a/nym-wallet/src/pages/index.ts +++ b/nym-wallet/src/pages/index.ts @@ -5,4 +5,3 @@ export * from './bonding'; export * from './delegation'; export * from './internal-docs'; export * from './unbond'; -export * from './test-my-node'; diff --git a/nym-wallet/src/routes/app.tsx b/nym-wallet/src/routes/app.tsx index c3955a99c0..1b0ba3186e 100644 --- a/nym-wallet/src/routes/app.tsx +++ b/nym-wallet/src/routes/app.tsx @@ -3,16 +3,7 @@ import { Send } from 'src/components/Send'; import { ApplicationLayout } from 'src/layouts'; import { Terminal } from 'src/pages/terminal'; import { Receive } from '../components/Receive'; -import { - Admin, - Balance, - BondingPage, - DelegationPage, - InternalDocs, - NodeSettingsPage, - TestNode, - Unbond, -} from '../pages'; +import { Admin, Balance, BondingPage, DelegationPage, InternalDocs, NodeSettingsPage, Unbond } from '../pages'; export const AppRoutes = () => (