mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-10-20 18:56:21 +00:00
network id column: no truncate and add copy (#572)
This commit is contained in:
1 parent
5f2d985bb3
commit
66350878be
1 file changed
+17
-5
@@ -18,8 +18,7 @@ import * as React from 'react';
|
|||||||
import { Maybe } from '../../../common';
|
import { Maybe } from '../../../common';
|
||||||
import { ColumnProps } from './';
|
import { ColumnProps } from './';
|
||||||
import { Node } from '../../../state';
|
import { Node } from '../../../state';
|
||||||
import { Truncate } from '../../';
|
import { Tooltip, TooltipCopyCallback } from '../../';
|
||||||
import { Tooltip } from '../../';
|
|
||||||
import icon from '../../../icons/fingerprint.svg';
|
import icon from '../../../icons/fingerprint.svg';
|
||||||
|
|
||||||
export class NetworkIdColumn extends React.Component<ColumnProps> {
|
export class NetworkIdColumn extends React.Component<ColumnProps> {
|
||||||
@@ -30,6 +29,7 @@ export class NetworkIdColumn extends React.Component<ColumnProps> {
|
|||||||
public static readonly sortBy = ({ networkId }: Node) => networkId || '';
|
public static readonly sortBy = ({ networkId }: Node) => networkId || '';
|
||||||
|
|
||||||
private data: Maybe<string>;
|
private data: Maybe<string>;
|
||||||
|
private copy: Maybe<TooltipCopyCallback>;
|
||||||
|
|
||||||
public shouldComponentUpdate(nextProps: ColumnProps) {
|
public shouldComponentUpdate(nextProps: ColumnProps) {
|
||||||
return this.data !== nextProps.node.networkId;
|
return this.data !== nextProps.node.networkId;
|
||||||
@@ -45,10 +45,22 @@ export class NetworkIdColumn extends React.Component<ColumnProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<td className="Column">
|
<td className="Column" onClick={this.onClick}>
|
||||||
<Tooltip text={networkId} position="left" />
|
<Tooltip text={networkId} position="left" copy={this.onCopy} />
|
||||||
<Truncate text={networkId} chars={10} />
|
{networkId}
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onCopy = (copy: TooltipCopyCallback) => {
|
||||||
|
this.copy = copy;
|
||||||
|
};
|
||||||
|
|
||||||
|
private onClick = (event: React.MouseEvent) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
if (this.copy != null) {
|
||||||
|
this.copy();
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user