Commit 45d98dd7 authored by Live Jortveit Sagebakken's avatar Live Jortveit Sagebakken
Browse files

(#3) Deleted some comments

parent 8113671c
......@@ -2,12 +2,10 @@ import { useEffect, useState } from "react";
import Commit from "./commit";
function CommitView() {
// eslint-disable-next-line react-hooks/rules-of-hooks
const [commits, setCommits] = useState([]);
let token = "3Nhst8cnMWx5puz8KEzR";
const [filterParam, setFilterParam] = useState("all");
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
// Kode hentet fra https://www.freecodecamp.org/news/fetch-data-react/
fetch(
......@@ -26,13 +24,11 @@ function CommitView() {
throw response;
})
.then((data) => {
console.log(data);
setCommits(data);
})
.catch((error) => {
console.error("Error fetching data: ", error);
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
function getCurrentDate() {
......@@ -92,7 +88,7 @@ function CommitView() {
function getMonthLength(month: number) {
if(month === 2){
return 28; // Dont care for skuddår right now
return 28; // Dont care for leap year right now
}
else if(month === 4 || month === 6 || month === 9 || month === 12) {
return 30;
......@@ -122,7 +118,6 @@ function CommitView() {
// TODO: Fikse sånn at det ikke blir krøll ved månedskifte + displaye "Ingen commits" dersom det ikke er noen commits, spesielt viktig for today...
function filterOnWeeks(){
var startDate = getStartDate();
console.log(startDate);
var startDay = parseInt(getDay(startDate.toString()));
var month = parseInt(getMonth(startDate.toString()));
var year = getYear(startDate.toString());
......@@ -130,18 +125,8 @@ function CommitView() {
var commitsList: any = [];
var dayDifference = getDayDifference(month);
var dateFormat = "";
console.log("DayDifference:" + dayDifference);
for(var i = 0; i <= dayDifference; i++) {
dateFormat = (year + separator + (month < 10 ? "0" + (month) : (month)) + separator + (startDay < 10 ? "0" + (startDay) : (startDay)));
console.log("DateFormat:" + dateFormat);
console.log("StartDay:" + startDay);
console.log()
console.log("Month:" + month)
/*if(startDay === getMonthLength(month) && month.toString().includes(month.toString())) {
startDay = 0;
month ++;
}*/
console.log(startDay);
commitsList.push(commits.filter((issue: {committed_date: string}) =>
issue.committed_date.includes(dateFormat)).map(
(commit: { message: string; created_at: number }, index: React.Key) => (
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment