Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

Replace this readme with your own information about your project.

Start by briefly describing the assignment in a sentence or two. Keep it short and to the point.
We were tasked to create a Github Tracker where we can see and are able to access all of our github repos from Technigo.

## The problem

I approached problems by using google/stackoverflow and asking friends, I didn't have much of a plan going in, I kind of wanted to make it as simple as possible.

I had a very unfortunate week and therefore it is turned in alittle late, Basically started coding on friday and forgot to send it in on sunday as I went to bed early, I am also not finished with the project for some reason my image refuse to show up so that will be something I need to look into. I believe I did fine for the timeframe I had as I was both sick and had to go out of town and didn't have time to code then which so the only thing I would change is that I would like to go back to regular where I wont be sick and wont be out of town without a computer.

Describe how you approached to problem, and what tools and techniques you used to solve it. How did you plan? What technologies did you use? If you had more time, what would be next?

## View it live

https://determined-bose-382814.netlify.app

Every project should be deployed somewhere. Be sure to include the link to the deployed project so that the viewer can click around and see what it's all about.
24 changes: 24 additions & 0 deletions code/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,27 @@
const ctx = document.getElementById('chart').getContext('2d')

//"Draw" the chart here 👇
const config = {
type: 'doughnut',
data: {
labels: [
'Projects Done',
'Projects Left',
],
datasets: [{
label: 'My First Dataset',
data: [6, 20-5],
backgroundColor: [
' rgb(255,250,250)',
'rgb(23, 18, 18)',

],
hoverOffset: 4
}]
},
};



const myChart = new Chart(ctx, config)

42 changes: 30 additions & 12 deletions code/index.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Project GitHub Tracker</title>
<link rel="stylesheet" href="./style.css" />
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Project GitHub Tracker</title>
<link rel="stylesheet" href="./style.css" />
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a very small detail, i would get rid of line 11 or do the same on both sides so it looks proportionate =)

</head>

<body>
<h1>GitHub Tracker</h1>
<h2>Projects:</h2>
<main id="projects"></main>
<header>
<h1>GitHub Tracker</h1>
</header>
<div class="wrapper">
<div class="info-container">
<div class="profile-container" id="profileInfo"></div>
<div class="chart-container">
<h2>Progress</h2>
<canvas class="chart" id="chart"> </canvas>
</div>
</div>

<!-- This will be used to draw the chart 👇 -->
<canvas id="chart"></canvas>
<div class="projects-container">
<h2>Projects</h2>
<div class="projects-list">
<main class="projects" id="projects"></main>
</div>
</div>
</div>

<script src="./script.js"></script>
<script src="./chart.js"></script>
<script src="./script.js"></script>
<script src="./chart.js"></script>
</body>

</html>
79 changes: 79 additions & 0 deletions code/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
const USER = 'Groovedharry'
const REPOS_URL = `https://api.github.com/users/${USER}/repos`;
const USER_API = `https://api.github.com/users/${USER}`;
const projectsContainerXXYT = document.getElementById('profileInfo');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, what does xxyt mean?

const projectsContainer = document.querySelector("#projects");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you used a querySelector here instead of just use document.getElementById? If there isnt a particular reason i would try to make it coherent and use dockument.getElementById here aswell or just use the queryselector for targeting the elements =).



const getUser = () => {
fetch(USER_API)
.then((response) => response.json())
.then((data) => {
profile.info.innerHTML += `
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would guess that this bit doesnt work since you havent targeted the correct id. you have used profile.info.innerhtml. Try to change that to profileInfo.innerHTML instead.

<h2> Profile info </h2>
<img src ="https://avatars.githubusercontent.com/u/83465217?v=4" alt="profile pic">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This info is possible to pick up from the data So you dont have to hard code it. It is just a suggestion since you already use the api to pcick up the name!

<h4> ${data.name}</h4>
<h4> >a href =${data.html_url}>${data.login}</h4>
`;
});
};

