Skip to content

Commit b103ae7

Browse files
authored
Merge pull request #15 from cloudhx/iss12
New feature added
2 parents 6bd0260 + f90b31c commit b103ae7

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

package-lock.json

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"dependencies": {
66
"bootstrap": "^4.3.1",
7+
"bootstrap-social": "^5.1.1",
78
"react": "^16.10.2",
89
"react-dom": "^16.10.2",
910
"react-redux": "^7.1.1",

src/components/common/SignIn.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from "react";
2+
import { Link } from "react-router-dom";
3+
4+
const SignIn = () => {
5+
return (
6+
<div className="jumbotron">
7+
<div class="text-center my-5">
8+
<p>To access your issues, please sign in with your GitHub token</p>
9+
<Link to="token" className="btn btn-primary btn-lg mt-1">
10+
Sign in with your GitHub Token
11+
</Link>
12+
</div>
13+
</div>
14+
);
15+
};
16+
17+
export default SignIn;

src/components/issues/IssuesPage.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import PropTypes from "prop-types";
55
import { bindActionCreators } from "redux";
66
import IssueList from "./IssueList";
77
import Spinner from "../common/Spinner";
8+
import SignIn from "../common/SignIn";
89
import { toast } from "react-toastify";
910

1011
class IssuesPage extends React.Component {
1112
componentDidMount() {
12-
const { issues, actions } = this.props;
13+
const { issues, user, actions } = this.props;
1314

14-
if (issues.length === 0) {
15+
if (typeof user.login !== "undefined" && issues.length === 0) {
1516
actions.loadIssues().catch(error => {
1617
alert("Loading issues failed" + error);
1718
});
@@ -37,7 +38,9 @@ class IssuesPage extends React.Component {
3738
return (
3839
<>
3940
<h2>Open Issues</h2>
40-
{this.props.loading ? (
41+
{typeof this.props.user.login === "undefined" ? (
42+
<SignIn />
43+
) : this.props.loading ? (
4144
<Spinner />
4245
) : (
4346
<IssueList

0 commit comments

Comments
 (0)