Skip to content

Commit 1521548

Browse files
authored
Merge pull request #2 from GreenTreeTeam/v0.2.0
feat: v0.2.0
2 parents a28fbd6 + b1b66be commit 1521548

File tree

11 files changed

+11901
-11775
lines changed

11 files changed

+11901
-11775
lines changed

README.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Get Github stats of any user in just one click
4646

4747
### Built With
4848

49-
* [Semantic UI <3](https://semantic-ui.com/)
50-
* [SCSS](https://sass-lang.com/)
49+
- [Semantic UI <3](https://semantic-ui.com/)
50+
- [SCSS](https://sass-lang.com/)
5151

5252
## Getting Started
5353

@@ -60,26 +60,31 @@ To get a local copy up and running follow these simple steps.
6060
git clone https://github.com/GreenTreeTeam/GithubStats.git
6161
```
6262
2. Install NPM packages
63+
6364
```sh
6465
yarn
6566
```
6667

67-
3.Start the app
68-
```sh
69-
yarn start
68+
3.Start the app
69+
70+
```sh
71+
yarn start
7072
```
71-
73+
7274
## Usage
73-
Visit [localhost:3000](http://localhost:3000) to view the webpage
7475

76+
Visit [localhost:3000](http://localhost:3000) to view the webpage
7577

7678
## Roadmap
7779

78-
See the [open issues](https://github.com/GreenTreeTeam/GithubStats/issues) for a list of proposed features (and known issues).
80+
See the [open issues](https://github.com/GreenTreeTeam/GithubStats/issues) for a
81+
list of proposed features (and known issues).
7982

8083
## Contributing
8184

82-
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
85+
Contributions are what make the open source community such an amazing place to
86+
be learn, inspire, and create. Any contributions you make are **greatly
87+
appreciated**.
8388

8489
1. Fork the Project
8590
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "my-app",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"private": true,
55
"dependencies": {
66
"@testing-library/jest-dom": "^5.11.4",

public/index.html

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
3-
4-
<head>
5-
<meta charset="utf-8" />
6-
<link rel="icon" href="https://brandslogo.net/wp-content/uploads/2015/09/github-mark-logo.png" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1" />
8-
<meta name="theme-color" content="RANDOM" />
9-
<meta name="title" content="GitHub Stats">
10-
<meta name="description" content="Get anyone's GitHub stats easier in just an single click!">
11-
<meta property="og:type" content="website">
12-
<meta property="og:url" content="https://sudhanplayz-codespaces-73pr-3000.githubpreview.dev/">
13-
<meta property="og:title" content="GitHub Stats">
14-
<meta property="og:description" content="Get anyone's GitHub stats easier in just an single click!">
15-
<meta property="og:image" content="https://brandslogo.net/wp-content/uploads/2015/09/github-mark-logo.png">
16-
<meta property="twitter:card" content="summary_large_image">
17-
<meta property="twitter:url" content="https://sudhanplayz-codespaces-73pr-3000.githubpreview.dev/">
18-
<meta property="twitter:title" content="GitHub Stats">
19-
<meta property="twitter:description" content="Get anyone's GitHub stats easier in just an single click!">
20-
<meta property="twitter:image" content="https://brandslogo.net/wp-content/uploads/2015/09/github-mark-logo.png">
21-
<title>GitHub Stats</title>
22-
</head>
23-
24-
<body>
25-
<noscript>It looks like you're using an old browser which doesnt support Javascipt or You disabled Javascript on this site, please enable Javascipt in-order to use this site</noscript>
26-
<div id="root"></div>
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<link rel="icon" href="https://cdn.discordapp.com/emojis/863032665400541184.png?v=1" />
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<meta name="theme-color" content="#9A35FF" />
9+
<meta name="title" content="GitHub Stats">
10+
<meta name="description" content="Get anyone's GitHub stats easier in just an single click!">
11+
<meta property="og:type" content="website">
12+
<meta property="og:url" content="https://stats.greentree.team">
13+
<meta property="og:title" content="GitHub Stats">
14+
<meta property="og:description" content="Get anyone's GitHub stats easier in just an single click!">
15+
<meta property="og:image" content="https://cdn.discordapp.com/emojis/863032665400541184.png?v=1">
16+
<meta property="twitter:card" content="summary_large_image">
17+
<meta property="twitter:url" content="https://stats.greentree.team">
18+
<meta property="twitter:title" content="GitHub Stats">
19+
<meta property="twitter:description" content="Get anyone's GitHub stats easier in just an single click!">
20+
<meta property="twitter:image" content="https://cdn.discordapp.com/emojis/863032665400541184.png?v=1">
21+
<title>GitHub Stats</title>
22+
</head>
23+
24+
<body>
25+
<noscript>It looks like you're using an old browser which doesnt support Javascript or You disabled Javascript on this site, please enable Javascript in-order to use this site</noscript>
26+
<div id="root"></div>
2727
</html>

public/robots.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# https://www.robotstxt.org/robotstxt.html
2-
User-agent: *
3-
Disallow:
1+
# https://www.robotstxt.org/robotstxt.html
2+
User-agent: *
3+
Disallow:

src/App.tsx

Lines changed: 181 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,181 @@
1-
import React, { useState } from 'react';
2-
import { Header, Input, Icon, Card } from "semantic-ui-react"
3-
import Styles from './styles/style.module.scss';
4-
import GetUserDetails from "./Utils/GetUserDetails";
5-
import { ToastContainer, toast } from "react-toastify"
6-
7-
function App() {
8-
const [Searching, setSearching] = useState(false);
9-
const [Username, setUsername] = useState("")
10-
const [User, setUser] = useState({ avatar_url: "", login: "", name: "", bio: "", followers: 0 })
11-
12-
const handleClick = async (e: any) => {
13-
if (Searching) return
14-
setSearching(true)
15-
if (!Username || Username.trim() === "") return setSearching(false)
16-
let NeedToAddStyle = false;
17-
//@ts-ignore ;-;
18-
let deepesh = await GetUserDetails(Username)
19-
if (User.login === "") NeedToAddStyle = true
20-
21-
//@ts-ignore ;
22-
if (deepesh.error) {
23-
//@ts-ignore ahh shit here we go again lol
24-
toast(deepesh.stack, {
25-
type: "error"
26-
})
27-
return setSearching(false)
28-
}
29-
30-
//@ts-ignore ;-;
31-
setUser(deepesh);
32-
if (NeedToAddStyle) document.querySelector("." + Styles.Content)?.setAttribute("style", "display: flex;")
33-
setSearching(false)
34-
}
35-
36-
const Extra = <div>
37-
<a href={"https://github.com/" + Username }> <Icon name='user' />{User.followers} Followers</a>
38-
</div>
39-
return (
40-
<div>
41-
<ToastContainer />
42-
<div className={Styles.MainHeader}>
43-
<Header center aligned={true} inverted size="large">GitHub Stats
44-
<Header.Subheader center aligned={true} inverted>Get anyone's GitHub stats easier in just an single click!</Header.Subheader>
45-
</Header>
46-
</div>
47-
48-
<div className={Styles.Search}>
49-
<Input disabled={Searching ? true : false} loading={Searching ? true : false} icon={true} placeholder='GreenTreeTeam'>
50-
<input onChange={(e) => setUsername(e.target.value)} />
51-
<Icon loading={Searching ? true : false} disabled={Searching ? true : false} name='search' inverted circular={true} link={true} onClick={handleClick} />
52-
</Input>
53-
</div>
54-
55-
<div className={Styles.Content}>
56-
<Card
57-
image={User.avatar_url}
58-
header={User.name}
59-
meta={User.login}
60-
description={User.bio}
61-
extra={Extra}
62-
/>
63-
</div>
64-
</div>
65-
);
66-
}
67-
68-
export default App;
1+
import React, { useState } from "react";
2+
import { Header, Input, Icon, Card } from "semantic-ui-react";
3+
import Styles from "./styles/style.module.scss";
4+
import GetUserDetails from "./Utils/GetUserDetails";
5+
import { ToastContainer, toast } from "react-toastify";
6+
7+
function App() {
8+
const [Searching, setSearching] = useState(false);
9+
const [Username, setUsername] = useState("");
10+
const [User, setUser] = useState({
11+
avatar_url: "",
12+
login: "",
13+
name: "",
14+
bio: "",
15+
followers: null,
16+
following: null,
17+
location: "",
18+
type: "",
19+
created_at: "",
20+
public_repos: 0,
21+
public_gists: 0,
22+
id: 0,
23+
});
24+
25+
const handleClick = async (e: any) => {
26+
if (Searching) return;
27+
setSearching(true);
28+
if (!Username || Username.trim() === "") return setSearching(false);
29+
let NeedToAddStyle = false;
30+
let userData = await GetUserDetails(Username);
31+
if (User.login === "") NeedToAddStyle = true;
32+
33+
//@ts-ignore ;
34+
if (userData.error) {
35+
//@ts-ignore ahh shit here we go again lol
36+
toast(userData.stack, {
37+
type: "error",
38+
});
39+
return setSearching(false);
40+
//@ts-ignore
41+
} else if (userData.message) {
42+
//@ts-ignore
43+
toast("Github API Rate Limit.", {
44+
// cuz yes :(
45+
type: "error",
46+
});
47+
return setSearching(false);
48+
}
49+
50+
//@ts-ignore ;-;
51+
setUser(userData);
52+
if (NeedToAddStyle)
53+
document.querySelector("." + Styles.Content)?.setAttribute("style", "display: flex;");
54+
setSearching(false);
55+
};
56+
57+
const handleKeyPress = async (e: any) => {
58+
e.preventDefault();
59+
handleClick(e);
60+
};
61+
62+
const Extra = (
63+
<div>
64+
<a target="blank" href={"https://github.com/" + Username}>
65+
{" "}
66+
<Icon name="info circle" />
67+
{User.followers ? "ID: " + User.id : "ID: Unknown"}
68+
</a>
69+
<br />
70+
<br />
71+
<a target="blank" href={"https://github.com/" + Username}>
72+
{" "}
73+
<Icon name="user circle outline" />
74+
{User.followers ? "Followers: " + User.followers : "Followers: None"}
75+
</a>
76+
<br />
77+
<br />
78+
<a target="blank" href={"https://github.com/" + Username}>
79+
{" "}
80+
<Icon name="user circle outline" />
81+
{User.following ? "Following: " + User.following : "Following: None"}
82+
</a>
83+
<br />
84+
<br />
85+
<a target="blank" href={"https://github.com/" + Username}>
86+
{" "}
87+
<Icon name="location arrow" />
88+
{User.location ? `Location: ` + User.location : "Location: None"}
89+
</a>
90+
<br />
91+
<br />
92+
<a target="blank" href={"https://github.com/" + Username}>
93+
{" "}
94+
<Icon name="question circle outline" />
95+
{User.type ? `Type: ` + User.type : "Type: Unknown"}
96+
</a>
97+
<br />
98+
<br />
99+
<a target="blank" href={"https://github.com/" + Username}>
100+
{" "}
101+
<Icon name="calendar times outline" />
102+
{User.created_at
103+
? `Created At: ` +
104+
new Date(User.created_at).toLocaleDateString() +
105+
" " +
106+
new Date(User.created_at).toLocaleTimeString()
107+
: "Created At: Unknown Date"}
108+
</a>
109+
<br />
110+
<br />
111+
<a target="blank" href={"https://github.com/" + Username + "?tab=repositories"}>
112+
{" "}
113+
<Icon name="github" />
114+
{User.public_repos === 0
115+
? "Public Repos: No Repos"
116+
: "Public Repos: " + User.public_repos + " Repos"}
117+
</a>
118+
<br />
119+
<br />
120+
<a target="blank" href={"https://gist.github.com/" + Username}>
121+
{" "}
122+
<Icon name="github" />
123+
{User.public_gists === 0
124+
? "Public Gists: No Gists"
125+
: "Public Gists: " + User.public_gists + " Gists"}
126+
</a>
127+
</div>
128+
);
129+
return (
130+
<div>
131+
<ToastContainer />
132+
<div className={Styles.MainHeader}>
133+
<Header center aligned={true} inverted size="large">
134+
GitHub Stats
135+
<Header.Subheader center aligned={true} inverted>
136+
Get anyone's GitHub stats easier in just an single click!
137+
</Header.Subheader>
138+
</Header>
139+
</div>
140+
141+
<div className={Styles.Search}>
142+
<form onSubmit={handleKeyPress}>
143+
<Input
144+
disabled={Searching ? true : false}
145+
loading={Searching ? true : false}
146+
icon={true}
147+
placeholder="GreenTreeTeam"
148+
>
149+
<input
150+
onChange={(e) =>
151+
setUsername(e.target.value.trim().split(/ +/g).join("-"))
152+
}
153+
/>
154+
<Icon
155+
loading={Searching ? true : false}
156+
disabled={Searching ? true : false}
157+
name="search"
158+
inverted
159+
circular={true}
160+
link={true}
161+
onClick={handleClick}
162+
/>
163+
</Input>
164+
</form>
165+
</div>
166+
167+
<div className={Styles.Content}>
168+
<Card
169+
image={User.avatar_url}
170+
header={User.name}
171+
meta={User.login}
172+
description={User.bio ? User.bio : "No Bio"}
173+
extra={Extra}
174+
raised={true}
175+
/>
176+
</div>
177+
</div>
178+
);
179+
}
180+
181+
export default App;

0 commit comments

Comments
 (0)