mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-21 23:38:31 +00:00
* Initial work on refactoring node definitions to reduce number of places theyre defined, amount of copy pasting. * Use makeAutoNodeNAme instead of manually appending _auto * Add getNetVersion to list of unsupported methods * PR feedback * Rework web template node selector to be a network selector. Refactor some types to help with that. Better handle removing custom nodes. * Remove color dropdown. * Fix selecting custom networks. Show notification if change network intent fails. * Use selectors for current node / network instead of intuiting from nodeSelection * Add id key to all networks, simplify add and remove custom node and network functions. * Fix a lot of uses of network.name to use network.id instead. * Dont allow network chainid conflicts * Fix web3 network by chainid * Add testnet badge to network selector * Change nomenclature from change(Node|Network)(Intent)? to change(Node|Network)(Requested|Succeeded) * tscheck * Better code for chainid collision * Remove console logs * Fix tests * Network selector becomes self contained component used both by web header and electron nav. * Dont select node again * Additional title text * tscheck * Custom node behavior in Electron * Close panel too * Convert node label data into selector function * tscheck * Parens & space
55 lines
1.6 KiB
TypeScript
55 lines
1.6 KiB
TypeScript
import React, { Component } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { Footer, Header } from 'components';
|
|
import { AppState } from 'reducers';
|
|
import Notifications from './Notifications';
|
|
import OfflineTab from './OfflineTab';
|
|
import { getOffline, getLatestBlock } from 'selectors/config';
|
|
import { Query } from 'components/renderCbs';
|
|
import { makeAutoNodeName } from 'libs/nodes';
|
|
import './WebTemplate.scss';
|
|
|
|
interface StateProps {
|
|
isOffline: AppState['config']['meta']['offline'];
|
|
latestBlock: AppState['config']['meta']['latestBlock'];
|
|
}
|
|
|
|
interface OwnProps {
|
|
isUnavailableOffline?: boolean;
|
|
children: string | React.ReactElement<string> | React.ReactElement<string>[];
|
|
}
|
|
|
|
type Props = OwnProps & StateProps;
|
|
|
|
class WebTemplate extends Component<Props, {}> {
|
|
public render() {
|
|
const { isUnavailableOffline, children, isOffline, latestBlock } = this.props;
|
|
|
|
return (
|
|
<div className="WebTemplate">
|
|
<Query
|
|
params={['network']}
|
|
withQuery={({ network }) => (
|
|
<Header networkParam={network && makeAutoNodeName(network)} />
|
|
)}
|
|
/>
|
|
<div className="Tab container">
|
|
{isUnavailableOffline && isOffline ? <OfflineTab /> : children}
|
|
</div>
|
|
<div className="WebTemplate-spacer" />
|
|
<Footer latestBlock={latestBlock} />
|
|
<Notifications />
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
function mapStateToProps(state: AppState): StateProps {
|
|
return {
|
|
isOffline: getOffline(state),
|
|
latestBlock: getLatestBlock(state)
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps, {})(WebTemplate);
|