Skip to content

Commit fcd8103

Browse files
committed
Minor updates
1 parent 71e587e commit fcd8103

File tree

9 files changed

+31
-80
lines changed

9 files changed

+31
-80
lines changed

package.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
"axios": "^0.19.2",
1717
"date-fns": "^2.15.0",
1818
"history": "^5.0.0",
19-
"i18next": "^19.6.0",
20-
"i18next-xhr-backend": "^3.2.2",
2119
"react": "^16.13.1",
2220
"react-calendar-heatmap": "^1.8.1",
2321
"react-dom": "^16.13.1",
24-
"react-i18next": "^11.7.0",
2522
"react-icons": "^3.10.0",
2623
"react-router": "^5.2.0",
2724
"react-router-dom": "^6.0.0-beta.0",
@@ -55,13 +52,10 @@
5552
]
5653
},
5754
"devDependencies": {
58-
"@types/i18next": "^13.0.0",
59-
"@types/i18next-xhr-backend": "^1.4.2",
6055
"@types/react-calendar-heatmap": "^1.6.2",
6156
"@types/react-icons": "^3.0.0",
6257
"@types/react-router-dom": "^5.1.5",
6358
"@types/styled-components": "^5.1.2",
64-
"@types/yup": "^0.29.3",
6559
"@typescript-eslint/eslint-plugin": "^3.6.0",
6660
"@typescript-eslint/parser": "^3.6.0",
6761
"babel-eslint": "^10.0.3",

src/@types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export interface APIUser {
22
login: string;
3+
type?: string;
34
name: string;
45
followers: number;
56
following: number;

src/components/Header/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable react/button-has-type */
22
import React, { useState } from 'react';
33
import { useNavigate } from 'react-router-dom';
4-
import ReactTooltip from 'react-tooltip';
54

65
import { Container, GithubLogo, SearchForm, MoonIcon, SunIcon, SearchIcon } from './styles';
76

@@ -41,7 +40,6 @@ const Header: React.FC<Props> = ({ themeName, setThemeName }) => {
4140
<div className="theme" data-tip={`Activate ${themeName === 'light' ? 'Dark' : 'Light'} Mode`}>
4241
{themeName === 'light' ? <MoonIcon onClick={toggleTheme} /> : <SunIcon onClick={toggleTheme} />}
4342
</div>
44-
<ReactTooltip place="bottom" type="dark" effect="solid" />
4543
</Container>
4644
);
4745
};

src/components/ProfileData/index.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ interface Orgs {
3636

3737
interface Props {
3838
username: string;
39+
type?: string;
3940
name: string;
4041
avatarUrl: string;
4142
followers: number;
@@ -49,7 +50,7 @@ interface Props {
4950
orgs?: Array<Orgs>;
5051
}
5152

52-
const ProfileData: React.FC<Props> = ({ username, name, avatarUrl, followers, following, company, location, email, blog, bio, twitter, orgs }) => {
53+
const ProfileData: React.FC<Props> = ({ username, type, name, avatarUrl, followers, following, company, location, email, blog, bio, twitter, orgs }) => {
5354
return (
5455
<Container>
5556
<Flex>
@@ -65,19 +66,21 @@ const ProfileData: React.FC<Props> = ({ username, name, avatarUrl, followers, fo
6566
</div>
6667
</Flex>
6768

68-
<Row>
69-
<li className="link-li" onClick={() => window.open(`https://github.com/${username}?tab=followers`, '_blank')} data-tip="Go to user's followers">
70-
<PeopleIcon />
71-
<b>{kFormatter(followers)}</b>
72-
<span>followers</span>
73-
<span>·</span>
74-
</li>
69+
{type !== 'Organization' && (
70+
<Row>
71+
<li className="link-li" onClick={() => window.open(`https://github.com/${username}?tab=followers`, '_blank')} data-tip="Go to user's followers">
72+
<PeopleIcon />
73+
<b>{kFormatter(followers)}</b>
74+
<span>followers</span>
75+
<span>·</span>
76+
</li>
7577

76-
<li className="link-li" onClick={() => window.open(`https://github.com/${username}?tab=following`, '_blank')} data-tip="Go to user's followings">
77-
<b>{kFormatter(following)}</b>
78-
<span>following</span>
79-
</li>
80-
</Row>
78+
<li className="link-li" onClick={() => window.open(`https://github.com/${username}?tab=following`, '_blank')} data-tip="Go to user's followings">
79+
<b>{kFormatter(following)}</b>
80+
<span>following</span>
81+
</li>
82+
</Row>
83+
)}
8184

8285
<Column>
8386
{company && (

src/components/ProfileData/styles.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ export const PeopleIcon = styled(RiGroupLine)`
114114
`;
115115

116116
export const Column = styled.ul`
117+
margin-top: 10px;
117118
padding-bottom: 10px;
118119
border-bottom: 1px solid var(--border);
119120
li {

src/pages/Profile/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useParams } from 'react-router-dom';
33
import { ClipLoader } from 'react-spinners';
44
import ReactTooltip from 'react-tooltip';
55

6+
import { useTitle } from 'react-use';
67
import { Container, Main, LeftSide, RightSide, Repos, CalendarHeading, RepoIcon, OverViewIcon, ProjectsIcon, PackagesIcon, Tab, Loader } from './styles';
78

89
import ProfileData from '../../components/ProfileData';
@@ -101,6 +102,8 @@ const Profile: React.FC = () => {
101102
loadUserInfo();
102103
}, [username]);
103104

105+
useTitle(`GitHub UI Clone${loading || data?.error ? '' : ` | ${data.user.name}`}`);
106+
104107
if (loading) {
105108
return (
106109
<Container panelActive={panelActive} id="main-profile">
@@ -143,7 +146,6 @@ const Profile: React.FC = () => {
143146

144147
return (
145148
<Container panelActive={panelActive} id="main-profile">
146-
<ReactTooltip place="bottom" type="dark" effect="solid" />
147149
<Tab className="desktop">
148150
<div className="wrapper">
149151
<span className="offset" />
@@ -156,6 +158,7 @@ const Profile: React.FC = () => {
156158
<Main>
157159
<LeftSide>
158160
<ProfileData
161+
type={data.user?.type}
159162
username={data.user.login}
160163
bio={data.user?.bio}
161164
name={data.user.name}
@@ -236,6 +239,8 @@ const Profile: React.FC = () => {
236239
)}
237240
</RightSide>
238241
</Main>
242+
243+
<ReactTooltip place="bottom" type="dark" effect="solid" />
239244
</Container>
240245
);
241246
};

src/pages/Repo/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React, { useState, useEffect } from 'react';
44
import { Link, useParams } from 'react-router-dom';
55
import { ClipLoader } from 'react-spinners';
66
import ReactTooltip from 'react-tooltip';
7-
import { useFavicon } from 'react-use';
7+
import { useFavicon, useTitle } from 'react-use';
88

99
import notify from '../../services/toast';
1010

@@ -118,7 +118,7 @@ const Repo: React.FC = () => {
118118

119119
const languagesResponse = await api.get(`repos/${username}/${reponame}/languages`);
120120
const languages = languagesResponse.data;
121-
if (languages !== {}) {
121+
if (Object.keys(languages).length > 0) {
122122
const allMb = sumValues(languages);
123123
const languageKeys = Object.keys(languages);
124124
const calculatedLanguages = languageKeys.map(lang => {
@@ -131,7 +131,7 @@ const Repo: React.FC = () => {
131131
slicedLanguages.forEach(lng => {
132132
remainingValues += Number(lng.percentage);
133133
});
134-
mainLanguages.push({ language: 'Other', percentage: String(remainingValues) });
134+
mainLanguages.push({ language: 'Other', percentage: String(remainingValues.toFixed(2)) });
135135
setLanguages(mainLanguages);
136136
} else setLanguages(calculatedLanguages);
137137
}
@@ -169,6 +169,8 @@ const Repo: React.FC = () => {
169169
loadRepoInfo();
170170
}, [reponame, username]);
171171

172+
useTitle(`GitHub UI Clone${loading || data?.error ? '' : ` | ${username}/${reponame}`}`);
173+
172174
function getLanguageColor(language) {
173175
const languageName = language ? language.replace(' ', '-').toLowerCase() : 'other';
174176
return languageColors[languageName];

src/pages/Repo/styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export const Row = styled.div`
339339
340340
> span {
341341
margin-left: 5px;
342-
font-size: 16px;
342+
font-size: 14px;
343343
color: var(--gray);
344344
}
345345
}

yarn.lock

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@
11101110
dependencies:
11111111
regenerator-runtime "^0.13.4"
11121112

1113-
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.3.1", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7":
1113+
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.3.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7":
11141114
version "7.11.2"
11151115
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"
11161116
integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==
@@ -1685,20 +1685,6 @@
16851685
"@types/react" "*"
16861686
hoist-non-react-statics "^3.3.0"
16871687

1688-
"@types/i18next-xhr-backend@^1.4.2":
1689-
version "1.4.2"
1690-
resolved "https://registry.yarnpkg.com/@types/i18next-xhr-backend/-/i18next-xhr-backend-1.4.2.tgz#e3849b77e77daa1504f02269b1c192dc0e86e507"
1691-
integrity sha512-uykS5BvdSoN+G7j7D19xzR12pEVkWmUrIEIxMsj2brVVzjc3gIthWCQKYqbe/b1q87SLbWb/ZHN9bR4qxi1H6A==
1692-
dependencies:
1693-
i18next-xhr-backend "*"
1694-
1695-
"@types/i18next@^13.0.0":
1696-
version "13.0.0"
1697-
resolved "https://registry.yarnpkg.com/@types/i18next/-/i18next-13.0.0.tgz#403ef338add0104e74d9759f1b39217e7c5d4084"
1698-
integrity sha512-gp/SIShAuf4WOqi8ey0nuI7qfWaVpMNCcs/xLygrh/QTQIXmlDC1E0TtVejweNW+7SGDY7g0lyxyKZIJuCKIJw==
1699-
dependencies:
1700-
i18next "*"
1701-
17021688
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0":
17031689
version "2.0.3"
17041690
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz#4ba8ddb720221f432e443bd5f9117fd22cfd4762"
@@ -1881,11 +1867,6 @@
18811867
dependencies:
18821868
"@types/yargs-parser" "*"
18831869

1884-
"@types/yup@^0.29.3":
1885-
version "0.29.4"
1886-
resolved "https://registry.yarnpkg.com/@types/yup/-/yup-0.29.4.tgz#f7b1f9978180d5155663c1cd0ecdc41a72c23d81"
1887-
integrity sha512-OQ7gZRQb7eSbGu5h57tbK67sgX8UH5wbuqPORTFBG7qiBtOkEf1dXAr0QULyHIeRwaGLPYxPXiQru+40ClR6ng==
1888-
18891870
"@typescript-eslint/eslint-plugin@^2.10.0":
18901871
version "2.34.0"
18911872
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz#6f8ce8a46c7dea4a6f1d171d2bb8fbae6dac2be9"
@@ -5891,13 +5872,6 @@ html-minifier-terser@^5.0.1:
58915872
relateurl "^0.2.7"
58925873
terser "^4.6.3"
58935874

5894-
html-parse-stringify2@2.0.1:
5895-
version "2.0.1"
5896-
resolved "https://registry.yarnpkg.com/html-parse-stringify2/-/html-parse-stringify2-2.0.1.tgz#dc5670b7292ca158b7bc916c9a6735ac8872834a"
5897-
integrity sha1-3FZwtyksoVi3vJFsmmc1rIhyg0o=
5898-
dependencies:
5899-
void-elements "^2.0.1"
5900-
59015875
html-webpack-plugin@4.0.0-beta.11:
59025876
version "4.0.0-beta.11"
59035877
resolved "https://registry.yarnpkg.com/html-webpack-plugin/-/html-webpack-plugin-4.0.0-beta.11.tgz#3059a69144b5aecef97708196ca32f9e68677715"
@@ -6002,20 +5976,6 @@ hyphenate-style-name@^1.0.2:
60025976
resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d"
60035977
integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ==
60045978

6005-
i18next-xhr-backend@*, i18next-xhr-backend@^3.2.2:
6006-
version "3.2.2"
6007-
resolved "https://registry.yarnpkg.com/i18next-xhr-backend/-/i18next-xhr-backend-3.2.2.tgz#769124441461b085291f539d91864e3691199178"
6008-
integrity sha512-OtRf2Vo3IqAxsttQbpjYnmMML12IMB5e0fc5B7qKJFLScitYaXa1OhMX0n0X/3vrfFlpHL9Ro/H+ps4Ej2j7QQ==
6009-
dependencies:
6010-
"@babel/runtime" "^7.5.5"
6011-
6012-
i18next@*, i18next@^19.6.0:
6013-
version "19.6.3"
6014-
resolved "https://registry.yarnpkg.com/i18next/-/i18next-19.6.3.tgz#ce2346161b35c4c5ab691b0674119c7b349c0817"
6015-
integrity sha512-eYr98kw/C5z6kY21ti745p4IvbOJwY8F2T9tf/Lvy5lFnYRqE45+bppSgMPmcZZqYNT+xO0N0x6rexVR2wtZZQ==
6016-
dependencies:
6017-
"@babel/runtime" "^7.10.1"
6018-
60195979
iconv-lite@0.4.24, iconv-lite@^0.4.24:
60205980
version "0.4.24"
60215981
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
@@ -9627,14 +9587,6 @@ react-error-overlay@^6.0.7:
96279587
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108"
96289588
integrity sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA==
96299589

9630-
react-i18next@^11.7.0:
9631-
version "11.7.0"
9632-
resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.7.0.tgz#f27c4c237a274e007a48ac1210db83e33719908b"
9633-
integrity sha512-8tvVkpuxQlubcszZON+jmoCgiA9gCZ74OAYli9KChPhETtq8pJsANBTe9KRLRLmX3ubumgvidURWr0VvKz1tww==
9634-
dependencies:
9635-
"@babel/runtime" "^7.3.1"
9636-
html-parse-stringify2 "2.0.1"
9637-
96389590
react-icons@*, react-icons@^3.10.0:
96399591
version "3.10.0"
96409592
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-3.10.0.tgz#6c217a2dde2e8fa8d293210023914b123f317297"
@@ -11672,11 +11624,6 @@ vm-browserify@^1.0.1:
1167211624
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
1167311625
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==
1167411626

11675-
void-elements@^2.0.1:
11676-
version "2.0.1"
11677-
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"
11678-
integrity sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=
11679-
1168011627
w3c-hr-time@^1.0.1:
1168111628
version "1.0.2"
1168211629
resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd"

0 commit comments

Comments
 (0)