-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Project-github-tracker #119
Open
Mimmisen
wants to merge
17
commits into
Technigo:main
Choose a base branch
from
Mimmisen:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a2b25f1
started with the project, added what we went through on live session …
Mimmisen c8ed0da
added my token, created a varable for it in script.js, added the toke…
Mimmisen 1fe3a53
called out the token varable
Mimmisen 8a3a065
called out the token varable
Mimmisen b5ef50e
test
Mimmisen 364ac99
changed display of token
Mimmisen 46431c9
started with the project, added what we went through on live session …
Mimmisen c1cf5ba
started over with gitognore
Mimmisen bdc526b
filtered my preojects and some more
Mimmisen f59cb31
created the chart and almost done with tracker, started with css
Mimmisen 29784b9
working on the js
Mimmisen 30837d9
js
Mimmisen 1b2fa6d
latest push function is now working
Mimmisen 4c05fb0
added margin to chart and changed token
Mimmisen 8b4559b
changed in redme
Mimmisen 7b6ad6d
added the default branch and github name
Mimmisen b330f78
uppdated readme
Mimmisen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
# 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 week, we have created a place to keep track of the GitHub repos that we are crating at Technigo. We have continued practicing on JavaScript and 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? | ||
Process | ||
designed page using figma | ||
Fetched data from API and displayed it to fulfill the requirements. | ||
Created a chart for the progress. | ||
Styled the page. | ||
|
||
I started by adding my token to the project. I then collected all the info about my repos with the fetch() method. | ||
I then builded functions to us the information I needed and displayed it on my page. I also created a chart showing | ||
how many projects I have done and have left to do during my technigo education. | ||
|
||
If I had more time I would add more information about every repo: languages used for the project, review comments and link to netlify. | ||
|
||
## 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://github-tracker-bymimmi.netlify.app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Personal token | ||
secret.js | ||
# why can't I put code/ boefore secret.js lite the tutorial ? | ||
|
||
|
||
# # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
# | ||
# | ||
# # Ignore Mac system files | ||
# .DS_store | ||
# | ||
# # Ignore node_modules folder | ||
# node_modules | ||
# | ||
# # Ignore all text files | ||
# *.txt | ||
# | ||
# # Ignore files related to API keys | ||
# .env | ||
# | ||
# # misc | ||
# /.pnp | ||
# .pnp.js | ||
# npm-debug.log* | ||
# yarn-debug.log* | ||
# yarn-error.log* | ||
# | ||
# # other | ||
# token.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,29 @@ | ||
//DOM-selector for the canvas 👇 | ||
const ctx = document.getElementById('chart').getContext('2d') | ||
const showChart = (countRepos) => { | ||
const ctx = document.getElementById("chart").getContext("2d"); | ||
|
||
//"Draw" the chart here 👇 | ||
const labels = [`Finished projects`, `Projects left`]; | ||
|
||
const data = { | ||
labels: labels, | ||
datasets: [ | ||
{ | ||
label: "My Technigo projects", | ||
backgroundColor: ["#9E9FCF", "#484B76"], | ||
borderColor: "rgb(66, 66, 66)", | ||
data: [countRepos, 19 - countRepos], | ||
}, | ||
], | ||
}; | ||
|
||
Chart.defaults.font.family = "Source Serif Pro"; | ||
Chart.defaults.font.size = "20"; | ||
Chart.defaults.color = "#000000"; | ||
|
||
const config = { | ||
type: "pie", | ||
data: data, | ||
options: {}, | ||
}; | ||
|
||
const myChart = new Chart(ctx, config); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" /> | ||
</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>Mimmis Project GitHub Tracker</title> | ||
<link rel="stylesheet" href="./style.css" /> | ||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | ||
<!--font--> | ||
<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=Source+Serif+Pro&display=swap" | ||
rel="stylesheet" | ||
/> | ||
</head> | ||
<body> | ||
<header id="headerBox"> | ||
<h1>GitHub Tracker</h1> | ||
<h3>Technigo Student Spring 2022</h3> | ||
</header> | ||
|
||
<!-- This will be used to draw the chart 👇 --> | ||
<canvas id="chart"></canvas> | ||
<main> | ||
<section class="projects"> | ||
<div class="section-projects__container" id="section-projects"></div> | ||
</section> | ||
|
||
<script src="./script.js"></script> | ||
<script src="./chart.js"></script> | ||
</body> | ||
</html> | ||
<!-- This will be used to draw the chart 👇 --> | ||
<canvas id="chart" class="chart"> | ||
<p id="numberOfProjects" class="number-of-projects"></p> | ||
</canvas> | ||
</main> | ||
|
||
<script src="./chart.js"></script> | ||
<script src="./secret.js"></script> | ||
<script src="./script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
const username = "Mimmisen"; | ||
const API_URL = `https://api.github.com/users/${username}`; | ||
const REPOS_URL = `https://api.github.com/users/${username}/repos`; | ||
|
||
// function for token | ||
const options = { | ||
method: "GET", | ||
headers: { | ||
Authorization: `token ${API_TOKEN}`, | ||
}, | ||
}; | ||
//----------------------------------FETCH 1------------------------------------- | ||
// getting profile pic,user name and link to my github | ||
fetch(API_URL, options) | ||
.then((res) => res.json()) | ||
.then((data) => { | ||
headerBox.innerHTML += ` | ||
<div> | ||
<a href="${API_URL}"> | ||
<img src="${data.avatar_url}" alt="Avatar of ${data.login}"> | ||
</a> | ||
</div> | ||
<a href="https://github.com/Mimmisen"><h1 class="username">${data.login}<h1></a> | ||
<div class="my-name">Mimmi Fordal Uddin</div> | ||
|
||
`; | ||
}); | ||
|
||
//----------------------------------FETCH 2------------------------------------- | ||
fetch(REPOS_URL, options) | ||
.then((res) => res.json()) | ||
.then((data) => { | ||
//To get my projects and filter them so only the ones starting with projects are displayed | ||
const technigoProjects = data.filter( | ||
(repo) => repo.name.startsWith("project-") && repo.fork | ||
); | ||
showChart(technigoProjects.length); | ||
|
||
technigoProjects.forEach((repo) => { | ||
const reponame = repo.name; | ||
|
||
fetchTechnigo(reponame); | ||
|
||
const projectUrl = repo.html_url; | ||
|
||
const defaultBranch = repo.default_branch; | ||
|
||
const latestPushRepo = new Date(repo.updated_at).toLocaleDateString( | ||
"sv-SE", | ||
{ | ||
year: "numeric", | ||
month: "long", | ||
day: "numeric", | ||
} | ||
); | ||
|
||
//displaying project url, name and latest push | ||
document.getElementById("section-projects").innerHTML += ` | ||
<div class="section-projects__card box-style"> | ||
<div> | ||
<h3 class="repo-title bold-text"><a class="nav-link" href='${projectUrl}'>${reponame}</a></h3> | ||
<p><span class="bold-text">Latest update:</span> ${latestPushRepo}</p> | ||
<p id="commits-${reponame}"></p> | ||
<p> default branch: ${defaultBranch}</p> | ||
</div> | ||
</div> | ||
`; | ||
}); | ||
}); | ||
|
||
// function for the commits url and name | ||
const displayCommits = (commitsUrl, reponame) => { | ||
fetch(commitsUrl, options) | ||
.then((res) => res.json()) | ||
.then((data) => { | ||
document.getElementById(`commits-${reponame}`).innerHTML = ` | ||
<p class="bold-text">Amount of commits: ${data.length} | ||
</p> | ||
`; | ||
}); | ||
}; | ||
|
||
//function to get the latest push to repo | ||
const fetchTechnigo = (reponame) => { | ||
fetch( | ||
`https://api.github.com/repos/Technigo/${reponame}/pulls?per_page=100`, | ||
options | ||
) | ||
.then((res) => res.json()) | ||
.then((data) => { | ||
data.forEach((repo) => { | ||
const commitsUrl = repo.commits_url; | ||
if (repo.user.login === username) { | ||
displayCommits(commitsUrl, reponame); | ||
} else if ( | ||
repo.user.login === "sukiphan97" && | ||
reponame === "project-chatbot" | ||
) { | ||
displayCommits(repo.commits_url, reponame); | ||
} else if ( | ||
repo.user.login === "kolkri" && | ||
reponame === "project-weather-app" | ||
) { | ||
displayCommits(repo.commits_url, reponame); | ||
} else { | ||
document.getElementById(`commits-${reponame}`).innerHTML = | ||
"No commits for this repo"; | ||
} | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,85 @@ | ||
* { | ||
box-sizing: border-box; | ||
margin: 0; | ||
} | ||
|
||
body { | ||
background: #FFECE9; | ||
} | ||
background: #ffece9; | ||
font-family: "Source Serif Pro", serif; | ||
background-image: linear-gradient(#ccccff, #ffff); | ||
} | ||
|
||
header { | ||
display: grid; | ||
justify-items: center; | ||
} | ||
|
||
/* header text */ | ||
h1 { | ||
margin: 0.5rem; | ||
color: #ffffff; | ||
font-size: 3rem; | ||
} | ||
|
||
/* description text */ | ||
h3 { | ||
margin: 0.5rem; | ||
color: #ffffff; | ||
} | ||
|
||
.username { | ||
font-size: 25px; | ||
} | ||
|
||
.my-name { | ||
font-size: 35px; | ||
} | ||
|
||
img { | ||
width: 300px; | ||
border-radius: 50%; | ||
margin-block: 2em; | ||
} | ||
|
||
/* link to my github and repos */ | ||
a, | ||
a:active { | ||
text-decoration: none; | ||
} | ||
|
||
a.nav-link, | ||
a.nav-link:active { | ||
position: relative; | ||
color: black; | ||
} | ||
|
||
.section-projects__container { | ||
padding: 2em 0; | ||
min-height: 100%; | ||
display: grid; | ||
gap: 1em; | ||
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); | ||
justify-content: center; | ||
justify-items: center; | ||
} | ||
|
||
.section-projects__card { | ||
background: #f9f8ff; | ||
border-radius: 0.5em; | ||
width: 300px; | ||
padding: 1em; | ||
margin: 1em; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
} | ||
|
||
canvas { | ||
margin: 2rem; | ||
} | ||
|
||
@media screen and (min-width: 768px) { | ||
.chart { | ||
max-height: 60vh; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you are missing the names of the main branches (also minimum requirements), so you could add one line more to your innerHTML (if I remember correctly it was repo.default_branch how you get the names of the main branch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and now I have added it!