diff --git a/cache/getGitActivity b/cache/getGitActivity index 9afe52c..516002a 100644 --- a/cache/getGitActivity +++ b/cache/getGitActivity @@ -1 +1 @@ -{"data":{"2020-04-05":0,"2020-04-06":0,"2020-04-07":2,"2020-04-08":0,"2020-04-09":0,"2020-04-10":0,"2020-04-11":0,"2020-04-12":0,"2020-04-13":0,"2020-04-14":1,"2020-04-15":0,"2020-04-16":4,"2020-04-17":0,"2020-04-18":0,"2020-04-19":0,"2020-04-20":2,"2020-04-21":10,"2020-04-22":0,"2020-04-23":0,"2020-04-24":3,"2020-04-25":0,"2020-04-26":0,"2020-04-27":0,"2020-04-28":0,"2020-04-29":0,"2020-04-30":2,"2020-05-01":0,"2020-05-02":0,"2020-05-03":6,"2020-05-04":18,"2020-05-05":3,"2020-05-06":1,"2020-05-07":0,"2020-05-08":0,"2020-05-09":1,"2020-05-10":0,"2020-05-11":1,"2020-05-12":0,"2020-05-13":0,"2020-05-14":1,"2020-05-15":1,"2020-05-16":0,"2020-05-17":1,"2020-05-18":0,"2020-05-19":0,"2020-05-20":0,"2020-05-21":4,"2020-05-22":0,"2020-05-23":0,"2020-05-24":0,"2020-05-25":0,"2020-05-26":5,"2020-05-27":0,"2020-05-28":0,"2020-05-29":3,"2020-05-30":2,"2020-05-31":1,"2020-06-01":3,"2020-06-02":0,"2020-06-03":2,"2020-06-04":1,"2020-06-05":0,"2020-06-06":0,"2020-06-07":0,"2020-06-08":0,"2020-06-09":0,"2020-06-10":0,"2020-06-11":7,"2020-06-12":2,"2020-06-13":3,"2020-06-14":5,"2020-06-15":1,"2020-06-16":1,"2020-06-17":0,"2020-06-18":1,"2020-06-19":11,"2020-06-20":1,"2020-06-21":5,"2020-06-22":1,"2020-06-23":6,"2020-06-24":1,"2020-06-25":5,"2020-06-26":1,"2020-06-27":10,"2020-06-28":6,"2020-06-29":4,"2020-06-30":13,"2020-07-01":0,"2020-07-02":0,"2020-07-03":14,"2020-07-04":3,"2020-07-05":2,"2020-07-06":6,"2020-07-07":9,"2020-07-08":0,"2020-07-09":0,"2020-07-10":0,"2020-07-11":0,"2020-07-12":4,"2020-07-13":0,"2020-07-14":0,"2020-07-15":0,"2020-07-16":1,"2020-07-17":0,"2020-07-18":0,"2020-07-19":0,"2020-07-20":1,"2020-07-21":1,"2020-07-22":0,"2020-07-23":0,"2020-07-24":0,"2020-07-25":0,"2020-07-26":4,"2020-07-27":0,"2020-07-28":0,"2020-07-29":3,"2020-07-30":0,"2020-07-31":0,"2020-08-01":0,"2020-08-02":0,"2020-08-03":0,"2020-08-04":0,"2020-08-05":0,"2020-08-06":0,"2020-08-07":0,"2020-08-08":0,"2020-08-09":0,"2020-08-10":0,"2020-08-11":0,"2020-08-12":0,"2020-08-13":0,"2020-08-14":0,"2020-08-15":0,"2020-08-16":0,"2020-08-17":0,"2020-08-18":4,"2020-08-19":0,"2020-08-20":1,"2020-08-21":0,"2020-08-22":0,"2020-08-23":3,"2020-08-24":2,"2020-08-25":6,"2020-08-26":0,"2020-08-27":11,"2020-08-28":0,"2020-08-29":0,"2020-08-30":20,"2020-08-31":3,"2020-09-01":5,"2020-09-02":4,"2020-09-03":21,"2020-09-04":1,"2020-09-05":1,"2020-09-06":9,"2020-09-07":9,"2020-09-08":2,"2020-09-09":0,"2020-09-10":0,"2020-09-11":0,"2020-09-12":3,"2020-09-13":6,"2020-09-14":1,"2020-09-15":2,"2020-09-16":4,"2020-09-17":0,"2020-09-18":9,"2020-09-19":35,"2020-09-20":20,"2020-09-21":0,"2020-09-22":3,"2020-09-23":0,"2020-09-24":0,"2020-09-25":32,"2020-09-26":19,"2020-09-27":51,"2020-09-28":3,"2020-09-29":0,"2020-09-30":2,"2020-10-01":2,"2020-10-02":15,"2020-10-03":10,"2020-10-04":3,"2020-10-05":7,"2020-10-06":1,"2020-10-07":3,"2020-10-08":10,"2020-10-09":2,"2020-10-10":35,"2020-10-11":15,"2020-10-12":12,"2020-10-13":1,"2020-10-14":0,"2020-10-15":5,"2020-10-16":6,"2020-10-17":20,"2020-10-18":2,"2020-10-19":19,"2020-10-20":5,"2020-10-21":3,"2020-10-22":0,"2020-10-23":13,"2020-10-24":3,"2020-10-25":15,"2020-10-26":2,"2020-10-27":0,"2020-10-28":0,"2020-10-29":3,"2020-10-30":1,"2020-10-31":3,"2020-11-01":1,"2020-11-02":2,"2020-11-03":4,"2020-11-04":16,"2020-11-05":28,"2020-11-06":17,"2020-11-07":22,"2020-11-08":15,"2020-11-09":14,"2020-11-10":25,"2020-11-11":1,"2020-11-12":0,"2020-11-13":7,"2020-11-14":11,"2020-11-15":3,"2020-11-16":0,"2020-11-17":4,"2020-11-18":9,"2020-11-19":5,"2020-11-20":6,"2020-11-21":7,"2020-11-22":34,"2020-11-23":41,"2020-11-24":17,"2020-11-25":11,"2020-11-26":17,"2020-11-27":9,"2020-11-28":42,"2020-11-29":33,"2020-11-30":25,"2020-12-01":23,"2020-12-02":22,"2020-12-03":15,"2020-12-04":21,"2020-12-05":8,"2020-12-06":32,"2020-12-07":10,"2020-12-08":13,"2020-12-09":15,"2020-12-10":7,"2020-12-11":26,"2020-12-12":16,"2020-12-13":26,"2020-12-14":9,"2020-12-15":9,"2020-12-16":11,"2020-12-17":21,"2020-12-18":9,"2020-12-19":38,"2020-12-20":31,"2020-12-21":1,"2020-12-22":7,"2020-12-23":13,"2020-12-24":1,"2020-12-25":14,"2020-12-26":6,"2020-12-27":3,"2020-12-28":1,"2020-12-29":5,"2020-12-30":56,"2020-12-31":34,"2021-01-01":12,"2021-01-02":25,"2021-01-03":55,"2021-01-04":14,"2021-01-05":31,"2021-01-06":39,"2021-01-07":15,"2021-01-08":1,"2021-01-09":23,"2021-01-10":7,"2021-01-11":0,"2021-01-12":4,"2021-01-13":1,"2021-01-14":10,"2021-01-15":2,"2021-01-16":2,"2021-01-17":9,"2021-01-18":0,"2021-01-19":0,"2021-01-20":4,"2021-01-21":5,"2021-01-22":8,"2021-01-23":2,"2021-01-24":0,"2021-01-25":0,"2021-01-26":0,"2021-01-27":3,"2021-01-28":2,"2021-01-29":13,"2021-01-30":4,"2021-01-31":8,"2021-02-01":23,"2021-02-02":0,"2021-02-03":3,"2021-02-04":3,"2021-02-05":13,"2021-02-06":10,"2021-02-07":18,"2021-02-08":1,"2021-02-09":21,"2021-02-10":0,"2021-02-11":12,"2021-02-12":27,"2021-02-13":25,"2021-02-14":6,"2021-02-15":25,"2021-02-16":7,"2021-02-17":12,"2021-02-18":4,"2021-02-19":27,"2021-02-20":5,"2021-02-21":5,"2021-02-22":11,"2021-02-23":15,"2021-02-24":9,"2021-02-25":4,"2021-02-26":1,"2021-02-27":2,"2021-02-28":9,"2021-03-01":32,"2021-03-02":31,"2021-03-03":29,"2021-03-04":72,"2021-03-05":67,"2021-03-06":4,"2021-03-07":0,"2021-03-08":5,"2021-03-09":4,"2021-03-10":3,"2021-03-11":1,"2021-03-12":10,"2021-03-13":18,"2021-03-14":5,"2021-03-15":3,"2021-03-16":11,"2021-03-17":8,"2021-03-18":17,"2021-03-19":18,"2021-03-20":5,"2021-03-21":10,"2021-03-22":4,"2021-03-23":2,"2021-03-24":5,"2021-03-25":11,"2021-03-26":23,"2021-03-27":8,"2021-03-28":3,"2021-03-29":27,"2021-03-30":3,"2021-03-31":11,"2021-04-01":13,"2021-04-02":2,"2021-04-03":0,"2021-04-04":2},"lastRefresh":1617561360980} \ No newline at end of file +{"data":[{"date":"2020-04-05","count":0},{"date":"2020-04-06","count":0},{"date":"2020-04-07","count":2},{"date":"2020-04-08","count":0},{"date":"2020-04-09","count":0},{"date":"2020-04-10","count":0},{"date":"2020-04-11","count":0},{"date":"2020-04-12","count":0},{"date":"2020-04-13","count":0},{"date":"2020-04-14","count":1},{"date":"2020-04-15","count":0},{"date":"2020-04-16","count":4},{"date":"2020-04-17","count":0},{"date":"2020-04-18","count":0},{"date":"2020-04-19","count":0},{"date":"2020-04-20","count":2},{"date":"2020-04-21","count":10},{"date":"2020-04-22","count":0},{"date":"2020-04-23","count":0},{"date":"2020-04-24","count":3},{"date":"2020-04-25","count":0},{"date":"2020-04-26","count":0},{"date":"2020-04-27","count":0},{"date":"2020-04-28","count":0},{"date":"2020-04-29","count":0},{"date":"2020-04-30","count":2},{"date":"2020-05-01","count":0},{"date":"2020-05-02","count":0},{"date":"2020-05-03","count":6},{"date":"2020-05-04","count":18},{"date":"2020-05-05","count":3},{"date":"2020-05-06","count":1},{"date":"2020-05-07","count":0},{"date":"2020-05-08","count":0},{"date":"2020-05-09","count":1},{"date":"2020-05-10","count":0},{"date":"2020-05-11","count":1},{"date":"2020-05-12","count":0},{"date":"2020-05-13","count":0},{"date":"2020-05-14","count":1},{"date":"2020-05-15","count":1},{"date":"2020-05-16","count":0},{"date":"2020-05-17","count":1},{"date":"2020-05-18","count":0},{"date":"2020-05-19","count":0},{"date":"2020-05-20","count":0},{"date":"2020-05-21","count":4},{"date":"2020-05-22","count":0},{"date":"2020-05-23","count":0},{"date":"2020-05-24","count":0},{"date":"2020-05-25","count":0},{"date":"2020-05-26","count":5},{"date":"2020-05-27","count":0},{"date":"2020-05-28","count":0},{"date":"2020-05-29","count":3},{"date":"2020-05-30","count":2},{"date":"2020-05-31","count":1},{"date":"2020-06-01","count":3},{"date":"2020-06-02","count":0},{"date":"2020-06-03","count":2},{"date":"2020-06-04","count":1},{"date":"2020-06-05","count":0},{"date":"2020-06-06","count":0},{"date":"2020-06-07","count":0},{"date":"2020-06-08","count":0},{"date":"2020-06-09","count":0},{"date":"2020-06-10","count":0},{"date":"2020-06-11","count":7},{"date":"2020-06-12","count":2},{"date":"2020-06-13","count":3},{"date":"2020-06-14","count":5},{"date":"2020-06-15","count":1},{"date":"2020-06-16","count":1},{"date":"2020-06-17","count":0},{"date":"2020-06-18","count":1},{"date":"2020-06-19","count":11},{"date":"2020-06-20","count":1},{"date":"2020-06-21","count":5},{"date":"2020-06-22","count":1},{"date":"2020-06-23","count":6},{"date":"2020-06-24","count":1},{"date":"2020-06-25","count":5},{"date":"2020-06-26","count":1},{"date":"2020-06-27","count":10},{"date":"2020-06-28","count":6},{"date":"2020-06-29","count":4},{"date":"2020-06-30","count":13},{"date":"2020-07-01","count":0},{"date":"2020-07-02","count":0},{"date":"2020-07-03","count":14},{"date":"2020-07-04","count":3},{"date":"2020-07-05","count":2},{"date":"2020-07-06","count":6},{"date":"2020-07-07","count":9},{"date":"2020-07-08","count":0},{"date":"2020-07-09","count":0},{"date":"2020-07-10","count":0},{"date":"2020-07-11","count":0},{"date":"2020-07-12","count":4},{"date":"2020-07-13","count":0},{"date":"2020-07-14","count":0},{"date":"2020-07-15","count":0},{"date":"2020-07-16","count":1},{"date":"2020-07-17","count":0},{"date":"2020-07-18","count":0},{"date":"2020-07-19","count":0},{"date":"2020-07-20","count":1},{"date":"2020-07-21","count":1},{"date":"2020-07-22","count":0},{"date":"2020-07-23","count":0},{"date":"2020-07-24","count":0},{"date":"2020-07-25","count":0},{"date":"2020-07-26","count":4},{"date":"2020-07-27","count":0},{"date":"2020-07-28","count":0},{"date":"2020-07-29","count":3},{"date":"2020-07-30","count":0},{"date":"2020-07-31","count":0},{"date":"2020-08-01","count":0},{"date":"2020-08-02","count":0},{"date":"2020-08-03","count":0},{"date":"2020-08-04","count":0},{"date":"2020-08-05","count":0},{"date":"2020-08-06","count":0},{"date":"2020-08-07","count":0},{"date":"2020-08-08","count":0},{"date":"2020-08-09","count":0},{"date":"2020-08-10","count":0},{"date":"2020-08-11","count":0},{"date":"2020-08-12","count":0},{"date":"2020-08-13","count":0},{"date":"2020-08-14","count":0},{"date":"2020-08-15","count":0},{"date":"2020-08-16","count":0},{"date":"2020-08-17","count":0},{"date":"2020-08-18","count":4},{"date":"2020-08-19","count":0},{"date":"2020-08-20","count":1},{"date":"2020-08-21","count":0},{"date":"2020-08-22","count":0},{"date":"2020-08-23","count":3},{"date":"2020-08-24","count":2},{"date":"2020-08-25","count":6},{"date":"2020-08-26","count":0},{"date":"2020-08-27","count":11},{"date":"2020-08-28","count":0},{"date":"2020-08-29","count":0},{"date":"2020-08-30","count":20},{"date":"2020-08-31","count":3},{"date":"2020-09-01","count":5},{"date":"2020-09-02","count":4},{"date":"2020-09-03","count":21},{"date":"2020-09-04","count":1},{"date":"2020-09-05","count":1},{"date":"2020-09-06","count":9},{"date":"2020-09-07","count":9},{"date":"2020-09-08","count":2},{"date":"2020-09-09","count":0},{"date":"2020-09-10","count":0},{"date":"2020-09-11","count":0},{"date":"2020-09-12","count":3},{"date":"2020-09-13","count":6},{"date":"2020-09-14","count":1},{"date":"2020-09-15","count":2},{"date":"2020-09-16","count":4},{"date":"2020-09-17","count":0},{"date":"2020-09-18","count":9},{"date":"2020-09-19","count":35},{"date":"2020-09-20","count":20},{"date":"2020-09-21","count":0},{"date":"2020-09-22","count":3},{"date":"2020-09-23","count":0},{"date":"2020-09-24","count":0},{"date":"2020-09-25","count":32},{"date":"2020-09-26","count":19},{"date":"2020-09-27","count":51},{"date":"2020-09-28","count":3},{"date":"2020-09-29","count":0},{"date":"2020-09-30","count":2},{"date":"2020-10-01","count":2},{"date":"2020-10-02","count":15},{"date":"2020-10-03","count":10},{"date":"2020-10-04","count":3},{"date":"2020-10-05","count":7},{"date":"2020-10-06","count":1},{"date":"2020-10-07","count":3},{"date":"2020-10-08","count":10},{"date":"2020-10-09","count":2},{"date":"2020-10-10","count":35},{"date":"2020-10-11","count":15},{"date":"2020-10-12","count":12},{"date":"2020-10-13","count":1},{"date":"2020-10-14","count":0},{"date":"2020-10-15","count":5},{"date":"2020-10-16","count":6},{"date":"2020-10-17","count":20},{"date":"2020-10-18","count":2},{"date":"2020-10-19","count":19},{"date":"2020-10-20","count":5},{"date":"2020-10-21","count":3},{"date":"2020-10-22","count":0},{"date":"2020-10-23","count":13},{"date":"2020-10-24","count":3},{"date":"2020-10-25","count":15},{"date":"2020-10-26","count":2},{"date":"2020-10-27","count":0},{"date":"2020-10-28","count":0},{"date":"2020-10-29","count":3},{"date":"2020-10-30","count":1},{"date":"2020-10-31","count":3},{"date":"2020-11-01","count":1},{"date":"2020-11-02","count":2},{"date":"2020-11-03","count":4},{"date":"2020-11-04","count":16},{"date":"2020-11-05","count":28},{"date":"2020-11-06","count":17},{"date":"2020-11-07","count":22},{"date":"2020-11-08","count":15},{"date":"2020-11-09","count":14},{"date":"2020-11-10","count":25},{"date":"2020-11-11","count":1},{"date":"2020-11-12","count":0},{"date":"2020-11-13","count":7},{"date":"2020-11-14","count":11},{"date":"2020-11-15","count":3},{"date":"2020-11-16","count":0},{"date":"2020-11-17","count":4},{"date":"2020-11-18","count":9},{"date":"2020-11-19","count":5},{"date":"2020-11-20","count":6},{"date":"2020-11-21","count":7},{"date":"2020-11-22","count":34},{"date":"2020-11-23","count":41},{"date":"2020-11-24","count":17},{"date":"2020-11-25","count":11},{"date":"2020-11-26","count":17},{"date":"2020-11-27","count":9},{"date":"2020-11-28","count":42},{"date":"2020-11-29","count":33},{"date":"2020-11-30","count":25},{"date":"2020-12-01","count":23},{"date":"2020-12-02","count":22},{"date":"2020-12-03","count":15},{"date":"2020-12-04","count":21},{"date":"2020-12-05","count":8},{"date":"2020-12-06","count":32},{"date":"2020-12-07","count":10},{"date":"2020-12-08","count":13},{"date":"2020-12-09","count":15},{"date":"2020-12-10","count":7},{"date":"2020-12-11","count":26},{"date":"2020-12-12","count":16},{"date":"2020-12-13","count":26},{"date":"2020-12-14","count":9},{"date":"2020-12-15","count":9},{"date":"2020-12-16","count":11},{"date":"2020-12-17","count":21},{"date":"2020-12-18","count":9},{"date":"2020-12-19","count":38},{"date":"2020-12-20","count":31},{"date":"2020-12-21","count":1},{"date":"2020-12-22","count":7},{"date":"2020-12-23","count":13},{"date":"2020-12-24","count":1},{"date":"2020-12-25","count":14},{"date":"2020-12-26","count":6},{"date":"2020-12-27","count":3},{"date":"2020-12-28","count":1},{"date":"2020-12-29","count":5},{"date":"2020-12-30","count":56},{"date":"2020-12-31","count":34},{"date":"2021-01-01","count":12},{"date":"2021-01-02","count":25},{"date":"2021-01-03","count":55},{"date":"2021-01-04","count":14},{"date":"2021-01-05","count":31},{"date":"2021-01-06","count":39},{"date":"2021-01-07","count":15},{"date":"2021-01-08","count":1},{"date":"2021-01-09","count":23},{"date":"2021-01-10","count":7},{"date":"2021-01-11","count":0},{"date":"2021-01-12","count":4},{"date":"2021-01-13","count":1},{"date":"2021-01-14","count":10},{"date":"2021-01-15","count":2},{"date":"2021-01-16","count":2},{"date":"2021-01-17","count":9},{"date":"2021-01-18","count":0},{"date":"2021-01-19","count":0},{"date":"2021-01-20","count":4},{"date":"2021-01-21","count":5},{"date":"2021-01-22","count":8},{"date":"2021-01-23","count":2},{"date":"2021-01-24","count":0},{"date":"2021-01-25","count":0},{"date":"2021-01-26","count":0},{"date":"2021-01-27","count":3},{"date":"2021-01-28","count":2},{"date":"2021-01-29","count":13},{"date":"2021-01-30","count":4},{"date":"2021-01-31","count":8},{"date":"2021-02-01","count":23},{"date":"2021-02-02","count":0},{"date":"2021-02-03","count":3},{"date":"2021-02-04","count":3},{"date":"2021-02-05","count":13},{"date":"2021-02-06","count":10},{"date":"2021-02-07","count":18},{"date":"2021-02-08","count":1},{"date":"2021-02-09","count":21},{"date":"2021-02-10","count":0},{"date":"2021-02-11","count":12},{"date":"2021-02-12","count":27},{"date":"2021-02-13","count":25},{"date":"2021-02-14","count":6},{"date":"2021-02-15","count":25},{"date":"2021-02-16","count":7},{"date":"2021-02-17","count":12},{"date":"2021-02-18","count":4},{"date":"2021-02-19","count":27},{"date":"2021-02-20","count":5},{"date":"2021-02-21","count":5},{"date":"2021-02-22","count":11},{"date":"2021-02-23","count":15},{"date":"2021-02-24","count":9},{"date":"2021-02-25","count":4},{"date":"2021-02-26","count":1},{"date":"2021-02-27","count":2},{"date":"2021-02-28","count":9},{"date":"2021-03-01","count":32},{"date":"2021-03-02","count":31},{"date":"2021-03-03","count":29},{"date":"2021-03-04","count":72},{"date":"2021-03-05","count":67},{"date":"2021-03-06","count":4},{"date":"2021-03-07","count":0},{"date":"2021-03-08","count":5},{"date":"2021-03-09","count":4},{"date":"2021-03-10","count":3},{"date":"2021-03-11","count":1},{"date":"2021-03-12","count":10},{"date":"2021-03-13","count":18},{"date":"2021-03-14","count":5},{"date":"2021-03-15","count":3},{"date":"2021-03-16","count":11},{"date":"2021-03-17","count":8},{"date":"2021-03-18","count":17},{"date":"2021-03-19","count":18},{"date":"2021-03-20","count":5},{"date":"2021-03-21","count":10},{"date":"2021-03-22","count":4},{"date":"2021-03-23","count":2},{"date":"2021-03-24","count":5},{"date":"2021-03-25","count":11},{"date":"2021-03-26","count":23},{"date":"2021-03-27","count":8},{"date":"2021-03-28","count":3},{"date":"2021-03-29","count":27},{"date":"2021-03-30","count":3},{"date":"2021-03-31","count":11},{"date":"2021-04-01","count":13},{"date":"2021-04-02","count":2},{"date":"2021-04-03","count":0},{"date":"2021-04-04","count":3}],"lastRefresh":1617565490828} \ No newline at end of file diff --git a/package.json b/package.json index ceb9a7d..3280b6f 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "next": "10.0.5", "react": "17.0.1", "react-calendar-heatmap": "^1.8.1", - "react-dom": "17.0.1" + "react-dom": "17.0.1", + "swr": "^0.5.5" }, "devDependencies": { "@babel/core": "^7.12.10", diff --git a/src/components/GitActivity/GitActivity.stories.tsx b/src/components/GitActivity/GitActivity.stories.tsx deleted file mode 100644 index fad74c5..0000000 --- a/src/components/GitActivity/GitActivity.stories.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from "react" -import { Story, Meta } from "@storybook/react/types-6-0" -import { GitActivity, GitActivityProps } from "." - -export default { - title: "Component/GitActivity", - component: GitActivity, - argTypes: { - - } -} as Meta - -const Template: Story = (args) => - -// Default scenario -export const Default = Template.bind({}) -Default.args = {} diff --git a/src/components/GitActivity/index.tsx b/src/components/GitActivity/index.tsx index ab95004..33f7fbf 100644 --- a/src/components/GitActivity/index.tsx +++ b/src/components/GitActivity/index.tsx @@ -1,13 +1,80 @@ import React from "react"; +import useSWR from "swr"; +import fetch from "node-fetch"; +import CalendarHeatmap from "react-calendar-heatmap"; +import 'react-calendar-heatmap/dist/styles.css'; + +// @ts-ignore +const fetcher = (...args) => fetch(...args).then(res => res.json()) export interface GitActivityProps { } -export const GitActivity: React.FC = () => { +export const GitActivity: React.FunctionComponent = () => { + const { data, error } = useSWR('/api/getGitActivity', fetcher); - return ( -
-
- ) + if (error) { + return ( +
FAILED TO LOAD
+ ); + } + else if (!data) { + return ( +
LOADING
+ ); + } + else { + // let d = JSON.parse(data.data); + + let startDate = new Date(data.data[data.data.length - 1].date); + startDate.setDate(startDate.getDate() - 365); + + console.log(data.data); + + let largest = 0; + + for(let dataPoint of data.data) { + if(dataPoint.count > largest) { + largest = dataPoint.count; + } + } + + console.log(largest); + + return ( +
+ { + let value = obj.count; + + let ret = "fill-current "; + + if (!value) { + ret += "text-primary-100"; + } + else { + if(value <= largest * 0.25) { + ret += "text-primary-200"; + } + else if (value <= largest * 0.5) { + ret += "text-primary-300"; + } + else if (value <= largest * 0.75) { + ret += "text-primary-400"; + } + else { + ret += "text-primary-500"; + } + } + + return ret; + }} + /> +
+ ); + } } diff --git a/src/pages/api/getGitActivity.ts b/src/pages/api/getGitActivity.ts index dc07764..909e6d6 100644 --- a/src/pages/api/getGitActivity.ts +++ b/src/pages/api/getGitActivity.ts @@ -3,7 +3,7 @@ import * as fs from "fs"; const path = "./cache/getGitActivity"; const validTime = 1000 * 60 * 30; // 30 min in milliseconds -type GitActivityCache = { +export type GitActivityCache = { data: Map, lastRefresh: number } @@ -19,14 +19,14 @@ export default (req, res) => { } else { getData() - .then((data) => { - res.statusCode = 200; - res.send(data) - }) - .catch(() => { - res.statusCode = 200; - res.send(data.data); - }); + .then((data) => { + res.statusCode = 200; + res.send(data) + }) + .catch(() => { + res.statusCode = 200; + res.send(data.data); + }); } } catch (e) { getData() @@ -42,14 +42,14 @@ export default (req, res) => { } else { getData() - .then((data) => { - res.statusCode = 200; - res.send(data) - }) - .catch(() => { - res.statusCode = 500; - res.send("Error while fetching data."); - }); + .then((data) => { + res.statusCode = 200; + res.send(data) + }) + .catch(() => { + res.statusCode = 500; + res.send("Error while fetching data."); + }); } } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index b223821..1faa619 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,4 +1,5 @@ import Head from "next/head" +import {GitActivity} from "../components/GitActivity"; export default function Home() { return ( @@ -7,6 +8,7 @@ export default function Home() { nwex.de + ) } diff --git a/tailwind.config.js b/tailwind.config.js index 17ec47f..48f89c5 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -17,7 +17,13 @@ module.exports = { '3xl': '1900px', }, colors: { - 'primary': '#fb8919', + 'primary': { + 100: '#FEE7D1', + 200: '#FDD0A3', + 300: '#FCB875', + 400: '#FBA047', + 500: '#fb8919', + }, 'secondary': { 100: '#8f969e', 200: '#78818d', diff --git a/yarn.lock b/yarn.lock index 2a30e30..6606511 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5171,6 +5171,11 @@ dependency-graph@^0.9.0: resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.9.0.tgz#11aed7e203bc8b00f48356d92db27b265c445318" integrity sha512-9YLIBURXj4DJMFALxXw9K3Y3rwb5Fk0X5/8ipCzaN84+gKxoHK43tVKRNakCQbiEx07E8Uwhuq21BpUagFhZ8w== +dequal@2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.2.tgz#85ca22025e3a87e65ef75a7a437b35284a7e319d" + integrity sha512-q9K8BlJVxK7hQYqa6XISGmBZbtQQWVXSrRrWreHC94rMt1QL/Impruc+7p2CYSYuVIUr+YCt6hjrs1kkdJRTug== + des.js@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" @@ -12023,6 +12028,13 @@ svgo@^1.2.2: unquote "~1.1.1" util.promisify "~1.0.0" +swr@^0.5.5: + version "0.5.5" + resolved "https://registry.yarnpkg.com/swr/-/swr-0.5.5.tgz#c72c1615765f33570a16bbb13699e3ac87eaaa3a" + integrity sha512-u4mUorK9Ipt+6LEITvWRWiRWAQjAysI6cHxbMmMV1dIdDzxMnswWo1CyGoyBHXX91CchxcuoqgFZ/ycx+YfhCA== + dependencies: + dequal "2.0.2" + symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"