Skip to content

Commit

Permalink
Modernize existing React component code
Browse files Browse the repository at this point in the history
Refactor deprecated code and upgrade to React v16.3

Closes #16
  • Loading branch information
li-boxuan committed May 8, 2018
1 parent 46f1ad5 commit 900d752
Show file tree
Hide file tree
Showing 35 changed files with 1,613 additions and 1,487 deletions.
71 changes: 47 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
"babel-core": "^6.3.17",
"babel-eslint": "^7.1.0",
"babel-loader": "^7.0.0",
"babel-plugin-react-require": "^3.0.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
Expand Down Expand Up @@ -75,13 +77,14 @@
"moment": "2.18.1",
"octicons": "^6.0.0",
"octokat": "^0.7.0",
"prop-types": "^15.6.1",
"qs": "^6.3.0",
"react": "^15.3.2",
"react-bootstrap": "^0.31.0",
"react": "^16.3.2",
"react-bootstrap": "^0.31.5",
"react-dnd": "^2.1.2",
"react-dnd-html5-backend": "^2.1.2",
"react-dom": "^15.3.2",
"react-octicons": "0.0.5",
"react-dom": "^16.3.2",
"react-octicons": "0.2.0",
"react-router": "^3.0.0",
"recordo": "^0.0.6",
"ultramarked": "^1.7.0",
Expand Down
19 changes: 10 additions & 9 deletions src/components/anonymous-modal.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import React from 'react';
import {Component} from 'react';
import * as BS from 'react-bootstrap';
import {GearIcon} from 'react-octicons';

import CurrentUserStore from '../user-store';

let hasAlreadyShownAnonymousModal = false;

const AnonymousModal = React.createClass({
class AnonymousModal extends Component {
onHide = () => {
hasAlreadyShownAnonymousModal = true;
this.setState({ showModal: false});
};

render() {
const onHide = () => {
hasAlreadyShownAnonymousModal = true;
this.setState({ showModal: false});
};
let showModal;
if (CurrentUserStore.getUser()) {
showModal = false;
Expand All @@ -20,7 +21,7 @@ const AnonymousModal = React.createClass({
}

return (
<BS.Modal show={showModal} container={this} onHide={onHide}>
<BS.Modal show={showModal} container={this} onHide={this.onHide}>
<BS.Modal.Header closeButton>Viewing a Board Anonymously</BS.Modal.Header>
<BS.Modal.Body className='anonymous-instructions-body'>
<p>You are currently <strong>not signed in</strong>. GitHub's API only allows <em>60</em> requests per hour for non-authenticated users.</p>
Expand All @@ -35,11 +36,11 @@ const AnonymousModal = React.createClass({
<p>You can enable it by clicking the <BS.Button disabled bsSize='xs'><GearIcon/>{' '}<span className='caret'/></BS.Button> on the top-right corner next to <BS.Button disabled bsStyle='success' bsSize='xs'>Sign In</BS.Button> and selecting "Show More Pull Request Info" or by clicking the <BS.Button disabled bsStyle='success' bsSize='xs'>Sign In</BS.Button>.</p>
</BS.Modal.Body>
<BS.Modal.Footer className='anonymous-instructions-footer'>
<BS.Button bsStyle='primary' onClick={onHide}>Ok, I'll find it if I need it</BS.Button>
<BS.Button bsStyle='primary' onClick={this.onHide}>Ok, I'll find it if I need it</BS.Button>
</BS.Modal.Footer>
</BS.Modal>
);
}
});
}

export default AnonymousModal;
Loading

0 comments on commit 900d752

Please sign in to comment.