// Repos //
const getRepos = () => {
fetch(REPOS_URL)
.then((response) => {
return response.json();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution to wait until the data is finished! =)

})
.then((json) => {
const forkedRepos = json.filter((project) => project.fork && project.name.startsWith("project-"));
console.log(forkedRepos)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this console log before pushing the final result, but since you have written that you arent entirely done with the project I understand that you left it =)

// commits //
forkedRepos.forEach((project) => {
const COMMIT_URL = `https://api.github.com/repos/${USER}/${project.name}/commits`;
fetch(COMMIT_URL)
.then((response) => {
return response.json();
})
.then((json) => {
const filteredCommits = json.filter((project) => project.commit.author.name === "Harry Bäcklin");
// makes the first letter an upper case, Thank you Bruna //
const upperCaseName = project.name.charAt(0).toUpperCase() + project.name.slice(1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

projectsContainer.innerHTML += `<div class="projects-individual">
<h3> Project Name: ${upperCaseName}</h3>
<a href = ${project.html_url}> ${upperCaseName} </a>
<p> Main branch: ${project.default_branch}</p>
<p> Number of commits: ${filteredCommits.length}</p>
<p> Latest push: ${project.pushed_at.slice(0, 10)}, ${project.pushed_at.slice(11, 16)}</p>
<p id="pull-${project.name}"></p>
</div>`;
});
});
getPulls(forkedRepos);
drawChart(forkedRepos.length);
});
};

// Getting Pull requests //
const getPulls = (forkedRepos) => {
forkedRepos.forEach((project) => {
fetch(
`https://api.github.com/repos/Technigo/${project.name}/pulls?per_page=100`
)
.then((response) => response.json())
.then((pulldata) => {
const myPullRequest = pulldata.find(
(pull) => pull.user.login === project.owner.login
);
if (myPullRequest) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution =)

document.getElementById(`pull-${project.name}`).innerHTML = `
<a href = ${myPullRequest.html_url}>Pull request</>`;
} else {
document.getElementById(`pull-${project.name}`).innerHTML = `
No pull request available`;
}
});
});
};

getUser();
getRepos();
140 changes: 139 additions & 1 deletion code/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,141 @@
body {
background: #FFECE9;
box-sizing: border-box;
min-width: 325px;
background-color:#53565A;
font-family: Arial, Helvetica, sans-serif
}

.wrapper {
margin: 5% 0;
}


h1 {
margin-top: 10%;
color: Black;
text-align: center;
font-size: 30px;
}


.profile-container {
text-align: center;
color: white;
align-items: center;
}

h4 {
margin: 2% 0;
font-size: 28px;
color:black;
}
/* not working prolly something in JS but I can't figure it out */
img {
width: 50%;
height: 50%;
border-radius: 50%;
border: 1px solid white;

}

h2 {
text-align: center;
color: black;
}


.chart-container {
width: 70%;
margin: 0 0 10% 15%;
}


.projects-list {
border: 1px solid #b8c3bd;
padding: 4%;
height: 100%;
color: black;
font-size: 17px;
}
.projects-individual {
border-bottom: 1px solid #b8c3bd;
}


a:link {
color: white;
}


a:visited {
color: white;
}


a:hover {
color: black;
}


@media (min-width: 668px) and (max-width: 1024px) {

h1 {
font-size: 45px;
}

h4 {
font-size: 38px;
}

h2 {
font-size: 40px;
}

/* not working prolly something in JS but I can't figure it out */
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment about it above =)

img {
width: 40%;
height: 40%;
}

.chart-container {
width: 50%;
margin: 5% 0 5% 27%;
}


.projects-list {
text-align: center;
}
}


@media (min-width: 1025px) {
.big-container {
display: grid;
grid-template-columns: 1fr 2fr;
margin: 2%;
}


h1 {
font-size: 60px;
margin-top: 4%;
}


h4, h2 {
font-size: 40px;
}


.projects-list {
padding: 0 0 0 5%;
font-size: 16px;
border-bottom: 1px solid #b8c3bd;
}

.projects {
display: grid;
grid-template-columns: 1fr 1fr;
}
}