mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-06-13 08:01:02 +00:00
Turbo Render (#298)
* More responsive React updates on scroll * `Icon`s now use shadow dom * Faster Sparkline * Recycle table rows * Separate Header from Chain to avoid vdom diffing * Separate THead from Row.HEADER to avoid vdom diffing * Throttle rendering updates on chain tabs, also styles * Minor tweaks and fixes * Created components for all columns * Wrapping up Column refactor * Rename Row--td to Column * Lazy `Ago` * Update styles for faster layouting * Minor cleanup * Fix Connection * Use shadow DOM in `PolkadotIcon` * Comments and tweaks for the List component * Faster Tooltip and Truncate * Minor tweaks * Tooltiped columns can now be copied * Future-proof Connection * Remove the <div> wrapper from Icon * Fix dash on missing graph data * Clean up some SVGs * Cleanup and comments * Localize the use of `previousKeys` to `recalculateKeys` * Custom appState disjoint from React component state * Make appState and appUpdate refs readonly * Cleanup
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import * as React from 'react';
|
||||
import { Column } from './';
|
||||
import { Node } from '../../../state';
|
||||
import { secondsWithPrecision } from '../../../utils';
|
||||
import icon from '../../../icons/history.svg';
|
||||
|
||||
export class BlockTimeColumn extends React.Component<Column.Props, {}> {
|
||||
public static readonly label = 'Block Time';
|
||||
public static readonly icon = icon;
|
||||
public static readonly width = 80;
|
||||
public static readonly setting = 'blocktime';
|
||||
public static readonly sortBy = ({ blockTime }: Node) =>
|
||||
blockTime == null ? Infinity : blockTime;
|
||||
|
||||
private data = 0;
|
||||
|
||||
public shouldComponentUpdate(nextProps: Column.Props) {
|
||||
return this.data !== nextProps.node.blockTime;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { blockTime } = this.props.node;
|
||||
|
||||
this.data = blockTime;
|
||||
|
||||
return (
|
||||
<td className="Column">{`${secondsWithPrecision(blockTime / 1000)}`}</td>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user