Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React tables migration #540

Merged
merged 8 commits into from
Jul 14, 2023
38 changes: 0 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
"react-select": "^5.7.3",
"react-slider": "^2.0.4",
"react-spinners": "^0.13.8",
"react-table": "^7.8.0",
"react-toastify": "^9.1.3",
"react-tooltip": "^5.13.1",
"reflect-metadata": "^0.1.13",
Expand Down Expand Up @@ -147,7 +146,6 @@
"@types/react-grid-layout": "^1.3.2",
"@types/react-qr-reader": "^2.1.4",
"@types/react-slider": "^1.3.1",
"@types/react-table": "^7.7.14",
"@types/secp256k1": "^4.0.3",
"@types/styled-components": "^5.1.26",
"@types/styled-react-modal": "^1.2.2",
Expand Down
56 changes: 29 additions & 27 deletions src/client/pages/peers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
import { LoadingCard } from '../src/components/loading/LoadingCard';
import { AddPeer } from '../src/views/peers/AddPeer';
import { copyLink, getNodeLink } from '../src/components/generic/helpers';
import { Table } from '../src/components/table';
import { Price } from '../src/components/price/Price';
import Table from '../src/components/table';

const PeersView = () => {
const { loading, data } = useGetPeersQuery();
Expand All @@ -32,73 +32,73 @@ const PeersView = () => {
const columns = useMemo(
() => [
{
Header: 'Peer',
accessor: 'alias',
Cell: ({ row }: any) => (
header: 'Peer',
accessorKey: 'alias',
cell: ({ row }: any) => (
<div style={{ whiteSpace: 'nowrap' }}>
{getNodeLink(row.original.public_key, row.original.alias)}
</div>
),
},
{
Header: 'Sync Peer',
accessor: 'is_sync_peer',
Cell: ({ row }: any) => (
header: 'Sync Peer',
accessorKey: 'is_sync_peer',
cell: ({ row }: any) => (
<div style={{ whiteSpace: 'nowrap' }}>
{row.original.is_sync_peer ? 'Yes' : '-'}
</div>
),
},
{
Header: 'Socket',
accessor: 'socket',
Cell: ({ row }: any) => (
header: 'Socket',
accessorKey: 'socket',
cell: ({ row }: any) => (
<div style={{ whiteSpace: 'nowrap' }}>
{row.original.socket.includes('.onion') ? 'Tor' : 'Clearnet'}
{copyLink(row.original.socket)}
</div>
),
},
{
Header: 'Ping',
accessor: 'ping_time',
Cell: ({ row }: any) => (
header: 'Ping',
accessorKey: 'ping_time',
cell: ({ row }: any) => (
<div style={{ whiteSpace: 'nowrap' }}>
{`${row.original.ping_time} ms`}
</div>
),
},
{
Header: 'Sats Received',
accessor: 'tokens_received',
Cell: ({ row }: any) => (
header: 'Sats Received',
accessorKey: 'tokens_received',
cell: ({ row }: any) => (
<div style={{ whiteSpace: 'nowrap' }}>
<Price amount={row.original.tokens_received} />
</div>
),
},
{
Header: 'Sats Sent',
accessor: 'tokens_sent',
Cell: ({ row }: any) => (
header: 'Sats Sent',
accessorKey: 'tokens_sent',
cell: ({ row }: any) => (
<div style={{ whiteSpace: 'nowrap' }}>
<Price amount={row.original.tokens_sent} />
</div>
),
},
{
Header: 'Bytes Received',
accessor: 'bytes_received',
Cell: ({ row }: any) => (
header: 'Bytes Received',
accessorKey: 'bytes_received',
cell: ({ row }: any) => (
<div style={{ whiteSpace: 'nowrap' }}>
{`${Math.round(row.original.bytes_received * 0.0001) / 100} MB`}
</div>
),
},
{
Header: 'Bytes Sent',
accessor: 'bytes_sent',
Cell: ({ row }: any) => (
header: 'Bytes Sent',
accessorKey: 'bytes_sent',
cell: ({ row }: any) => (
<div style={{ whiteSpace: 'nowrap' }}>
{`${Math.round(row.original.bytes_sent * 0.0001) / 100} MB`}
</div>
Expand Down Expand Up @@ -130,8 +130,10 @@ const PeersView = () => {
<Card mobileNoBackground={true}>
<Table
withBorder={true}
tableColumns={columns}
tableData={tableData}
columns={columns}
data={tableData}
withSorting={true}
withGlobalSort={true}
filterPlaceholder="peers"
/>
</Card>
Expand Down
Loading
Loading