Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021_dev-profile
/
dev-profile
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김채리
2021-06-07 04:01:34 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
f688d2d0b02baceaf62d35636219ab35285c5774
f688d2d0
2 parents
9aa8455a
6ba26def
Fixed merge confilct changes
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
37 deletions
src/client/js/githubInfo.js
src/views/userDetail.pug
src/client/js/githubInfo.js
View file @
f688d2d
const
userContributionsBox
=
document
.
querySelector
(
".user-status__contributions"
);
const
totalContributionIndicator
=
document
.
getElementById
(
"jsTotalContributions"
);
const
userCharacterBox
=
document
.
querySelector
(
".user-status__character"
);
const
userRepoBox
=
document
.
querySelector
(
".user-repo"
);
const
URL
=
"https://api.github.com/users/lsj8706/repos?sort=updated&per_page=2"
;
const
handleImage
=
()
=>
{
const
total
=
totalContributionIndicator
.
innerText
;
console
.
log
(
total
);
const
img
=
new
Image
();
if
(
total
>=
0
&&
total
<
200
){
img
.
src
=
"https://oss-2020105657.s3.amazonaws.com/first.png"
;
img
.
alt
=
"1단계"
;
}
else
if
(
total
>=
200
&&
total
<
600
){
img
.
src
=
"https://oss-2020105657.s3.amazonaws.com/second.png"
;
img
.
alt
=
"2단계"
;
}
else
if
(
total
>=
600
&&
total
<
1200
){
img
.
src
=
"https://oss-2020105657.s3.amazonaws.com/third.png"
;
img
.
alt
=
"3단계"
;
}
else
if
(
total
>=
1200
&&
total
<
2000
){
img
.
src
=
"https://oss-2020105657.s3.amazonaws.com/four.png"
;
img
.
alt
=
"4단계"
;
}
else
{
img
.
src
=
"https://oss-2020105657.s3.amazonaws.com/fifth.png"
;
img
.
alt
=
"5단계"
;
}
userCharacterBox
.
appendChild
(
img
);
};
const
handleRepo
=
(
list
)
=>
{
list
.
forEach
(
element
=>
{
const
anchor
=
document
.
createElement
(
"a"
);
anchor
.
href
=
element
.
html_url
;
anchor
.
target
=
"_blank"
anchor
.
innerHTML
=
`<div class =number><span class="repoName">
${
element
.
name
}
</span> : <span class="repoUrl">
${
element
.
html_url
}
</span></div>`
userRepoBox
.
appendChild
(
anchor
);
});
};
const
getGithubRepo
=
()
=>
{
console
.
log
(
"Get Api here"
);
const
response
=
fetch
(
URL
).
then
(
function
(
response
){
return
response
.
json
();
}).
then
(
function
(
data
){
const
trendRepoList
=
data
.
slice
(
0
,
2
);
handleRepo
(
trendRepoList
);
});
};
const
init
=
()
=>
{
...
...
src/views/userDetail.pug
View file @
f688d2d
...
...
@@ -51,7 +51,7 @@ block content
.user-status
.user-status__contributions
h3 YOU'VE MADE
span
#{totalContributions}
span
#jsTotalContributions=totalContributions
h3 CONTRIBUTIONS!
img(src=`http://ghchart.rshah.org/${user.githubName}` alt="Name Your Github chart")
...
...
@@ -62,43 +62,11 @@ block content
.user-repositories
h3 Your recent updated repositories
.user-repo
a(href=firstRepoUrl)
h3 REPO 1
p=fitstRepoName
br
a(href=secondRepoUrl)
h3 REPO 2
p=secondRepoName
//- .user-status
//- .user-status__contributions
//- h3 YOU'VE MADE
//- span #{totalContributions}
//- h3 CONTRIBUTIONS!
//- img(src=`http://ghchart.rshah.org/${user.githubName}` alt="Name Your Github chart")
h3 Your recent updated repositories:
//- .user-status__character
//- h3 YOUR STATUS:
//- .user-repositories
//- h3 Your recent updated repositories
//- .user-repo
//- a(href=firstRepoUrl)
//- h3 REPO 1
//- p=fitstRepoName
//- br
//- a(href=secondRepoUrl)
//- h3 REPO 2
//- p=secondRepoName
block scripts
script(src="/static/js/githubInfo.js")
...
...
Please
register
or
login
to post a comment