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
Binary file added .DS_Store
Binary file not shown.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# GitHub Tracker

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.
This project is about making a github tracker for our technigo projects. it is fetched with API

## The problem

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?
it took some time to manage to get the api fetches working and displaying in a correct way, but I'm proud that it is working now. if I had more time I would add some more features such as perhaps a searchbar or more data to display inside.

## View it live

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.
https://waliem-github-tracker.netlify.app/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job with the responsiveness! The layout for all different sizes looks really nice and clean. Loved also your icon and color palette.

Binary file added code/.DS_Store
Binary file not shown.
Binary file added code/Octocat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added code/TO DO-LIST
Empty file.
20 changes: 19 additions & 1 deletion code/chart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
//DOM-selector for the canvas 👇
const ctx = document.getElementById('chart').getContext('2d')
const ctx = document.getElementById("chart").getContext("2d")

//"Draw" the chart here 👇

const drawChart = (amount) => {
const config = {
type: "doughnut",
data: {
labels: ["Finished projects", "Projects left"],
datasets: [
{
label: "My First Dataset",
data: [amount, 20 - 6],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since the page will continue to update constantly, you can change the code to:
data: [amount, 20 - amount],
so the graph updates also automatically.

backgroundColor: ["rgb(255, 92, 88)", "rgb(242, 141, 138)"],
hoverOffset: 4,
},
],
},
}
const myChart = new Chart(ctx, config)
}
47 changes: 30 additions & 17 deletions code/index.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
<!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" />
</head>
<body>
<h1>GitHub Tracker</h1>
<h2>Projects:</h2>
<main id="projects"></main>
<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" />
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

<!-- This will be used to draw the chart 👇 -->
<canvas id="chart"></canvas>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100&display=swap"
rel="stylesheet"
/>
</head>

<script src="./script.js"></script>
<script src="./chart.js"></script>
</body>
</html>
<body>
<header>
<h1>GITHUB TRACKER</h1>
<img class="github-icon" src="./octocat.png" />
</header>

<section id="user-info"></section>

<main id="projects"></main>

<div class="chart-box"><canvas id="chart"></canvas></div>

<script src="./script.js"></script>
<script src="./chart.js"></script>
Comment on lines +19 to +32

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Super clean HTML!

</body>
</html>
77 changes: 77 additions & 0 deletions code/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const USER = "waliem"
const REPOS_URL = `https://api.github.com/users/${USER}/repos`
const USER_INFO_URL = `https://api.github.com/users/${USER}`

const projectsContainer = document.getElementById("projects")
const userContainer = document.getElementById("user-info")

// function for getting my user info
const getUserInfo = () => {
fetch(USER_INFO_URL)
.then((response) => response.json())
.then((data) => {
userContainer.innerHTML += `
<img class="profile-img" src="https://avatars.githubusercontent.com/u/84201089?v=4" alt="User profile picture">
<span id="profile-name"> <a class="usr-name" href="https://github.com/waliem"><h2>${data.login}</h2></a> <h3>Front end developer student</h3><h3>Based in Gothenburg</h3></span>`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could also fetch this info (the ones you have on your GitHub) through the API - ex. data.html_url for the profile link.

})
}

// function for getting all my repos and filter them to get only technigo projects and displaying them in inner html
const getRepos = () => {
fetch(REPOS_URL)
.then((response) => response.json())
.then((data) => {
let forkedRepos = data.filter(
(repo) => repo.fork && repo.name.startsWith("project-")
)
forkedRepos.forEach(
(repo) =>
(projectsContainer.innerHTML += `
<div class="project-box">
<a style="font-weight:bold" href="${repo.html_url}"> ${
repo.name
} </a> <p>Default branch: ${repo.default_branch}</p>
<p>Most recent push: ${new Date(repo.pushed_at).toDateString()}</p>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great that you used the new Date approach! Looks really clean and easy to understand.

<p id="commit-${repo.name}">Commits: </p></div>`)
)

drawChart(forkedRepos.length)
getPullRequests(forkedRepos)
})
}

