Skip to content

Commit

Permalink
chore(app): fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Maurice Dalderup authored and Maurice Dalderup committed Dec 31, 2018
1 parent 0262370 commit cec1c18
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 38 deletions.
64 changes: 33 additions & 31 deletions src/renderer/browser/components/DAppContainer/DAppContainer.js
@@ -1,7 +1,7 @@
import path from 'path';
import React from 'react';
import classNames from 'classnames';
import { bool, string, func } from 'prop-types';
import { bool, string, func, number } from 'prop-types';
import { noop } from 'lodash';

import getStaticPath from '../../../util/getStaticPath';
Expand All @@ -26,14 +26,15 @@ export default class DAppContainer extends React.PureComponent {
empty: func.isRequired,
openTab: func.isRequired,
closeTab: func.isRequired,
onFocus: func // eslint-disable-line react/no-unused-prop-types
}
requestCount: number.isRequired,
onFocus: func
};

static defaultProps = {
className: null,
active: false,
onFocus: noop
}
};

async componentDidMount() {
window.addEventListener('focus', this.handleWindowFocus);
Expand Down Expand Up @@ -101,11 +102,7 @@ export default class DAppContainer extends React.PureComponent {

renderWebView() {
return (
<webview
ref={this.registerRef}
preload={this.getPreloadPath()}
className={styles.webview}
/>
<webview ref={this.registerRef} preload={this.getPreloadPath()} className={styles.webview} />
);
}

Expand All @@ -120,15 +117,15 @@ export default class DAppContainer extends React.PureComponent {
onReject={this.handleReject}
/>
);
}
};

handleWindowFocus = () => {
this.webview.focus();
}
};

handleDomReady = () => {
this.focusAndNotify();
}
};

handleIPCMessage = (event) => {
switch (event.channel) {
Expand All @@ -138,90 +135,95 @@ export default class DAppContainer extends React.PureComponent {
default:
this.handleIPCAPI(event);
}
}
};

handleIPCZoom = (event) => {
const difference = event.args[0] > 0 ? -0.5 : 0.5;

this.webview.getZoomLevel((zoomLevel) => {
this.webview.setZoomLevel(zoomLevel + difference);
});
}
};

handleIPCAPI = (event) => {
const { channel } = event;
const id = event.args[0];
const args = event.args.slice(1);

this.props.enqueue(this.props.sessionId, { channel, id, args });
}
};

handlePageTitleUpdated = (event) => {
this.props.setTabTitle(this.props.sessionId, event.title);
}
};

handlePageIconUpdated = async (event) => {
this.props.setTabIcon(this.props.sessionId, await fetchBestIcon(event.favicons));
}
};

handleNavigatingToPage = (event) => {
this.props.setTabTarget(this.props.sessionId, event.url);
}
};

handleNavigatedToPage = (event) => {
this.props.setTabTarget(this.props.sessionId, event.url);
}
};

handleNavigatedToAnchor = (event) => {
if (event.isMainFrame) {
this.props.setTabTarget(this.props.sessionId, event.url);
}
}
};

handleNavigateFailed = (event) => {
if (event.isMainFrame) {
this.webview.send('did-fail-load', event.validatedURL, event.errorCode, event.errorDescription);
this.webview.send(
'did-fail-load',
event.validatedURL,
event.errorCode,
event.errorDescription
);
}
}
};

handleLoading = () => {
this.props.setTabLoaded(this.props.sessionId, false);
}
};

handleLoaded = () => {
this.props.setTabLoaded(this.props.sessionId, true);
}
};

handleNewWindow = (event) => {
this.props.openTab({ target: event.url });
}
};

handleCloseWindow = () => {
this.props.closeTab(this.props.sessionId);
}
};

handleResolve = (request, result) => {
const { channel, id } = request;
this.webview.send(`${channel}-success-${id}`, result);
this.props.dequeue(this.props.sessionId, id);
}
};

handleReject = (request, message) => {
const { channel, id } = request;
this.webview.send(`${channel}-failure-${id}`, message);
this.props.dequeue(this.props.sessionId, id);
}
};

registerRef = (el) => {
this.webview = el;
}
};

getPreloadPath = () => {
return `file:${path.join(getStaticPath(), 'preloadRenderer.js')}`;
}
};

focusAndNotify = () => {
this.webview.focus();
this.props.onFocus(this.webview.getWebContents().getId());
}
};
}
11 changes: 4 additions & 7 deletions src/renderer/login/components/LoginButton/index.js
Expand Up @@ -8,17 +8,14 @@ import styles from './LoginButton.scss';

const LoginButton = ({ disabled }) => (
<div className={styles.loginButton}>
<PrimaryButton
type="submit"
disabled={disabled}
>
<PrimaryButton type="submit" disabled={disabled}>
Login
</PrimaryButton>
<span className={styles.register}>
New to nOS?{' '}
<Link to="/register">Create an account</Link>
New to nOS? <Link to="/register">Create an account</Link>
</span>
</div>);
</div>
);

LoginButton.propTypes = {
disabled: bool
Expand Down

0 comments on commit cec1c18

Please sign in to comment.