mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-09 10:41:56 +00:00
27 lines
618 B
TypeScript
27 lines
618 B
TypeScript
|
import React, { Component } from 'react';
|
||
|
import { connect } from 'react-redux';
|
||
|
import { isUnlocked } from 'selectors/wallet';
|
||
|
import { AppState } from 'reducers';
|
||
|
|
||
|
interface OwnProps {
|
||
|
whenUnlocked: React.ReactElement<any> | null;
|
||
|
}
|
||
|
|
||
|
interface StateProps {
|
||
|
isUnlocked: boolean;
|
||
|
}
|
||
|
|
||
|
function mapStateToProps(state: AppState) {
|
||
|
return {
|
||
|
isUnlocked: isUnlocked(state)
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class OnlyUnlockedClass extends Component<OwnProps & StateProps> {
|
||
|
public render() {
|
||
|
return this.props.isUnlocked ? this.props.whenUnlocked : null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export const OnlyUnlocked = connect(mapStateToProps)(OnlyUnlockedClass);
|