diff --git a/src/Sleep.js b/src/Sleep.js
index 336cc38..107cc50 100644
--- a/src/Sleep.js
+++ b/src/Sleep.js
@@ -1,10 +1,8 @@
class Sleep {
constructor(sleepData, userNow, date, userRepo) {
- // constructor(sleepData, userNow, userRepo) {
this.sleepData = sleepData;
this.user = userNow;
this.date = date;
- // this.date = this.returnToday(this.sleepData);
this.userRepo = userRepo;
}
@@ -35,13 +33,11 @@ class Sleep {
});
return findSleepQualityByDate.sleepQuality;
}
-
- calculateWeekSleep() {
- return this.userRepo.getWeekFromDate(this.date, this.user.id, this.sleepData).map((data) => `${data.date}: ${data.hoursSlept}`);
- }
-
- calculateWeekSleepQuality() {
- return this.userRepo.getWeekFromDate(this.date, this.user.id, this.sleepData).map((data) => `${data.date}: ${data.sleepQuality}`);
+
+ userDataForWeek(relevantData) {
+ return this.userRepo.getWeekFromDate(this.date, this.user.id, this.sleepData).map((data) => {
+ return {x: data.date, y: data[relevantData]}
+ });
}
calculateAllUserSleepQuality() {
@@ -52,44 +48,7 @@ class Sleep {
let total = totalSleepQuality / this.sleepData.length;
return parseFloat(total.toFixed(2));
}
-// determineBestSleepers(date, userRepo) {
-// let timeline = userRepo.chooseWeekDataForAllUsers(this.sleepData, date);
-// let userSleepObject = userRepo.isolateUsernameAndRelevantData(this.sleepData, date, 'sleepQuality', timeline);
-
-// return Object.keys(userSleepObject).filter(function(key) {
-// return (userSleepObject[key].reduce(function(sumSoFar, sleepQualityValue) {
-// sumSoFar += sleepQualityValue
-// return sumSoFar;
-// }, 0) / userSleepObject[key].length) > 3
-// }).map(function(sleeper) {
-// return userRepo.getDataFromID(parseInt(sleeper)).name;
-// })
-// }
-// determineSleepWinnerForWeek(date, userRepo) {
-// let timeline = userRepo.chooseWeekDataForAllUsers(this.sleepData, date);
-// let sleepRankWithData = userRepo.combineRankedUserIDsAndAveragedData(this.sleepData, date, 'sleepQuality', timeline);
-
-// return this.getWinnerNamesFromList(sleepRankWithData, userRepo);
-// }
-// determineSleepHoursWinnerForDay(date, userRepo) {
-// let timeline = userRepo.chooseDayDataForAllUsers(this.sleepData, date);
-// let sleepRankWithData = userRepo.combineRankedUserIDsAndAveragedData(this.sleepData, date, 'hoursSlept', timeline);
-
-// return this.getWinnerNamesFromList(sleepRankWithData, userRepo);
-// }
-// getWinnerNamesFromList(sortedArray, userRepo) {
-// let bestSleepers = sortedArray.filter(function(element) {
-// return element[Object.keys(element)] === Object.values(sortedArray[0])[0]
-// });
-
-// let bestSleeperIds = bestSleepers.map(function(bestSleeper) {
-// return (Object.keys(bestSleeper));
-// });
-// return bestSleeperIds.map(function(sleepNumber) {
-// return userRepo.getDataFromID(parseInt(sleepNumber)).name;
-// });
-// }
}
diff --git a/src/css/style.scss b/src/css/style.scss
index ed4a5b5..2156aaa 100644
--- a/src/css/style.scss
+++ b/src/css/style.scss
@@ -1,4 +1,7 @@
+
+
* {
+ font-family: 'Montserrat', sans-serif !important;
margin: 0;
}
@@ -16,6 +19,10 @@ h1 {
padding-top: 10px;
}
+h2{
+ padding: 10px !important;
+}
+
.main {
display: flex;
flex-direction: row;
@@ -81,39 +88,42 @@ h1 {
.body-main-infoContainter {
width: 100%;
- border: 1px solid black;
margin: 0 0 1em;
display: flex;
- flex-direction: column;
- overflow: scroll;
+ flex-direction: row;
+ justify-content: space-between;
}
.main-column-hydration {
+ align-items: center;
+ padding: 0px 15px;
display: flex;
- flex-direction: row;
- height: 25%
+ flex-direction: column;
+ height: 100%
}
.main-column-activity {
+ align-items: center;
display: flex;
- flex-direction: row;
- height: 50%
+ flex-direction: column;
+ height: 100%;
}
.main-column-sleep {
+ align-items: center;
display: flex;
- flex-direction: row;
- height: 35%
+ flex-direction: column;
+ height: 100%;
+ padding: 0px 15px;
}
.infoContainer-cardContainer-card-horizontal {
width: 100%;
background-color: white;
- border: 1px solid black;
+ // border: 1px solid black;
display: flex;
flex-direction: column;
align-items: center;
- margin: 1%;
justify-content: space-between;
}
@@ -122,17 +132,15 @@ h1 {
flex-direction: row;
justify-content: space-around;
width: 100%;
- overflow: scroll;
}
.infoContainer-cardContainer-card-vertical {
width: 100%;
- background-color: white;
- border: 1px solid black;
+ // background-color: white;
+ // border: 1px solid black;
display: flex;
flex-direction: row;
- margin: 1%;
- overflow: scroll;
+ // margin: 1%;
}
.card-today-hydration {
@@ -176,40 +184,36 @@ h1 {
.card-history-hydration {
text-align: center;
- background-color: #5BC8AC;
+ background-color: #ffffff;
font-size: 1em;
- margin: .5em;
+ // margin: .5em;
font-family: sans-serif;
display: flex;
flex-direction: column;
justify-content: flex-start;
- width: 50%;
+ // width: 50%;
}
.card-history-sleep {
text-align: center;
- background-color: #EC96A4;
font-size: 1em;
margin: .5em;
font-family: sans-serif;
display: flex;
flex-direction: column;
justify-content: flex-start;
- width: 50%;
}
.card-history-activity {
text-align: center;
- background-color: #DFE166;
font-size: 1em;
margin: .5em;
font-family: sans-serif;
display: flex;
flex-direction: column;
justify-content: flex-start;
- width: 50%;
+ // width: 50%;
height: 93%;
- overflow: scroll;
}
.number {
@@ -219,6 +223,10 @@ h1 {
font-kerning: normal;
}
+.percent {
+ padding: 0px 0px 15px 0px;
+}
+
.historicalWeek {
text-align: center;
font-size: 1em;
@@ -248,3 +256,237 @@ h1 {
font-weight: bold;
font-family: sans-serif;
}
+
+
+.box{
+ position:relative;
+ width:fit-content;
+ height:400px;
+ display:flex;
+ justify-content:center;
+ align-items:center;
+ flex-direction:column;
+ background: #fff0;
+}
+
+
+.box .percent svg{
+ padding-bottom: 5px;
+ overflow: visible;
+ position:relative;
+ width: 150px;
+ height: 150px;
+}
+
+.box .percent svg circle {
+ width: 150px;
+ height: 150px;
+ fill: none;
+ stroke-width: 10;
+ stroke: #000;
+ transform: translate(5px,5px);
+ stroke-dasharray:440;
+ stroke-dashoffset:440;
+ stroke-linecap:round;
+}
+
+.box .percent svg circle:nth-child(1){
+ stroke-dashoffset:0;
+ stroke:#f3f3f3;
+ transform: rotate(-90deg);
+ transform-origin: center;
+}
+
+@keyframes circle-chart-fill {
+ to { stroke-dasharray: 0 100; }
+}
+
+#chart-bar{
+ animation: circle-chart-fill 4s reverse;
+ transform: rotate(-90deg);
+ transform-origin: center;
+ stroke-dashoffset: calc(440 - (440*87) / 100);
+ &hydro {
+ @extend #chart-bar;
+ stroke: #00aeff;
+ }
+ &activity {
+ @extend #chart-bar;
+ stroke: #DFE166;
+ }
+ &sleep {
+ @extend #chart-bar;
+ stroke: #EC96A4;
+ }
+}
+
+.box .percent .number{
+ flex-direction: column;
+ position: absolute;
+ top:0;
+ left:0;
+ width:100%;
+ height:90%;
+ display:flex;
+ justify-content:center;
+ align-items: center;
+ &hydro {
+ @extend .box, .percent, .number;
+ color: #00aeff;
+ }
+ &activity {
+ @extend .box, .percent, .number;
+ color: #DFE166;
+ height: 95%;
+ }
+ &sleep {
+ @extend .box, .percent, .number;
+ color: #EC96A4;
+ }
+}
+
+.box .percent .number h2{
+ font-size: 27px;
+}
+
+.box .percent .number h2 span{
+ font-size:22px;
+}
+
+.box .text{
+ font-size: 14px;
+ font-weight: 700;
+ letter-spacing: 1px;
+ width: max-content;
+ height: 0px;
+ &hydro {
+ @extend .box, .text;
+ color: #00aeff;
+ }
+ &activity {
+ @extend .box, .text;
+ color: #DFE166;
+ }
+ &sleep {
+ @extend .box, .text;
+ color: #EC96A4;
+ }
+}
+
+.data-radio{
+ display: flex;
+ flex-direction: row;
+}
+.data-radio-activity {
+ @extend .data-radio;
+ @extend .data-radio, label;
+ @extend .data-radio, input[type="radio"];
+}
+
+.data-radio-sleep {
+ @extend .data-radio-activity;
+}
+
+.data-radio input[type="radio"] {
+ opacity: 0;
+ position: fixed;
+ width: 0;
+}
+
+.data-radio label {
+ color: rgb(255, 255, 255);
+ display: inline-block;
+ background-color: #8b8b8b;
+ padding: 5px 15px;
+ margin: 0px 5px;
+ font-family: sans-serif, Arial;
+ font-size: 13px;
+ border: 1px solid #00aeff;
+ border-radius: 18px;
+ z-index: 1;
+ border: 1px solid #00aeff;
+}
+
+.data-radio input[type="radio"]:checked + label {
+ box-shadow: inset 0px 0px 6px 0px black;
+ background-color:#00aeff;
+ border-color: rgb(255, 255, 255);
+}
+
+.data-radio-activity label {
+ color: rgb(18, 18, 18);
+ display: inline-block;
+ background-color: #8b8b8b;
+ padding: 5px 15px;
+ margin: 0px 5px;
+ font-family: sans-serif, Arial;
+ font-size: 13px;
+ border: 1px solid #DFE166;
+ border-radius: 18px;
+ z-index: 1;
+ border: 1px solid #DFE166;
+}
+
+.data-radio-activity input[type="radio"]:checked + label {
+ box-shadow: inset 0px 0px 6px 0px black;
+ background-color:#DFE166;
+ border-color: rgb(255, 255, 255);
+}
+
+.data-radio-sleep label {
+ color: rgb(18, 18, 18);
+ display: inline-block;
+ background-color: #8b8b8b;
+ padding: 5px 15px;
+ margin: 0px 5px;
+ font-family: sans-serif, Arial;
+ font-size: 13px;
+ border: 1px solid #EC96A4;
+ border-radius: 18px;
+ z-index: 1;
+ border: 1px solid #EC96A4;
+}
+
+.data-radio-sleep input[type="radio"]:checked + label {
+ box-shadow: inset 0px 0px 6px 0px black;
+ background-color:#EC96A4;
+ border-color: rgb(255, 255, 255);
+}
+
+.title{
+ font-size: 48px;
+ &hydro {
+ @extend .title;
+ color: #00aeff;
+ }
+ &activity {
+ @extend .title;
+ color: #DFE166;
+ }
+ &sleep{
+ @extend .title;
+ color: #EC96A4;
+ }
+}
+
+
+.activity-charts{
+ display: flex !important;
+ flex: row;
+ justify-content: center;
+ width: 75%;
+}
+
+.error-message{
+ color: red;
+}
+
+
+.hidden {
+ display: none;
+}
+
+
+.visibility {
+ visibility: hidden;
+}
diff --git a/src/index.html b/src/index.html
index 74f515e..97f6bbb 100644
--- a/src/index.html
+++ b/src/index.html
@@ -1,10 +1,14 @@
+
Activity Tracker
-
+
+
+
@@ -16,6 +20,7 @@
+
@@ -24,31 +29,44 @@
-
-
-
-
-
- Keep up the good work! You were increasingly active on these dates:
-
-
+
+
+
+
+
+
+ Keep up the good work! You were increasingly active on these dates:
+
+
-
-
-
+
@@ -68,121 +86,147 @@
-
-
-
-
-
+
Activity
+
+
+
+
+
+
+
+
-
+
Activity Category
+
+
+
+
+
+
+
+
+
+
-
-
Your steps this week
-
-
-
-
-
Your stair count this week
+
-
-
-
-
Your minutes of activity this week
-
-
-
-
-
Winner's steps this week
-
-
+
-
-
+
Sleep
+
+
+
+
+
-
-
+
-
-
+
+
+
+
+
-
-
-
Hours of sleep this week
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
- You had 3 DAY STEP STREAKS on these days:
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ You had 3 DAY STEP STREAKS on these days:
+
+
-
+
+