//function for fetching my pull requests
const getPullRequests = (forkedRepos) => {
forkedRepos.forEach((repo) => {
const PULLS_URL = `https://api.github.com/repos/technigo/${repo.name}/pulls?per_page=100`

fetch(PULLS_URL)
.then((res) => res.json())
.then((data) => {
const myPulls = data.find(
(pull) => pull.user.login === repo.owner.login
)
// if/else conditon if I do not have any pull requests or commits it will display "no PR or commits done"
if (myPulls) {
getMyCommits(myPulls.commits_url, repo.name)
} else {
document.getElementById(
`commit-${repo.name}`
).innerHTML = `<I>No pull request or commits done</I>`
}
})
})
}

// function for getting the number of commits
const getMyCommits = (myCommitsUrl, myRepoName) => {
fetch(myCommitsUrl)
.then((res) => res.json())
.then((data) => {
document.getElementById(`commit-${myRepoName}`).innerHTML += data.length
console.log("my commits!", data)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We have a console.log survivor haha. I saw you probably erased the other ones and this escaped.

})
}

getUserInfo()
getRepos()
179 changes: 177 additions & 2 deletions code/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,178 @@
body {
background: #FFECE9;
}
background: #f8e2cf;
display: flex;
flex-direction: column;
color: black;
font-family: "Montserrat", sans-serif;
}

#user-info {
display: flex;
justify-content: center;
}

.profile-img {
border-radius: 50%;
width: 30%;
height: 30%;
align-self: center;
box-shadow: 8px 8px 8px rgb(114, 114, 114);
}

#profile-name {
flex-direction: column;
margin-left: 20px;
}

header {
display: flex;
justify-content: center;
}

.github-icon {
width: 20%;
height: auto;
}
Comment on lines +32 to +35

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 icon is super cute!!! Really loved it.


h1 {
align-self: center;
font-size: 25px;
}

h2 {
font-size: 20px;
}

h3 {
font-size: 12px;
}

#projects {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));

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 is a solution that would have solved all my grid issues for the project. Will save it for my next ones!

column-gap: 1rem;
row-gap: 1rem;
margin: 30px 0px 20px 0px;
}

.project-box {
background: #ff5c58;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
padding: 10px 0px 10px 20px;
box-shadow: 10px 10px 5px rgb(155, 155, 155);
-moz-box-shadow: 10px 10px 5px rgb(155, 155, 155);
-webkit-box-shadow: 10px 10px 5px rgb(155, 155, 155);
-khtml-box-shadow: 10px 10px 5px rgb(155, 155, 155);
}

.project-box:hover {
background-color: #bf3d39;
-webkit-transition: 0.3s ease-in-out;
transition: 0.3s ease-in-out;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
Comment on lines +69 to +76

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great hover effect on the boxes!


a {
font-size: 15px;
color: black;
text-decoration: none;
text-transform: capitalize;
}

.usr-name:hover {
color: #ff5c58;
text-transform: lowercase;

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 lowercase effect was mind blowing for me! It's such a delicate and nice touch!!!

}

a:hover {
color: #f8e2cf;
}

.chart-box {
width: 80%;
display: flex;
align-self: center;
}

/* ---- media queries tablet ---- */

@media (min-width: 668px) and (max-width: 1024px) {
.profile-img {
width: 25%;
height: 25%;
}

#profile-name {
padding-left: 10px;
align-self: center;
}

h1 {
font-size: 40px;
}

h2 {
font-size: 30px;
}

a {
font-size: 25px;
}

.chart-box {
width: 60%;
align-self: center;
}
}

/* ---- media queries desktop ---- */

@media (min-width: 1025px) {
#user-info {
justify-content: center;
}

.github-icon {
width: 15%;
height: auto;
}

.profile-img {
width: 20%;
}

#profile-name {
align-self: center;
margin-left: 20px;
}

h1 {
font-size: 60px;
}

h2 {
font-size: 40px;
}

h3 {
font-size: 20px;
}

#projects {
grid-template-columns: repeat(auto-fit, minmax(400px, 2fr));
max-width: 80%;
align-self: center;
margin-top: 60px;
}

a {
font-size: 20px;
}

.chart-box {
width: 25%;
}
}