mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-10 02:55:41 +00:00
371e6e327c
* Reorganize files to better match other components. * Initial UI for wallet buttons. * Fix leftover rebase conflict. * Wallet selection, styling, mobile handling. * Initial work on animations. * Adjusted animations. * Adjust wallet unlock forms to be more uniform. Fix view address saying 'unlock' * Adjust tooltips. * Fix embedded decrypt components. * Cover whole sign msg form with decrypt. * Give deploy contract a better unlock treatment like sign msg. * Reset decrypt component on hide / show * Unused var * Fix tooltip hover. * Fix hover lift. * Make spacing better on mobile. * Back button mobile handling. * Redesign mobile button icons. Prevent clicking through when clicking on icons. * TSCheck fixes. * Attempt to unlock MetaMask onClick, and provide existing flow with notification when unlock fails. * Get rid of outline. * Remove decrypt min height. Make view only textarea. * Add change wallet buttons to deploy contract and sign msg. * Standardize
74 lines
2.0 KiB
TypeScript
74 lines
2.0 KiB
TypeScript
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
import { AppState } from 'reducers';
|
|
import translate from 'translations';
|
|
import WalletDecrypt from 'components/WalletDecrypt';
|
|
import { IWallet } from 'libs/wallet/IWallet';
|
|
import './UnlockHeader.scss';
|
|
|
|
interface Props {
|
|
title: React.ReactElement<any>;
|
|
wallet: IWallet;
|
|
disabledWallets?: string[];
|
|
}
|
|
interface State {
|
|
isExpanded: boolean;
|
|
}
|
|
export class UnlockHeader extends React.Component<Props, State> {
|
|
public state = {
|
|
isExpanded: !this.props.wallet
|
|
};
|
|
|
|
public componentDidUpdate(prevProps: Props) {
|
|
if (this.props.wallet && this.props.wallet !== prevProps.wallet) {
|
|
this.setState({ isExpanded: !this.state.isExpanded });
|
|
}
|
|
}
|
|
|
|
public render() {
|
|
const { title, wallet, disabledWallets } = this.props;
|
|
const { isExpanded } = this.state;
|
|
|
|
return (
|
|
<article className="UnlockHeader">
|
|
<h1 className="UnlockHeader-title">{title}</h1>
|
|
{wallet &&
|
|
!isExpanded && (
|
|
<button
|
|
className="UnlockHeader-open btn btn-default btn-smr"
|
|
onClick={this.toggleisExpanded}
|
|
>
|
|
<span>
|
|
<span className="hidden-xs UnlockHeader-open-text">
|
|
{translate('Change Wallet')}
|
|
</span>
|
|
<i className="fa fa-refresh" />
|
|
</span>
|
|
</button>
|
|
)}
|
|
{wallet &&
|
|
isExpanded && (
|
|
<button className="UnlockHeader-close" onClick={this.toggleisExpanded}>
|
|
<i className="fa fa-times" />
|
|
</button>
|
|
)}
|
|
<WalletDecrypt hidden={!this.state.isExpanded} disabledWallets={disabledWallets} />
|
|
</article>
|
|
);
|
|
}
|
|
|
|
public toggleisExpanded = () => {
|
|
this.setState(state => {
|
|
return { isExpanded: !state.isExpanded };
|
|
});
|
|
};
|
|
}
|
|
|
|
function mapStateToProps(state: AppState) {
|
|
return {
|
|
wallet: state.wallet.inst
|
|
};
|
|
}
|
|
|
|
export default connect(mapStateToProps)(UnlockHeader);
|