File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22const ctx = document . getElementById ( 'chart' ) . getContext ( '2d' )
33
44//"Draw" the chart here 👇
5+ const drawChart = ( forkedRepos ) => {
6+
7+ const labels = [
8+ 'Completed Projects' ,
9+ 'Remaining Projects' ,
10+ ] ;
11+
12+ const data = {
13+ labels : labels ,
14+ datasets : [ {
15+ label : 'My first dataset' ,
16+ backgroundColor : [ '#655D8A' , '#D885A3' ] ,
17+ borderColor : '#FDCEB9' ,
18+ borderWidth : 6 ,
19+ data : [ forkedRepos , 19 - forkedRepos ] ,
20+ } ]
21+ } ;
22+
23+ const config = {
24+ type : 'pie' ,
25+ data : data ,
26+ options : { }
27+ } ;
28+
29+ const myChart = new Chart (
30+ document . getElementById ( 'chart' ) ,
31+ config
32+ ) ;
33+ }
Original file line number Diff line number Diff line change 44 < meta charset ="UTF-8 ">
55 < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
7+
8+ <!-- Chart 👇 -->
9+ < script src ="https://cdn.jsdelivr.net/npm/chart.js "> </ script >
10+
711 < link rel ="stylesheet " href ="./style.css " />
8- <!-- Google Fonts -->
12+
13+ <!-- Google Fonts 👇 -->
914 < link rel ="preconnect " href ="https://fonts.googleapis.com ">
1015 < link rel ="preconnect " href ="https://fonts.gstatic.com " crossorigin >
1116 < link href ="https://fonts.googleapis.com/css2?family=Shippori+Antique+B1&family=Shizuru&display=swap " rel ="stylesheet ">
17+
1218 < title > GitHub Tracker by Camilla</ title >
1319</ head >
1420
1521< body >
1622 < header >
17- < h1 > GitHub Tracker</ h1 >
23+ < h1 > GitHub Tracker</ h1 >
1824 </ header >
1925
2026 < section class ="userData " id ="userData "> </ section >
@@ -24,14 +30,16 @@ <h2>👇🏽 Technigo Projects 👇🏽</h2>
2430 </ main >
2531
2632 <!-- This will be used to draw the chart 👇 -->
27- < canvas id ="chart "> </ canvas >
33+ < div id ="canvas " class ="chart-container ">
34+ < canvas id ="chart "> </ canvas >
35+ </ div >
2836
2937 < footer class ="made-by ">
3038 < p > Made by Camilla Hallberg @ Technigo Bootcamp Spring 2022 < span style ='font-size:16px; '> 🤖</ span > </ p >
3139 </ footer >
3240
33- < script src ="./chart.js "> </ script >
3441 < script src ="./token.js "> </ script >
42+ < script src ="./chart.js "> </ script >
3543 < script src ="./script.js "> </ script >
3644</ body >
3745</ html >
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ const username = 'CamillaHallberg'
33let reponame = ''
44
55const API_TOKEN = TOKEN || process . env . API_KEY ;
6- // console.log(TOKEN)
76
87// API's
98const API_USER = `https://api.github.com/users/${ username } `
@@ -53,11 +52,11 @@ const getRepos = () => {
5352 <h3><a href="${ repo . html_url } ">${ repo . name } </a></h3>
5453 <p class="default-branch">Branch: ${ repo . default_branch } </p>
5554 <p>Latest push: ${ new Date ( repo . pushed_at ) . toDateString ( ) } </p>
56- <p id="commit_${ repo . name } ">Number of commits:</p>
57- <p>Main language: ${ repo . language } </p>
55+ <p id="commit-${ repo . name } ">Number of commits: </p>
5856 </div>
5957 `
6058 } )
59+ drawChart ( forkedRepos . length )
6160 getPullRequests ( forkedRepos )
6261 } )
6362}
@@ -74,7 +73,7 @@ const getPullRequests = (forkedRepos) => {
7473 const pulls = data . find ( ( pull ) => pull . user . login === repo . owner . login ) ;
7574
7675 getCommits ( pulls . commits_url , repo . name )
77- console . log ( pulls . commits_url )
76+ console . log ( pulls . commits_url , 'pulls commits_url' )
7877 } )
7978 } )
8079}
@@ -87,4 +86,5 @@ const getCommits = (myCommitsUrl, myRepoName) => {
8786 . then ( ( data ) => {
8887 document . getElementById ( `commit-${ myRepoName } ` ) . innerHTML += data . length
8988 } )
89+ console . log ( myRepoName )
9090}
Original file line number Diff line number Diff line change 55h1 {
66 font-family : 'Shizuru' , cursive;
77 font-size : 72px ;
8- color : palevioletred;
8+ color : palevioletred;
99 text-align : center;
1010 cursor : pointer;
1111}
1212
1313h2 {
1414 font-family : 'Shizuru' , cursive;
15- font-size : 32 px ;
16- color : mediumpurple ;
15+ font-size : 28 px ;
16+ color : # 655D8A ;
1717 text-align : center;
1818 cursor : pointer;
1919}
3030 color : whitesmoke;
3131}
3232
33+ .avatar {
34+ text-align : center;
35+ }
36+
3337.img {
3438 width : 96px ;
35- border-radius : 50 % ;
39+ border-radius : 4 px ;
3640 border : 8px solid floralwhite;
3741}
3842
4246
4347.projects-card {
4448 background : linen;
45- border : 6px solid hotpink;
49+ border : 6px solid # 7897AB ;
50+ border-radius : 4px ;
4651 margin : 12px ;
4752 padding : 12px ;
4853 font-size : 12px ;
5257
5358.default-branch {
5459 font-family : 'Shizuru' , cursive;
60+ font-size : 14px ;
61+ color : # D885A3 ;
5562}
5663
5764a {
You can’t perform that action at this time.
0 commit comments