PropTypes and refactoring
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
import React from 'react';
|
||||
import './Configuration.css';
|
||||
import { connect } from 'react-redux';
|
||||
import { createDismissDisplay } from '../../utils.jsx';
|
||||
import Box from '../../components/UI/Box/Box';
|
||||
import Button from '../../components/UI/Button/Button';
|
||||
import ConfigurationItem from './ConfigurationItem/ConfigurationItem';
|
||||
import Modal from '../../components/UI/Modal/Modal';
|
||||
import IPCContainer from '../IPCContainer/IPCContainer';
|
||||
import Modal from '../../components/UI/Modal/Modal';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { createDismissDisplay } from '../../utils.jsx';
|
||||
import { displayConfiguration } from '../../redux/actions/mount_actions';
|
||||
import { notifyError } from '../../redux/actions/error_actions';
|
||||
import { displayPinnedManager } from '../../redux/actions/pinned_manager_actions';
|
||||
import { notifyError } from '../../redux/actions/error_actions';
|
||||
|
||||
const Constants = require('../../constants');
|
||||
|
||||
@@ -455,4 +456,15 @@ const mapDispatchToProps = (dispatch) => {
|
||||
};
|
||||
};
|
||||
|
||||
Configuration.propTypes = {
|
||||
displayPinnedManager: PropTypes.func.isRequired,
|
||||
DisplayConfiguration: PropTypes.string.isRequired,
|
||||
hideConfiguration: PropTypes.func.isRequired,
|
||||
remoteSupported: PropTypes.bool.isRequired,
|
||||
notifyError: PropTypes.func.isRequired,
|
||||
MState: PropTypes.object.isRequired,
|
||||
Platform: PropTypes.string.isRequired,
|
||||
version: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Configuration);
|
||||
|
||||
@@ -9,7 +9,7 @@ export default class IPCContainer extends Component {
|
||||
componentWillUnmount() {
|
||||
if (ipcRenderer) {
|
||||
for (let name in this.handlerList) {
|
||||
if (this.handlerList.hasOwnProperty(name)) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.handlerList, name)) {
|
||||
ipcRenderer.removeListener(name, this.handlerList[name]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class MountItems extends IPCContainer {
|
||||
|
||||
componentWillUnmount() {
|
||||
for (const provider in this.state.RetryItems) {
|
||||
if (this.state.RetryItems.hasOwnProperty(provider)) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.state.RetryItems, provider)) {
|
||||
this.cancelRetryMount(provider);
|
||||
}
|
||||
}
|
||||
@@ -387,7 +387,7 @@ class MountItems extends IPCContainer {
|
||||
let retryList = [];
|
||||
let retryCount = 0;
|
||||
for (const provider in this.state.RetryItems) {
|
||||
if (this.state.RetryItems.hasOwnProperty(provider)) {
|
||||
if (Object.prototype.hasOwnProperty.call(this.state.RetryItems, provider)) {
|
||||
if (this.state.RetryItems[provider].RetryMessage) {
|
||||
retryList.push(
|
||||
<p key={'rl_' + retryList.length}>{this.state.RetryItems[provider].RetryMessage}</p>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import './Import.css';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
const Import = ({ data }) => {
|
||||
return (
|
||||
@@ -35,4 +36,8 @@ const Import = ({ data }) => {
|
||||
);
|
||||
};
|
||||
|
||||
Import.propTypes = {
|
||||
data: PropTypes.object,
|
||||
};
|
||||
|
||||
export default Import;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import './ImportList.css';
|
||||
import Import from './Import/Import';
|
||||
import PropTypes from 'prop-types';
|
||||
import Text from '../../../components/UI/Text/Text';
|
||||
|
||||
const ImportList = ({ imports_array }) => {
|
||||
@@ -34,4 +35,8 @@ const ImportList = ({ imports_array }) => {
|
||||
);
|
||||
};
|
||||
|
||||
ImportList.propTypes = {
|
||||
imports_array: PropTypes.array.isRequired,
|
||||
};
|
||||
|
||||
export default ImportList;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React, { Component } from 'react';
|
||||
import './Password.css';
|
||||
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
export default class Password extends Component {
|
||||
class Password extends Component {
|
||||
state = {
|
||||
button_text: 'clear',
|
||||
password: '',
|
||||
@@ -137,3 +138,15 @@ export default class Password extends Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Password.propTypes = {
|
||||
autoFocus: PropTypes.bool,
|
||||
changed: PropTypes.func,
|
||||
disabled: PropTypes.bool,
|
||||
mismatchHandler: PropTypes.func,
|
||||
readOnly: PropTypes.bool,
|
||||
style: PropTypes.object,
|
||||
value: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Password;
|
||||
|
||||
Reference in New Issue
Block a user