Skip to content

Commit 30bb476

Browse files
committed
feat: refine list of fiber graph nodes
1. hide chain hash column 2. adjust layout of mobile
1 parent 9074c40 commit 30bb476

File tree

3 files changed

+57
-50
lines changed

3 files changed

+57
-50
lines changed

src/pages/Fiber/GraphNode/index.tsx

-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import GraphChannelList from '../../../components/GraphChannelList'
1515
import { getFundingThreshold } from '../utils'
1616
import { shannonToCkb } from '../../../utils/util'
1717
import { parseNumericAbbr } from '../../../utils/chart'
18-
import { ChainHash } from '../../../constants/fiberChainHash'
1918
import { Link } from '../../../components/Link'
2019
import { localeNumberString } from '../../../utils/number'
2120

@@ -161,8 +160,6 @@ const GraphNode = () => {
161160
navigator?.clipboard.writeText(copyText).then(() => setToast({ message: t('common.copied') }))
162161
}
163162

164-
const chain = ChainHash.get(node.chainHash) ?? '-'
165-
166163
return (
167164
<Content>
168165
<div className={styles.container} onClick={handleCopy}>
@@ -214,12 +211,6 @@ const GraphNode = () => {
214211
<dt>{t('fiber.graph.node.first_seen')}</dt>
215212
<dd>{dayjs(+node.timestamp).format(TIME_TEMPLATE)}</dd>
216213
</dl>
217-
<dl>
218-
<dt>{t('fiber.graph.node.chain')}</dt>
219-
<dd>
220-
<Tooltip title={node.chainHash}>{chain}</Tooltip>
221-
</dd>
222-
</dl>
223214
<dl>
224215
<dt>{t('fiber.graph.node.total_capacity')}</dt>
225216
<dd>{totalCkb}</dd>

src/pages/Fiber/GraphNodeList/index.module.scss

+47-22
Original file line numberDiff line numberDiff line change
@@ -106,60 +106,85 @@
106106
margin: 24px 20px;
107107
}
108108

109-
@media screen and (width < 1330px) {
109+
@media screen and (width < 1400px) {
110110
font-size: 14px;
111111

112112
table {
113-
th,
114-
td {
115-
&:nth-child(6) {
116-
display: none;
113+
tr:not([data-role='pagination']) {
114+
th,
115+
td {
116+
&:nth-child(5) {
117+
display: none;
118+
}
117119
}
118120
}
119121
}
120122
}
121123

122-
@media screen and (width < 810px) {
124+
@media screen and (width < 1240px) {
123125
table {
124126
tr:not([data-role='pagination']) {
125127
th,
126128
td {
127-
&:last-child {
129+
&:nth-child(1) {
128130
display: none;
129131
}
130132
}
131133
}
132134
}
133135
}
134136

135-
@media screen and (width < 900px) {
137+
@media screen and (width < 1024px) {
136138
table {
137-
th,
138-
td {
139-
&:nth-child(5) {
140-
display: none;
139+
tr:not([data-role='pagination']) {
140+
th,
141+
td {
142+
&:nth-child(2) {
143+
display: none;
144+
}
141145
}
142146
}
143147
}
144148
}
145149

146-
@media screen and (width < 700px) {
150+
@media screen and (width < 840px) {
147151
table {
148-
th,
149-
td {
150-
&:nth-child(3) {
151-
display: none;
152+
tr:not([data-role='pagination']) {
153+
th,
154+
td {
155+
&:last-child {
156+
display: none;
157+
}
152158
}
153159
}
154160
}
155161
}
156162

157-
@media screen and (width < 520px) {
163+
@media screen and (width < 545px) {
158164
table {
159-
th,
160-
td {
161-
&:first-child {
162-
display: none;
165+
tr:not([data-role='pagination']) {
166+
th,
167+
td {
168+
&:nth-child(6) {
169+
display: none;
170+
}
171+
172+
&:nth-child(1) {
173+
display: table-cell;
174+
}
175+
}
176+
}
177+
}
178+
}
179+
180+
@media screen and (width < 450px) {
181+
table {
182+
tr:not([data-role='pagination']) {
183+
th,
184+
td {
185+
&:nth-child(3) {
186+
display: none;
187+
}
163188
}
164189
}
165190
}

src/pages/Fiber/GraphNodeList/index.tsx

+10-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useQuery } from '@tanstack/react-query'
22
import { useTranslation } from 'react-i18next'
33
import { Link } from 'react-router-dom'
44
import { Tooltip } from 'antd'
5-
import { CopyIcon, InfoCircledIcon } from '@radix-ui/react-icons'
5+
import { CopyIcon, InfoCircledIcon, LinkBreak2Icon } from '@radix-ui/react-icons'
66
import dayjs from 'dayjs'
77
import Content from '../../../components/Content'
88
import { useSetToast } from '../../../components/Toast'
@@ -16,7 +16,6 @@ import styles from './index.module.scss'
1616
import { shannonToCkb } from '../../../utils/util'
1717
import { parseNumericAbbr } from '../../../utils/chart'
1818
import { localeNumberString } from '../../../utils/number'
19-
import { ChainHash } from '../../../constants/fiberChainHash'
2019

2120
const TIME_TEMPLATE = 'YYYY/MM/DD hh:mm:ss'
2221

@@ -108,29 +107,21 @@ const fields = [
108107
)
109108
},
110109
},
111-
{
112-
key: 'chainHash',
113-
label: 'chain',
114-
transformer: (v: unknown) => {
115-
if (typeof v !== 'string') return v
116-
const chain = ChainHash.get(v) ?? '-'
117-
return (
118-
<span className={styles.chainHash}>
119-
<Tooltip title={v}>{chain}</Tooltip>
120-
<button type="button" data-copy-text={v}>
121-
<CopyIcon />
122-
</button>
123-
</span>
124-
)
125-
},
126-
},
127110
{
128111
key: 'addresses',
129112
label: 'addresses',
130113
transformer: (v: unknown) => {
131114
if (!Array.isArray(v)) return v
132115
const addr = v[0]
133-
if (!addr || typeof addr !== 'string') return v
116+
if (!addr || typeof addr !== 'string') {
117+
return (
118+
<Tooltip title="Not Revealed">
119+
<span>
120+
<LinkBreak2Icon />
121+
</span>
122+
</Tooltip>
123+
)
124+
}
134125
return (
135126
<span className={styles.address}>
136127
<Tooltip title={addr}>

0 commit comments

Comments
 (0)