2017-06-29 23:03:11 +00:00
|
|
|
import WalletDecrypt from 'components/WalletDecrypt';
|
2017-09-25 02:06:28 +00:00
|
|
|
import { IWallet } from 'libs/wallet/IWallet';
|
|
|
|
import React from 'react';
|
2017-06-29 23:03:11 +00:00
|
|
|
import { connect } from 'react-redux';
|
2017-09-25 02:06:28 +00:00
|
|
|
import { AppState } from 'reducers';
|
|
|
|
import translate from 'translations';
|
2017-06-26 22:27:55 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
interface Props {
|
|
|
|
title: string;
|
|
|
|
wallet: IWallet;
|
|
|
|
}
|
|
|
|
interface State {
|
|
|
|
expanded: boolean;
|
|
|
|
}
|
|
|
|
export class UnlockHeader extends React.Component<Props, State> {
|
|
|
|
public state = {
|
2017-07-13 21:02:39 +00:00
|
|
|
expanded: !this.props.wallet
|
2017-07-02 05:49:06 +00:00
|
|
|
};
|
2017-06-26 22:27:55 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
public componentDidUpdate(prevProps: Props) {
|
2017-07-04 03:21:19 +00:00
|
|
|
if (this.props.wallet && this.props.wallet !== prevProps.wallet) {
|
|
|
|
this.setState({ expanded: false });
|
|
|
|
}
|
2017-06-29 23:03:11 +00:00
|
|
|
|
2017-07-04 03:21:19 +00:00
|
|
|
// not sure if could happen
|
|
|
|
if (!this.props.wallet && this.props.wallet !== prevProps.wallet) {
|
|
|
|
this.setState({ expanded: true });
|
2017-06-29 23:03:11 +00:00
|
|
|
}
|
2017-07-04 03:21:19 +00:00
|
|
|
}
|
2017-06-29 23:03:11 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
public render() {
|
2017-07-02 05:49:06 +00:00
|
|
|
return (
|
|
|
|
<article className="collapse-container">
|
|
|
|
<div onClick={this.toggleExpanded}>
|
|
|
|
<a className="collapse-button">
|
2017-07-04 03:21:19 +00:00
|
|
|
<span>
|
|
|
|
{this.state.expanded ? '-' : '+'}
|
|
|
|
</span>
|
2017-07-02 05:49:06 +00:00
|
|
|
</a>
|
2017-07-04 03:21:19 +00:00
|
|
|
<h1>
|
|
|
|
{translate(this.props.title)}
|
|
|
|
</h1>
|
2017-07-02 05:49:06 +00:00
|
|
|
</div>
|
v3 Style Import (#151)
* Convert bootstrap to sass instead of checked in and less
* Darken body, adjust header.
* First pass at tab styles, each tab will need a lot of individual love tho.
* Update footer to main site content, improve responsiveness.
* Missing key added.
* Fix dropdowns.
* Convert GenerateWallet HTML over, still needs styling.
* Send form.
* Current rates styled.
* CurrencySwap form styles.
* SwapInfoHeader styled.
* Finish up swap restyling, minor usability improvements for mobile.
* Fix up notifications / alert customizations
* Import v3 variables.
* Fix notification spacing.
* Align input height base with buttons.
* Revert height base, add additional bootstrap overrides.
* Grid overrides.
* Move overrides to their own folder. Adjust naming.
* Fix inconsistencies.
* Style generate wallet pt 1.
* Style generate wallet pt 2
* Style generate wallet pt 3
* Fix swap
* Added some missing overries, fixed the fallout.
* Remove header text, indicate alpha version.
* Fix radio / checkbox weights.
* Bind => arrow
* Convert simpledropdown to proper form select, instead of weirdly implemented nonfuncitoning dropdown.
* Fix token balances buttons, footr icons.
2017-09-05 19:52:01 +00:00
|
|
|
{this.state.expanded && <WalletDecrypt />}
|
2017-07-02 05:49:06 +00:00
|
|
|
{this.state.expanded && <hr />}
|
|
|
|
</article>
|
|
|
|
);
|
|
|
|
}
|
2017-06-26 22:27:55 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
public toggleExpanded = () => {
|
2017-07-02 05:49:06 +00:00
|
|
|
this.setState(state => {
|
|
|
|
return { expanded: !state.expanded };
|
|
|
|
});
|
|
|
|
};
|
2017-06-26 22:27:55 +00:00
|
|
|
}
|
2017-06-29 23:03:11 +00:00
|
|
|
|
2017-09-25 02:06:28 +00:00
|
|
|
function mapStateToProps(state: AppState) {
|
2017-07-04 03:21:19 +00:00
|
|
|
return {
|
2017-07-13 21:02:39 +00:00
|
|
|
wallet: state.wallet.inst
|
2017-07-04 03:21:19 +00:00
|
|
|
};
|
2017-06-29 23:03:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(UnlockHeader);
|