diff --git a/README.md b/README.md index 0ccaeef0f0..ba167908d3 100644 --- a/README.md +++ b/README.md @@ -1,78 +1,58 @@ -# FitLit Starter Kit - -The details of this project are outline in [this project spec](http://frontend.turing.io/projects/fitlit.html). - -## Setup - -1. Within your group, decide on one person to have the project repository (repo) on their GitHub account. Then, that person should fork this repo - on the top right corner of this page, click the **Fork** button. -1. Both memebers of the group should clone down the _forked_ repo. Since you don't want to name your project "activity-tracker-starter", you can use an optional argument when you run git clone (you replace the [...] with the terminal command arguments): `git clone [remote-address] [what you want to name the repo]` -1. Once you have cloned the repo, change into the directory and install the project dependencies. Run `npm install` to install project dependencies. -1. Run `npm start` in the terminal to see the HTML page (you should see some boilerplate HTML displayed on the page). `Control + C` is the command to stop running the local server. Closing the terminal without stopping the server first could allow the server to continue to run in the background and cause problems. This command is not specific to Webpack; make note of it for future use. -1. Make sure both members of your team are collaborators on the forked repo. -1. Do not run `npm audit fix --force`. This will update to the latest version of packages. We need to be using `webpack-dev-server@3.11.2` which is not the latest version. If you start to run into Webpack errors, first check that all group members are using the correct version. - -## Testing - -There is no boilerplate for testing in this starter-kit repo. You will need to set this up yourself. However, if you ran `npm install`, then the tooling you need to start testing is already installed (`mocha` and `chai`). - - -## Data Model - -**Users** - -``` -[ - { - "id": [number], - "name": [string], - "address": [string], - "email": [string], - "strideLength": [number - feet], - "dailyStepGoal": [number - steps], - "friends": [array - one-way connection to other user(s)] - }, - ...more user data -] -``` - -**Activity** - -``` -[ - { - "userID": [number], - "date": [string YYYY/MM/DD], - "numSteps": [number - steps], - "minutesActive": [number - minutes], - "flightsOfStairs": [number - flights] - }, - ...more activity data -] -``` - -**Hydration** - -``` -[ - { - "userID": [number], - "date": [string YYYY/MM/DD], - "numOunces": [number - ounces] - }, - ...more hydration data -] -``` - -**Sleep** - -``` -[ - { - "userID": [number], - "date": [string YYYY/MM/DD], - "hoursSlept": [number - hours], - "sleepQuality": [number - unitless] - }, - ...more sleep data -] -``` +# Fit-Lit + +### Abstract: +[//]: <> (Briefly describe what you built and its features. What problem is the app solving? How does this application solve that problem?) +Here we built a fitness dashboard to display a random users info. This includes their hydration, sleep, and step activity along with their personal info. + +### Installation Instructions: +[//]: <> (What steps does a person have to take to get your app cloned down and running?) +1. Fork this repo - on the top right corner of this page, click the **Fork** button. +2. Clone down the _forked_ repo. Since you don't want to name your project "activity-tracker-starter", you can use an optional argument when you run git clone (you replace the [...] with the terminal command arguments): `git clone [remote-address] [what you want to name the repo]` +3. Once you have cloned the repo, change into the directory and install the project dependencies. Run `npm install` to install project dependencies. +4. Run `npm start` in the terminal to see the HTML page. `Control + C` is the command to stop running the local server. Closing the terminal without stopping the server first could allow the server to continue to run in the background and cause problems. This command is not specific to Webpack; make note of it for future use. +5. Do not run `npm audit fix --force`. This will update to the latest version of packages. We need to be using `webpack-dev-server@3.11.2` which is not the latest version. If you start to run into Webpack errors, first check that all group members are using the correct version. + +### Preview of App: +[//]: <> (Provide ONE gif or screenshot of your application - choose the "coolest" piece of functionality to show off.) +![IdeaBox SS](https://user-images.githubusercontent.com/67208858/200420479-a7c3cd6c-da16-4ff5-8f36-1e14df3d3411.jpg) + +### Context: +[//]: <> (Give some context for the project here. How long did you have to work on it? How far into the Turing program are you?) +We were given approximately 11 days to work on this project. We spent about 50 hours from start to finish. We are on Week 3 of Mod 2. + +### Contributors: +[//]: <> (Who worked on this application? Link to their GitHubs.) +- Craig Weller: + https://github.com/crgweller + https://www.linkedin.com/in/craig-weller/ +- Anna Peterson: + https://github.com/jsahim + https://www.linkedin.com/in +- Ciera DePauw: + https://github.com/cieragrace + https://www.linkedin.com/in/karimal-rashdan/ +- Keenan Southall: + https://github.com/keenans1 + https://www.linkedin.com/in/keenan-southall/ + + +### Learning Goals: +[//]: <> (What were the learning goals of this project? What tech did you work with?) +- Gain an understanding of how to write clean HTML and CSS to match a provided comp +- Understand what it looks like to have a separate data model (using classes) and DOM display +- Incorporate & iterate over arrays in order to filter what is being displayed +- Craft code with clean style, using small functions that show trends toward DRYness and SRP +- Work with an API along with fetch calls and promises +- We worked with JavaScript, HTML, CSS, Git/GitHub workflow, API + +### Wins + Challenges: +[//]: <> (What are 2-3 wins you have from this project? What were some challenges you faced - and how did you get over them?) + +#### Wins +- We got through all 4 iterations +- We had good communication and maintained a positive work environment +- We navigated working together and adapted to different team enironments (splitting off into pairs, working all together, etc...) + +#### Challenges +- We utilised our mentors/peers help when we were unable to come up with a solution +- We all have different schedules, and had to adjust to family/friends/health \ No newline at end of file diff --git a/dist/bundle.js b/dist/bundle.js index 75e39b096b..c5d375c3e5 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -1,6 +1,6 @@ /******/ (() => { // webpackBootstrap var __webpack_exports__ = {}; - alert('hello') + // alert('hello') /******/ })() ; \ No newline at end of file diff --git a/dist/index.html b/dist/index.html index 444322806c..1affa91bb0 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,14 +1,56 @@ - - - - Fitlit - - -

Activity Tracker

- turing logo - - - - + + + + + + + + Fitlit + + + +
+

Welcome

+ +
+
+
+
+

Daily Sleep

+ +

Sleep Quality

+ +
+
+

Step Goal

+ +
+
+

Your Info

+
    +
    +
    +

    Hydration

    + +
    +
    +

    Sleep History

    + + +
    +
    +

    Weekly Hydration

    + +
    +
    +
    + + + + + + + \ No newline at end of file diff --git a/package.json b/package.json index 90731f1d8f..87beb4dac3 100644 --- a/package.json +++ b/package.json @@ -22,5 +22,8 @@ "webpack": "^5.38.1", "webpack-cli": "^4.7.0", "webpack-dev-server": "^3.11.2" + }, + "dependencies": { + "chart.js": "^4.0.1" } } diff --git a/src/Sleep.js b/src/Sleep.js new file mode 100644 index 0000000000..0b890f7c31 --- /dev/null +++ b/src/Sleep.js @@ -0,0 +1,7 @@ +class Sleep { + constructor() { + + } +} + +module.exports = Sleep; \ No newline at end of file diff --git a/src/User.js b/src/User.js new file mode 100644 index 0000000000..a4bb7048c0 --- /dev/null +++ b/src/User.js @@ -0,0 +1,152 @@ +class User { + constructor(userData, sleepData, hydrationData) { + this.userData = userData; + this.sleepData = sleepData; + this.hydrationData = hydrationData; + } + + getFirstName() { + return this.userData.name.split(' ')[0]; + } + + // Hydration + getAvgDailyWater(userID) { + let matchedIDS = this.hydrationData.hydrationData.filter((user) => { + return user.userID === userID + }) + let avg = matchedIDS.reduce((acc, curr) => { + acc += curr.numOunces + return acc + }, 0) + return avg / matchedIDS.length + } + + getWaterPerDay(date) { + let dates = this.hydrationData.hydrationData.filter((user) => { + return user.date === date + }) + return dates.reduce((acc, curr) => { + if (curr.userID === this.userData.id) { + acc = curr.numOunces + } + return acc + }, 0) + } + + getWeeklyConsumption() { + let userWeeklyH20 = this.hydrationData.hydrationData.filter(user => { + return user.userID === this.userData.id; + }) + + let weeklyWater = userWeeklyH20.slice(-7); + + let filteredWater = weeklyWater.map(user => { + let date = user.date; + let numOunces = user.numOunces; + let both = {}; + both[date] = numOunces; + return both; + }) + return filteredWater; + } + + // Sleep + getAverageDailySleep() { + let specificUserSleepData = this.getUserSleepData() + let totalHours = specificUserSleepData.reduce((acc, user) => { + acc += user.hoursSlept + return acc + }, 0) + let averageHours = totalHours / specificUserSleepData.length + return Number(averageHours.toFixed(2)) + } + + getUserSleepData() { + let userOverallSleepData = this.sleepData.sleepData.filter(user => { + return user.userID === this.userData.id; + }) + return userOverallSleepData + } + + getOverallQualityAvg() { + let specificUserSleepQuality = this.getUserSleepData() + let totalQuality = specificUserSleepQuality.reduce((acc, user) => { + acc += user.sleepQuality + return acc + }, 0) + let averageQuality = totalQuality / specificUserSleepQuality.length + return Number(averageQuality.toFixed(2)) + } + + sleepOnSpecificDate(date) { + let dates = this.sleepData.sleepData.filter((user) => { + return user.date === date + }) + return dates.reduce((acc, curr) => { + if (curr.userID === this.userData.id) { + acc = curr.hoursSlept + } + return acc + }, 0) + } + + sleepQualityOnSpecificDate(date) { + let dates = this.sleepData.sleepData.filter((user) => { + return user.date === date + }) + return dates.reduce((acc, curr) => { + if (curr.userID === this.userData.id) { + acc = curr.sleepQuality + } + return acc + }, 0) + } + + givenWeekSleepDataByDay() { + let userWeeklySleep = this.sleepData.sleepData.filter(user => { + return user.userID === this.userData.id; + }) + + const last7SleepDays = userWeeklySleep.slice(-7); + + let filteredSleep = last7SleepDays.map(user => { + let sleepDate = user.date; + let sleepHours = user.hoursSlept; + let both = {}; + both[sleepDate] = sleepHours; + return both; + }) + + return filteredSleep; + } + + givenWeeksSleepQualityByDay() { + let userWeeklySleep = this.sleepData.sleepData.filter(user => { + return user.userID === this.userData.id; + }) + + const last7SleepDays = userWeeklySleep.slice(-7); + + let filteredQuality = last7SleepDays.map(user => { + let sleepDate = user.date; + let sleepQuality = user.sleepQuality; + let both = {}; + both[sleepDate] = sleepQuality; + return both; + }) + + return filteredQuality; + } + + averageSleepQuality() { + let totalQuality = this.sleepData.sleepData.reduce((acc, user) => { + acc += user.sleepQuality + return acc + }, 0) + let averageQuality = totalQuality / this.sleepData.sleepData.length + return Number(averageQuality.toFixed(2)) + } + +} + +export default User; \ No newline at end of file diff --git a/src/UserRepository.js b/src/UserRepository.js index 049cf4c197..199e507834 100644 --- a/src/UserRepository.js +++ b/src/UserRepository.js @@ -1,5 +1,22 @@ +import User from './User'; + class UserRepository { + constructor(data) { + this.data = data + } + + getData(userID) { + return this.data.userData.find((currentUser) => currentUser.id === userID) + } + stepGoalAverage() { + let sum = this.data.userData.reduce((acc, user) => { + acc += user.dailyStepGoal + return acc + }, 0) + let totalUsers = this.data.userData.length + return parseInt(sum / totalUsers) + } } export default UserRepository; \ No newline at end of file diff --git a/src/apiCalls.js b/src/apiCalls.js index f26ab3fc82..1aaa7d3c27 100644 --- a/src/apiCalls.js +++ b/src/apiCalls.js @@ -1,5 +1,7 @@ -// Your fetch requests will live here! - - -console.log('I will be a fetch request!') +function getAPIData(info) { + const fetchedInfo = fetch(`https://fitlit-api.herokuapp.com/api/v1/${info}`) + .then((res) => res.json()) + return fetchedInfo +} +export { getAPIData } \ No newline at end of file diff --git a/src/charts.js b/src/charts.js new file mode 100644 index 0000000000..aeb441fb40 --- /dev/null +++ b/src/charts.js @@ -0,0 +1,167 @@ +import Chart from 'chart.js/auto'; + +//Global Variables +const barColors = ["orange", "#00aba9",]; +const xValues = ['Day 1', 'Day 2', 'Day 3', 'Day 4', 'Day 5', 'Day 6', 'Day 7']; +const labels = ['All-Time Avg. Sleep Quality (1-5)', 'All-Time Avg. Sleep Duration']; + +//Global Functions +function makeStepCharts(yValues) { + new Chart('stepGoal', { + type: "doughnut", + data: { + labels: ["Your Steps", "Steps Remaining"], + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "Today" + } + } + }); +} + +function makeDailyH20Charts(yValues) { + new Chart('dailyHydration', { + type: "doughnut", + data: { + labels: ["Water Today", "H20 Goal"], + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "Today" + } + } + }); +} + +function dailySleepChart(yValues) { + new Chart('dailySleep', { + type: "doughnut", + data: { + labels: ["Hours Slept"], + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "Today" + } + } + }) +} + +function dailySleepQualityChart(yValues) { + new Chart('dailySleepQuality', { + type: "doughnut", + data: { + labels: ["Quality of Sleep"], + datasets: [{ + backgroundColor: barColors, + data: yValues + }] + }, + options: { + title: { + display: true, + text: "Today" + } + } + }) +} + +function sleepHistoryBarGraph(userSleepHistory, userQualityHistory) { + new Chart('sleepHistory', { + type: "line", + data: { + labels: xValues, + datasets: [{ + label: 'Hours Slept', + data: userSleepHistory, + borderColor: "orange", + fill: false + }, + { + label: 'Sleep Quality', + data: userQualityHistory, + borderColor: "blue", + fill: false + }] + }, + options: { + legend: { display: false } + } + }); +} + +function hydrationBarGraph(hydrationByDay) { + new Chart('weeklyHydration', { + type: "line", + data: { + labels: xValues, + datasets: [{ + label: 'Hydration by Day', + data: hydrationByDay, + borderColor: "blue", + fill: false + },] + }, + options: { + legend: { display: false } + } + }); +} + +function allTimeSleepQuality(allTimeSleep) { + new Chart('allTimeSleepHistory', { + type: "bar", + data: { + labels: labels, + datasets: [{ + label: 'Sleep History', + data: allTimeSleep, + backgroundColor: [ + 'blue', + 'orange' + ], + borderColor: [ + 'rgb(255, 99, 132)', + 'rgb(255, 159, 64)', + ], + borderWidth: 1 + }] + } + }) +} + +function loadCharts( + stepYValues, + dailyH2OYValues, + sleepYValues, + qualityYValues, + userSleepHistory, + userQualityHistory, + hydrationByDay, + allTimeSleep) { + makeStepCharts(stepYValues) + makeDailyH20Charts(dailyH2OYValues) + dailySleepChart(sleepYValues) + dailySleepQualityChart(qualityYValues) + sleepHistoryBarGraph(userSleepHistory, userQualityHistory) + hydrationBarGraph(hydrationByDay) + allTimeSleepQuality(allTimeSleep) +} + +export default loadCharts; \ No newline at end of file diff --git a/src/css/styles.css b/src/css/styles.css index b4a2b0d298..e33f5fe259 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -1,5 +1,47 @@ -body, html { - background-image: linear-gradient(to top, #ff9a9e 0%, #fecfef 99%, #fecfef 100%); +body, +html { + background-image: linear-gradient(to top, aliceblue 0%, lightblue 90%, blue 100%); background-repeat: no-repeat; height: 100%; + font-size: 7px; +} + +.grid-container { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: 20px; + grid-template-rows: 1fr 1fr 1fr; + height: 80vh; + width: 100vw; +} + +.grid-item { + background-color: bisque; + color: black; + border: 2px solid #2c3e50; + border-radius: 25px; + font-size: 4em; + display: flex; + align-items: center; + flex-direction: column; + justify-content: flex-start; +} + +.zero { + grid-column: 2 / 3; +} + +.two { + grid-column: 1; + grid-row: 1 / 3; +} + +.four { + grid-column: 2 / 4; + grid-row: 2; +} + +#stepGoal { + height: 20px; + width: 20px; } \ No newline at end of file diff --git a/src/data/users.js b/src/data/users.js index dc315bd52d..9d541aca00 100644 --- a/src/data/users.js +++ b/src/data/users.js @@ -1,679 +1,679 @@ // Do not edit this file - const userData = [ - { - "id": 1, - "name": "Luisa Hane", - "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", - "email": "Diana.Hayes1@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 16, - 4, - 8 - ] - }, - { - "id": 2, - "name": "Jarvis Considine", - "address": "30086 Kathryn Port, Ciceroland NE 07273", - "email": "Dimitri.Bechtelar11@gmail.com", - "strideLength": 4.5, - "dailyStepGoal": 5000, - "friends": [ - 9, - 18, - 24, - 19 - ] - }, - { - "id": 3, - "name": "Herminia Witting", - "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", - "email": "Elwin.Tromp@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 19, - 11, - 42, - 33 - ] - }, - { - "id": 4, - "name": "Mae Connelly", - "address": "28926 Schinner Islands, Turnermouth NE 23720-3230", - "email": "Marcos_Pollich@hotmail.com", - "strideLength": 3.1, - "dailyStepGoal": 4000, - "friends": [ - 48, - 7, - 44, - 8 - ] - }, - { - "id": 5, - "name": "Erick Schaden", - "address": "514 Mayert Walk, Jordaneside SC 55023-6523", - "email": "Vanessa_Gerhold@gmail.com", - "strideLength": 3.1, - "dailyStepGoal": 8000, - "friends": [ - 13, - 44, - 49, - 33, - 10 - ] - }, - { - "id": 6, - "name": "Jerrold Bogisich", - "address": "8283 Carroll Harbor, Borerfort CT 69020-3448", - "email": "Mercedes_Zboncak53@yahoo.com", - "strideLength": 3.7, - "dailyStepGoal": 11000, - "friends": [ - 11, - 48, - 15 - ] - }, - { - "id": 7, - "name": "Breanne Fay", - "address": "834 Retta Knoll, Stantonland MA 71627-4121", - "email": "Dashawn28@gmail.com", - "strideLength": 2.9, - "dailyStepGoal": 8000, - "friends": [ - 12, - 27, - 22, - 30 - ] - }, - { - "id": 8, - "name": "Laney Abshire", - "address": "86416 Koch Inlet, North Kaciefurt MA 80635", - "email": "Janice_Nitzsche2@yahoo.com", - "strideLength": 2.8, - "dailyStepGoal": 2000, - "friends": [ - 11, - 41, - 23, - 49 - ] - }, - { - "id": 9, - "name": "Myron Schmitt", - "address": "85251 Martina Fields, West Aletha MD 00163-5315", - "email": "Gerard_Langosh22@hotmail.com", - "strideLength": 3.8, - "dailyStepGoal": 6000, - "friends": [ - 16, - 26, - 17 - ] - }, - { - "id": 10, - "name": "Roslyn Bernhard", - "address": "22859 Sean Meadow, Lake Dorthyfort MA 89560", - "email": "Hillary83@gmail.com", - "strideLength": 4.1, - "dailyStepGoal": 3000, - "friends": [ - 40, - 33 - ] - }, - { - "id": 11, - "name": "Dannie Berge", - "address": "52042 Douglas Passage, Port Faye NC 82258", - "email": "Fabian_Murray92@yahoo.com", - "strideLength": 2.9, - "dailyStepGoal": 9000, - "friends": [ - 15, - 19 - ] - }, - { - "id": 12, - "name": "Otis Kuhic", - "address": "853 Kulas Highway, Port Estellbury WI 96713", - "email": "Morton40@hotmail.com", - "strideLength": 3.4, - "dailyStepGoal": 11000, - "friends": [ - 28, - 41, - 24, - 23 - ] - }, - { - "id": 13, - "name": "Tom Schmeler", - "address": "1524 Clemmie River, Newtonbury RI 02849-3159", - "email": "Leopoldo.Sauer@gmail.com", - "strideLength": 3.2, - "dailyStepGoal": 4000, - "friends": [ - 33, - 14, - 3, - 43, - 35 - ] - }, - { - "id": 14, - "name": "Gloria Frami", - "address": "326 Littel Run, Tracemouth HI 02826-6898", - "email": "Jadon.OConnell@hotmail.com", - "strideLength": 3.5, - "dailyStepGoal": 12000, - "friends": [ - 34, - 22 - ] - }, - { - "id": 15, - "name": "Ezequiel Feest", - "address": "78801 Lauryn Plain, Lake Elinor MN 27856-9054", - "email": "Anthony_Toy@hotmail.com", - "strideLength": 4.4, - "dailyStepGoal": 5000, - "friends": [ - 10, - 23, - 35, - 20, - 5 - ] - }, - { - "id": 16, - "name": "Garnett Cruickshank", - "address": "992 Zita Mall, North Tremainemouth MA 19312-3532", - "email": "Laverna47@hotmail.com", - "strideLength": 3.9, - "dailyStepGoal": 10000, - "friends": [ - 25, - 31, - 3, - 16 - ] - }, - { - "id": 17, - "name": "Jade Walter", - "address": "796 Rogahn Track, Lubowitzhaven NJ 62669-3244", - "email": "Dylan_Langworth65@hotmail.com", - "strideLength": 4.3, - "dailyStepGoal": 5000, - "friends": [ - 8, - 31, - 40 - ] - }, - { - "id": 18, - "name": "Dan Hodkiewicz", - "address": "735 Johnnie Crest, New Madisyn IN 51116-6094", - "email": "Gertrude12@gmail.com", - "strideLength": 2.9, - "dailyStepGoal": 2000, - "friends": [ - 33, - 37 - ] - }, - { - "id": 19, - "name": "Wilburn Collins", - "address": "543 Keeling Road, Schummside ID 47123-6269", - "email": "Blake27@gmail.com", - "strideLength": 3.3, - "dailyStepGoal": 8000, - "friends": [ - 30, - 43, - 22, - 39 - ] - }, - { - "id": 20, - "name": "Ora O'Connell", - "address": "79585 Tania Ports, North Lillie MI 38947-4029", - "email": "Audreanne.Gulgowski6@yahoo.com", - "strideLength": 3.4, - "dailyStepGoal": 8000, - "friends": [ - 2, - 12, - 11, - 33 - ] - }, - { - "id": 21, - "name": "Alexandrea Wehner", - "address": "314 Richmond Islands, Brekkefort WI 71702-6994", - "email": "Americo_Hammes31@gmail.com", - "strideLength": 3, - "dailyStepGoal": 9000, - "friends": [ - 29, - 19 - ] - }, - { - "id": 22, - "name": "Maria Kemmer", - "address": "3416 Zoey Cliff, West Eda PA 17789-2282", - "email": "Nya25@yahoo.com", - "strideLength": 4.2, - "dailyStepGoal": 2000, - "friends": [ - 40, - 44, - 14 - ] - }, - { - "id": 23, - "name": "Karli Rodriguez", - "address": "52618 Conroy Burgs, Wiegandhaven NC 32787", - "email": "Marge.Farrell25@yahoo.com", - "strideLength": 3.2, - "dailyStepGoal": 7000, - "friends": [ - 28, - 31, - 14 - ] - }, - { - "id": 24, - "name": "Kristin Cruickshank", - "address": "806 Raynor Port, Kilbackbury OK 11077", - "email": "Waylon_Zulauf@hotmail.com", - "strideLength": 3.3, - "dailyStepGoal": 4000, - "friends": [ - 17, - 16, - 45, - 12 - ] - }, - { - "id": 25, - "name": "Isobel Schmeler", - "address": "5592 Donnelly Trail, Scottieport SC 35511", - "email": "Name79@yahoo.com", - "strideLength": 3.3, - "dailyStepGoal": 4000, - "friends": [ - 37, - 31, - 43 - ] - }, - { - "id": 26, - "name": "Greta Corkery", - "address": "99020 Botsford Knoll, Lake Cecil ID 44141", - "email": "Virgil28@hotmail.com", - "strideLength": 3, - "dailyStepGoal": 12000, - "friends": [ - 10, - 34, - 8, - 43 - ] - }, - { - "id": 27, - "name": "Johnathan Schulist", - "address": "868 Kathryn Pike, Gibsonport ME 79500-6839", - "email": "Mayra49@yahoo.com", - "strideLength": 3, - "dailyStepGoal": 10000, - "friends": [ - 17, - 46, - 40, - 44 - ] - }, - { - "id": 28, - "name": "Noemi Huels", - "address": "5437 Barton Oval, Caesarview RI 88637", - "email": "Geovany.Jaskolski@hotmail.com", - "strideLength": 3.3, - "dailyStepGoal": 2000, - "friends": [ - 18, - 16, - 47 - ] - }, - { - "id": 29, - "name": "Colten Trantow", - "address": "2625 Waino Skyway, Kaceybury ME 18723", - "email": "Demetris67@hotmail.com", - "strideLength": 4.2, - "dailyStepGoal": 9000, - "friends": [ - 9, - 5, - 41 - ] - }, - { - "id": 30, - "name": "Deborah Keebler", - "address": "039 Jerde Brook, South Helen TN 08907-6883", - "email": "Colt_Hermann59@gmail.com", - "strideLength": 3.7, - "dailyStepGoal": 9000, - "friends": [ - 13, - 36, - 2, - 26, - 28 - ] - }, - { - "id": 31, - "name": "Bertrand Yundt", - "address": "0032 Claudia Plain, Delfinaland RI 22298-3685", - "email": "Sibyl.Schmidt39@yahoo.com", - "strideLength": 3.4, - "dailyStepGoal": 7000, - "friends": [ - 16, - 41, - 9 - ] - }, - { - "id": 32, - "name": "Carrie Smith", - "address": "408 Windler Camp, Eddietown MA 11960", - "email": "Nikolas.Brakus31@yahoo.com", - "strideLength": 4.3, - "dailyStepGoal": 3000, - "friends": [ - 47, - 33 - ] - }, - { - "id": 33, - "name": "Leilani Quitzon", - "address": "60013 Golden Overpass, Lake Dejon WI 77309-0820", - "email": "Trinity_Rowe@hotmail.com", - "strideLength": 3.5, - "dailyStepGoal": 8000, - "friends": [ - 4, - 18, - 36, - 30 - ] - }, - { - "id": 34, - "name": "Lindsay Ruecker", - "address": "026 Koelpin Fall, Port Demarcus HI 76813-9743", - "email": "Art44@gmail.com", - "strideLength": 2.5, - "dailyStepGoal": 11000, - "friends": [ - 47, - 19, - 10 - ] - }, - { - "id": 35, - "name": "Nico Bechtelar", - "address": "83360 Christelle Ports, North Elliot IA 75496", - "email": "Eric_Aufderhar@yahoo.com", - "strideLength": 3.3, - "dailyStepGoal": 8000, - "friends": [ - 39, - 23, - 36 - ] - }, - { - "id": 36, - "name": "Clay Pfannerstill", - "address": "40262 Hauck Creek, Halvorsonfurt AL 81358-9303", - "email": "Zander21@gmail.com", - "strideLength": 3.7, - "dailyStepGoal": 8000, - "friends": [ - 40, - 11, - 14, - 29 - ] - }, - { - "id": 37, - "name": "Erling Anderson", - "address": "772 Hamill Avenue, Mortonport ID 38546-4861", - "email": "Aisha6@gmail.com", - "strideLength": 3.4, - "dailyStepGoal": 4000, - "friends": [ - 44, - 19, - 16 - ] - }, - { - "id": 38, - "name": "Kaitlyn Weber", - "address": "9440 Sincere Turnpike, New Shanon MN 11526-5774", - "email": "Dustin48@yahoo.com", - "strideLength": 3.6, - "dailyStepGoal": 10000, - "friends": [ - 5, - 21, - 37 - ] - }, - { - "id": 39, - "name": "Kenyatta Boyle", - "address": "80711 Beer Lakes, Nicolatown WA 89298", - "email": "Bailey_Abbott@yahoo.com", - "strideLength": 3.7, - "dailyStepGoal": 8000, - "friends": [ - 43, - 10, - 17 - ] - }, - { - "id": 40, - "name": "Esperanza Schumm", - "address": "5719 Hal Fork, Frederikstad SC 23125", - "email": "Otis_Beahan@yahoo.com", - "strideLength": 3.5, - "dailyStepGoal": 6000, - "friends": [ - 29, - 28, - 3 - ] - }, - { - "id": 41, - "name": "Meta Leffler", - "address": "51598 Sauer Plaza, Port Vicente WY 87161-8441", - "email": "Brice.Greenholt9@hotmail.com", - "strideLength": 2.8, - "dailyStepGoal": 2000, - "friends": [ - 6, - 45, - 31 - ] - }, - { - "id": 42, - "name": "Ernestine Heathcote", - "address": "9160 Blanche Ford, Dawnmouth OH 11816-1604", - "email": "Brandyn_Quitzon@hotmail.com", - "strideLength": 4.5, - "dailyStepGoal": 9000, - "friends": [ - 20, - 25, - 22 - ] - }, - { - "id": 43, - "name": "Alfonso Sporer", - "address": "584 Mayert Greens, West Arden SC 97033", - "email": "Jadon_Borer@gmail.com", - "strideLength": 4, - "dailyStepGoal": 5000, - "friends": [ - 2, - 19, - 43, - 33 - ] - }, - { - "id": 44, - "name": "Cora Rice", - "address": "32723 Brekke Burg, West Randallburgh DE 20889", - "email": "Coralie80@yahoo.com", - "strideLength": 3.1, - "dailyStepGoal": 8000, - "friends": [ - 25, - 37, - 42, - 27 - ] - }, - { - "id": 45, - "name": "Jennie O'Hara", - "address": "492 Stracke Mews, East Jazlyn OH 58002-5475", - "email": "Elenor.Block12@yahoo.com", - "strideLength": 4.4, - "dailyStepGoal": 7000, - "friends": [ - 35, - 39, - 31, - 25, - 33 - ] - }, - { - "id": 46, - "name": "Vincenzo Hayes", - "address": "03146 Bella Ferry, Port Royceberg NE 64057-4380", - "email": "Carlo.Walker@hotmail.com", - "strideLength": 3.6, - "dailyStepGoal": 4000, - "friends": [ - 10, - 29, - 44 - ] - }, - { - "id": 47, - "name": "Jevon Koss", - "address": "983 Charlotte Island, Schroederchester ME 39894-0208", - "email": "Kasandra_Bashirian@gmail.com", - "strideLength": 4.3, - "dailyStepGoal": 10000, - "friends": [ - 11, - 48, - 27, - 4 - ] - }, - { - "id": 48, - "name": "Jasper Stracke", - "address": "9119 Ziemann Road, Coltberg IA 56671", - "email": "Domenica.Kovacek17@yahoo.com", - "strideLength": 3.6, - "dailyStepGoal": 7000, - "friends": [ - 9, - 7, - 30 - ] - }, - { - "id": 49, - "name": "Herbert Douglas", - "address": "460 Boyd Viaduct, Florianburgh NM 04038-3499", - "email": "Douglas_Swift99@hotmail.com", - "strideLength": 3.8, - "dailyStepGoal": 4000, - "friends": [ - 29, - 15, - 32, - 37, - 31 - ] - }, - { - "id": 50, - "name": "Jordon Lind", - "address": "3866 Jay Loaf, New Felix OR 96784-0274", - "email": "Dane76@hotmail.com", - "strideLength": 4.4, - "dailyStepGoal": 2000, - "friends": [ - 9, - 27, - 21, - 13 - ] - } -]; -export default userData; \ No newline at end of file +// userData = [ +// {const +// "id": 1, +// "name": "Luisa Hane", +// "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", +// "email": "Diana.Hayes1@hotmail.com", +// "strideLength": 4.3, +// "dailyStepGoal": 10000, +// "friends": [ +// 16, +// 4, +// 8 +// ] +// }, +// { +// "id": 2, +// "name": "Jarvis Considine", +// "address": "30086 Kathryn Port, Ciceroland NE 07273", +// "email": "Dimitri.Bechtelar11@gmail.com", +// "strideLength": 4.5, +// "dailyStepGoal": 5000, +// "friends": [ +// 9, +// 18, +// 24, +// 19 +// ] +// }, +// { +// "id": 3, +// "name": "Herminia Witting", +// "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", +// "email": "Elwin.Tromp@yahoo.com", +// "strideLength": 4.4, +// "dailyStepGoal": 5000, +// "friends": [ +// 19, +// 11, +// 42, +// 33 +// ] +// }, +// { +// "id": 4, +// "name": "Mae Connelly", +// "address": "28926 Schinner Islands, Turnermouth NE 23720-3230", +// "email": "Marcos_Pollich@hotmail.com", +// "strideLength": 3.1, +// "dailyStepGoal": 4000, +// "friends": [ +// 48, +// 7, +// 44, +// 8 +// ] +// }, +// { +// "id": 5, +// "name": "Erick Schaden", +// "address": "514 Mayert Walk, Jordaneside SC 55023-6523", +// "email": "Vanessa_Gerhold@gmail.com", +// "strideLength": 3.1, +// "dailyStepGoal": 8000, +// "friends": [ +// 13, +// 44, +// 49, +// 33, +// 10 +// ] +// }, +// { +// "id": 6, +// "name": "Jerrold Bogisich", +// "address": "8283 Carroll Harbor, Borerfort CT 69020-3448", +// "email": "Mercedes_Zboncak53@yahoo.com", +// "strideLength": 3.7, +// "dailyStepGoal": 11000, +// "friends": [ +// 11, +// 48, +// 15 +// ] +// }, +// { +// "id": 7, +// "name": "Breanne Fay", +// "address": "834 Retta Knoll, Stantonland MA 71627-4121", +// "email": "Dashawn28@gmail.com", +// "strideLength": 2.9, +// "dailyStepGoal": 8000, +// "friends": [ +// 12, +// 27, +// 22, +// 30 +// ] +// }, +// { +// "id": 8, +// "name": "Laney Abshire", +// "address": "86416 Koch Inlet, North Kaciefurt MA 80635", +// "email": "Janice_Nitzsche2@yahoo.com", +// "strideLength": 2.8, +// "dailyStepGoal": 2000, +// "friends": [ +// 11, +// 41, +// 23, +// 49 +// ] +// }, +// { +// "id": 9, +// "name": "Myron Schmitt", +// "address": "85251 Martina Fields, West Aletha MD 00163-5315", +// "email": "Gerard_Langosh22@hotmail.com", +// "strideLength": 3.8, +// "dailyStepGoal": 6000, +// "friends": [ +// 16, +// 26, +// 17 +// ] +// }, +// { +// "id": 10, +// "name": "Roslyn Bernhard", +// "address": "22859 Sean Meadow, Lake Dorthyfort MA 89560", +// "email": "Hillary83@gmail.com", +// "strideLength": 4.1, +// "dailyStepGoal": 3000, +// "friends": [ +// 40, +// 33 +// ] +// }, +// { +// "id": 11, +// "name": "Dannie Berge", +// "address": "52042 Douglas Passage, Port Faye NC 82258", +// "email": "Fabian_Murray92@yahoo.com", +// "strideLength": 2.9, +// "dailyStepGoal": 9000, +// "friends": [ +// 15, +// 19 +// ] +// }, +// { +// "id": 12, +// "name": "Otis Kuhic", +// "address": "853 Kulas Highway, Port Estellbury WI 96713", +// "email": "Morton40@hotmail.com", +// "strideLength": 3.4, +// "dailyStepGoal": 11000, +// "friends": [ +// 28, +// 41, +// 24, +// 23 +// ] +// }, +// { +// "id": 13, +// "name": "Tom Schmeler", +// "address": "1524 Clemmie River, Newtonbury RI 02849-3159", +// "email": "Leopoldo.Sauer@gmail.com", +// "strideLength": 3.2, +// "dailyStepGoal": 4000, +// "friends": [ +// 33, +// 14, +// 3, +// 43, +// 35 +// ] +// }, +// { +// "id": 14, +// "name": "Gloria Frami", +// "address": "326 Littel Run, Tracemouth HI 02826-6898", +// "email": "Jadon.OConnell@hotmail.com", +// "strideLength": 3.5, +// "dailyStepGoal": 12000, +// "friends": [ +// 34, +// 22 +// ] +// }, +// { +// "id": 15, +// "name": "Ezequiel Feest", +// "address": "78801 Lauryn Plain, Lake Elinor MN 27856-9054", +// "email": "Anthony_Toy@hotmail.com", +// "strideLength": 4.4, +// "dailyStepGoal": 5000, +// "friends": [ +// 10, +// 23, +// 35, +// 20, +// 5 +// ] +// }, +// { +// "id": 16, +// "name": "Garnett Cruickshank", +// "address": "992 Zita Mall, North Tremainemouth MA 19312-3532", +// "email": "Laverna47@hotmail.com", +// "strideLength": 3.9, +// "dailyStepGoal": 10000, +// "friends": [ +// 25, +// 31, +// 3, +// 16 +// ] +// }, +// { +// "id": 17, +// "name": "Jade Walter", +// "address": "796 Rogahn Track, Lubowitzhaven NJ 62669-3244", +// "email": "Dylan_Langworth65@hotmail.com", +// "strideLength": 4.3, +// "dailyStepGoal": 5000, +// "friends": [ +// 8, +// 31, +// 40 +// ] +// }, +// { +// "id": 18, +// "name": "Dan Hodkiewicz", +// "address": "735 Johnnie Crest, New Madisyn IN 51116-6094", +// "email": "Gertrude12@gmail.com", +// "strideLength": 2.9, +// "dailyStepGoal": 2000, +// "friends": [ +// 33, +// 37 +// ] +// }, +// { +// "id": 19, +// "name": "Wilburn Collins", +// "address": "543 Keeling Road, Schummside ID 47123-6269", +// "email": "Blake27@gmail.com", +// "strideLength": 3.3, +// "dailyStepGoal": 8000, +// "friends": [ +// 30, +// 43, +// 22, +// 39 +// ] +// }, +// { +// "id": 20, +// "name": "Ora O'Connell", +// "address": "79585 Tania Ports, North Lillie MI 38947-4029", +// "email": "Audreanne.Gulgowski6@yahoo.com", +// "strideLength": 3.4, +// "dailyStepGoal": 8000, +// "friends": [ +// 2, +// 12, +// 11, +// 33 +// ] +// }, +// { +// "id": 21, +// "name": "Alexandrea Wehner", +// "address": "314 Richmond Islands, Brekkefort WI 71702-6994", +// "email": "Americo_Hammes31@gmail.com", +// "strideLength": 3, +// "dailyStepGoal": 9000, +// "friends": [ +// 29, +// 19 +// ] +// }, +// { +// "id": 22, +// "name": "Maria Kemmer", +// "address": "3416 Zoey Cliff, West Eda PA 17789-2282", +// "email": "Nya25@yahoo.com", +// "strideLength": 4.2, +// "dailyStepGoal": 2000, +// "friends": [ +// 40, +// 44, +// 14 +// ] +// }, +// { +// "id": 23, +// "name": "Karli Rodriguez", +// "address": "52618 Conroy Burgs, Wiegandhaven NC 32787", +// "email": "Marge.Farrell25@yahoo.com", +// "strideLength": 3.2, +// "dailyStepGoal": 7000, +// "friends": [ +// 28, +// 31, +// 14 +// ] +// }, +// { +// "id": 24, +// "name": "Kristin Cruickshank", +// "address": "806 Raynor Port, Kilbackbury OK 11077", +// "email": "Waylon_Zulauf@hotmail.com", +// "strideLength": 3.3, +// "dailyStepGoal": 4000, +// "friends": [ +// 17, +// 16, +// 45, +// 12 +// ] +// }, +// { +// "id": 25, +// "name": "Isobel Schmeler", +// "address": "5592 Donnelly Trail, Scottieport SC 35511", +// "email": "Name79@yahoo.com", +// "strideLength": 3.3, +// "dailyStepGoal": 4000, +// "friends": [ +// 37, +// 31, +// 43 +// ] +// }, +// { +// "id": 26, +// "name": "Greta Corkery", +// "address": "99020 Botsford Knoll, Lake Cecil ID 44141", +// "email": "Virgil28@hotmail.com", +// "strideLength": 3, +// "dailyStepGoal": 12000, +// "friends": [ +// 10, +// 34, +// 8, +// 43 +// ] +// }, +// { +// "id": 27, +// "name": "Johnathan Schulist", +// "address": "868 Kathryn Pike, Gibsonport ME 79500-6839", +// "email": "Mayra49@yahoo.com", +// "strideLength": 3, +// "dailyStepGoal": 10000, +// "friends": [ +// 17, +// 46, +// 40, +// 44 +// ] +// }, +// { +// "id": 28, +// "name": "Noemi Huels", +// "address": "5437 Barton Oval, Caesarview RI 88637", +// "email": "Geovany.Jaskolski@hotmail.com", +// "strideLength": 3.3, +// "dailyStepGoal": 2000, +// "friends": [ +// 18, +// 16, +// 47 +// ] +// }, +// { +// "id": 29, +// "name": "Colten Trantow", +// "address": "2625 Waino Skyway, Kaceybury ME 18723", +// "email": "Demetris67@hotmail.com", +// "strideLength": 4.2, +// "dailyStepGoal": 9000, +// "friends": [ +// 9, +// 5, +// 41 +// ] +// }, +// { +// "id": 30, +// "name": "Deborah Keebler", +// "address": "039 Jerde Brook, South Helen TN 08907-6883", +// "email": "Colt_Hermann59@gmail.com", +// "strideLength": 3.7, +// "dailyStepGoal": 9000, +// "friends": [ +// 13, +// 36, +// 2, +// 26, +// 28 +// ] +// }, +// { +// "id": 31, +// "name": "Bertrand Yundt", +// "address": "0032 Claudia Plain, Delfinaland RI 22298-3685", +// "email": "Sibyl.Schmidt39@yahoo.com", +// "strideLength": 3.4, +// "dailyStepGoal": 7000, +// "friends": [ +// 16, +// 41, +// 9 +// ] +// }, +// { +// "id": 32, +// "name": "Carrie Smith", +// "address": "408 Windler Camp, Eddietown MA 11960", +// "email": "Nikolas.Brakus31@yahoo.com", +// "strideLength": 4.3, +// "dailyStepGoal": 3000, +// "friends": [ +// 47, +// 33 +// ] +// }, +// { +// "id": 33, +// "name": "Leilani Quitzon", +// "address": "60013 Golden Overpass, Lake Dejon WI 77309-0820", +// "email": "Trinity_Rowe@hotmail.com", +// "strideLength": 3.5, +// "dailyStepGoal": 8000, +// "friends": [ +// 4, +// 18, +// 36, +// 30 +// ] +// }, +// { +// "id": 34, +// "name": "Lindsay Ruecker", +// "address": "026 Koelpin Fall, Port Demarcus HI 76813-9743", +// "email": "Art44@gmail.com", +// "strideLength": 2.5, +// "dailyStepGoal": 11000, +// "friends": [ +// 47, +// 19, +// 10 +// ] +// }, +// { +// "id": 35, +// "name": "Nico Bechtelar", +// "address": "83360 Christelle Ports, North Elliot IA 75496", +// "email": "Eric_Aufderhar@yahoo.com", +// "strideLength": 3.3, +// "dailyStepGoal": 8000, +// "friends": [ +// 39, +// 23, +// 36 +// ] +// }, +// { +// "id": 36, +// "name": "Clay Pfannerstill", +// "address": "40262 Hauck Creek, Halvorsonfurt AL 81358-9303", +// "email": "Zander21@gmail.com", +// "strideLength": 3.7, +// "dailyStepGoal": 8000, +// "friends": [ +// 40, +// 11, +// 14, +// 29 +// ] +// }, +// { +// "id": 37, +// "name": "Erling Anderson", +// "address": "772 Hamill Avenue, Mortonport ID 38546-4861", +// "email": "Aisha6@gmail.com", +// "strideLength": 3.4, +// "dailyStepGoal": 4000, +// "friends": [ +// 44, +// 19, +// 16 +// ] +// }, +// { +// "id": 38, +// "name": "Kaitlyn Weber", +// "address": "9440 Sincere Turnpike, New Shanon MN 11526-5774", +// "email": "Dustin48@yahoo.com", +// "strideLength": 3.6, +// "dailyStepGoal": 10000, +// "friends": [ +// 5, +// 21, +// 37 +// ] +// }, +// { +// "id": 39, +// "name": "Kenyatta Boyle", +// "address": "80711 Beer Lakes, Nicolatown WA 89298", +// "email": "Bailey_Abbott@yahoo.com", +// "strideLength": 3.7, +// "dailyStepGoal": 8000, +// "friends": [ +// 43, +// 10, +// 17 +// ] +// }, +// { +// "id": 40, +// "name": "Esperanza Schumm", +// "address": "5719 Hal Fork, Frederikstad SC 23125", +// "email": "Otis_Beahan@yahoo.com", +// "strideLength": 3.5, +// "dailyStepGoal": 6000, +// "friends": [ +// 29, +// 28, +// 3 +// ] +// }, +// { +// "id": 41, +// "name": "Meta Leffler", +// "address": "51598 Sauer Plaza, Port Vicente WY 87161-8441", +// "email": "Brice.Greenholt9@hotmail.com", +// "strideLength": 2.8, +// "dailyStepGoal": 2000, +// "friends": [ +// 6, +// 45, +// 31 +// ] +// }, +// { +// "id": 42, +// "name": "Ernestine Heathcote", +// "address": "9160 Blanche Ford, Dawnmouth OH 11816-1604", +// "email": "Brandyn_Quitzon@hotmail.com", +// "strideLength": 4.5, +// "dailyStepGoal": 9000, +// "friends": [ +// 20, +// 25, +// 22 +// ] +// }, +// { +// "id": 43, +// "name": "Alfonso Sporer", +// "address": "584 Mayert Greens, West Arden SC 97033", +// "email": "Jadon_Borer@gmail.com", +// "strideLength": 4, +// "dailyStepGoal": 5000, +// "friends": [ +// 2, +// 19, +// 43, +// 33 +// ] +// }, +// { +// "id": 44, +// "name": "Cora Rice", +// "address": "32723 Brekke Burg, West Randallburgh DE 20889", +// "email": "Coralie80@yahoo.com", +// "strideLength": 3.1, +// "dailyStepGoal": 8000, +// "friends": [ +// 25, +// 37, +// 42, +// 27 +// ] +// }, +// { +// "id": 45, +// "name": "Jennie O'Hara", +// "address": "492 Stracke Mews, East Jazlyn OH 58002-5475", +// "email": "Elenor.Block12@yahoo.com", +// "strideLength": 4.4, +// "dailyStepGoal": 7000, +// "friends": [ +// 35, +// 39, +// 31, +// 25, +// 33 +// ] +// }, +// { +// "id": 46, +// "name": "Vincenzo Hayes", +// "address": "03146 Bella Ferry, Port Royceberg NE 64057-4380", +// "email": "Carlo.Walker@hotmail.com", +// "strideLength": 3.6, +// "dailyStepGoal": 4000, +// "friends": [ +// 10, +// 29, +// 44 +// ] +// }, +// { +// "id": 47, +// "name": "Jevon Koss", +// "address": "983 Charlotte Island, Schroederchester ME 39894-0208", +// "email": "Kasandra_Bashirian@gmail.com", +// "strideLength": 4.3, +// "dailyStepGoal": 10000, +// "friends": [ +// 11, +// 48, +// 27, +// 4 +// ] +// }, +// { +// "id": 48, +// "name": "Jasper Stracke", +// "address": "9119 Ziemann Road, Coltberg IA 56671", +// "email": "Domenica.Kovacek17@yahoo.com", +// "strideLength": 3.6, +// "dailyStepGoal": 7000, +// "friends": [ +// 9, +// 7, +// 30 +// ] +// }, +// { +// "id": 49, +// "name": "Herbert Douglas", +// "address": "460 Boyd Viaduct, Florianburgh NM 04038-3499", +// "email": "Douglas_Swift99@hotmail.com", +// "strideLength": 3.8, +// "dailyStepGoal": 4000, +// "friends": [ +// 29, +// 15, +// 32, +// 37, +// 31 +// ] +// }, +// { +// "id": 50, +// "name": "Jordon Lind", +// "address": "3866 Jay Loaf, New Felix OR 96784-0274", +// "email": "Dane76@hotmail.com", +// "strideLength": 4.4, +// "dailyStepGoal": 2000, +// "friends": [ +// 9, +// 27, +// 21, +// 13 +// ] +// } +// ]; +// export default userData;np \ No newline at end of file diff --git a/src/scripts.js b/src/scripts.js index 06bae3d5d1..c5875c9642 100644 --- a/src/scripts.js +++ b/src/scripts.js @@ -1,17 +1,111 @@ -// This is the JavaScript entry file - your code begins here -// Do not delete or rename this file ******** - -console.log(userData,"<>>>>userData") -// An example of how you tell webpack to use a CSS file import './css/styles.css'; +import { getAPIData } from './apiCalls'; +import User from '../src/User'; +import UserRepository from './UserRepository'; +import loadCharts from './charts'; -// An example of how you tell webpack to use an image (also need to link to it in the index.html) -import './images/turing-logo.png' +// Global Variables +let users; +let sleep; +let hydration; +let currentUser; -console.log('This is the JavaScript entry file - your code begins here.'); +//Query Selectors +let activityTrackerTitle = document.querySelector('h1'); +let userInfoList = document.querySelector("#userInfoList"); -// An example of how you tell webpack to use a JS file +// Event Listeners +window.addEventListener('load', getAllData); -import userData from './data/users'; +//Event Handlers +function getAllData() { + Promise.all([getAPIData('users'), getAPIData('sleep'), getAPIData('hydration')]) + .then((data) => { + users = new UserRepository(data[0]); + sleep = data[1]; + hydration = data[2]; + loadPage(); + }) + .catch(err => console.log('To err is human', err)) +} -import UserRepository from './UserRepository'; +function displayUserInfo() { + userInfoList.innerHTML += `
  • ${currentUser.userData.name}
  • +
  • ${currentUser.userData.address}
  • +
  • ${currentUser.userData.email}
  • +
  • Stride Length: ${currentUser.userData.strideLength}
  • +
  • Daily Step Goal: ${currentUser.userData.dailyStepGoal}
  • +
  • Friends: ${getUserFriends()}
  • ` +} + +function displayWelcomeName() { + activityTrackerTitle.innerText += ` ${currentUser.getFirstName()}`; +} + +function displayStepGoal() { + return [currentUser.userData.dailyStepGoal, (users.stepGoalAverage() - currentUser.userData.dailyStepGoal)]; +} + +// Functions +function getUser(sleep, hydration) { + let randomIndex = Math.floor(Math.random() * users.data.userData.length); + let randomUser = users.data.userData[randomIndex]; + currentUser = new User(randomUser, sleep, hydration); +} + +function getUserFriends() { + return currentUser.userData.friends + .map(friend => users.getData(friend).name) + .join(', ') +} + +function displayWater() { + let dailyWaterIntake = currentUser.getWaterPerDay('2019/06/15'); + return [dailyWaterIntake, 96 - dailyWaterIntake]; +} + +function displaySleep() { + let dailySleep = currentUser.sleepOnSpecificDate('2019/06/15'); + return [dailySleep, 12 - dailySleep]; +} + +function displaySleepQuality() { + let dailyQuality = currentUser.sleepQualityOnSpecificDate('2019/06/15'); + return [dailyQuality, 5 - dailyQuality]; +} + +function displayLast7DaysSleep() { + return currentUser + .givenWeekSleepDataByDay() + .map(current => Object.values(current)[0]) +} + +function displayLast7DaysQuality() { + return currentUser + .givenWeeksSleepQualityByDay() + .map(current => Object.values(current)[0]) +} + +function displayLast7DaysHydration() { + return currentUser + .getWeeklyConsumption() + .map(current => Object.values(current)[0]) +} + +function displayAllTimeSleepData() { + return [currentUser.getOverallQualityAvg(), currentUser.getAverageDailySleep()]; +} + +function loadPage() { + getUser(sleep, hydration); + displayUserInfo(); + displayWelcomeName(); + loadCharts(displayStepGoal(), + displayWater(), + displaySleep(), + displaySleepQuality(), + displayLast7DaysSleep(), + displayLast7DaysQuality(), + displayLast7DaysHydration(), + displayAllTimeSleepData()); +} \ No newline at end of file diff --git a/test/Sleep-test.js b/test/Sleep-test.js new file mode 100644 index 0000000000..bdc906e936 --- /dev/null +++ b/test/Sleep-test.js @@ -0,0 +1,63 @@ +import { expect } from 'chai'; +import userData from '../src/data/users' +import User from '../src/User' +import Sleep from '../src/Sleep' +// import {getAPIData} from './apiCalls' + +describe('User', () => { + let user1, user2, user3 + beforeEach(() => { + user1 = new User({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }) + user2 = new User({ + "id": 2, + "name": "Jarvis Considine", + "address": "30086 Kathryn Port, Ciceroland NE 07273", + "email": "Dimitri.Bechtelar11@gmail.com", + "strideLength": 4.5, + "dailyStepGoal": 5000, + "friends": [ + 9, + 18, + 24, + 19 + ] + }) + user3 = new User({ + "id": 3, + "name": "Herminia Witting", + "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", + "email": "Elwin.Tromp@yahoo.com", + "strideLength": 4.4, + "dailyStepGoal": 5000, + "friends": [ + 19, + 11, + 42, + 33 + ] + }) + }) + + it('should be a function', function () { + + expect(Sleep).to.be.a('function'); + }); + + it('should instantiate a new User', function () { + + expect(Sleep).to.be.a('function'); + }) + + }) \ No newline at end of file diff --git a/test/User-test.js b/test/User-test.js new file mode 100644 index 0000000000..9e431c2e7e --- /dev/null +++ b/test/User-test.js @@ -0,0 +1,346 @@ +import { expect } from 'chai'; +import User from '../src/User' + +describe('User', () => { + let user1, user2, user3, hydrationData, sleepData + beforeEach(() => { + hydrationData = { + hydrationData: [ + { + userID: 1, + date: "2019/06/15", + numOunces: 37 + }, + { + userID: 2, + date: "2019/06/15", + numOunces: 75 + }, + { + userID: 3, + date: "2019/06/15", + numOunces: 47 + }, + { + userID: 1, + date: "2019/06/16", + numOunces: 85 + }, + { + userID: 2, + date: "2019/06/16", + numOunces: 42 + }, + { + userID: 2, + date: "2019/06/17", + numOunces: 19 + }, + { + userID: 2, + date: "2019/06/18", + numOunces: 42 + }, + { + userID: 2, + date: "2019/06/19", + numOunces: 42 + }, + { + userID: 2, + date: "2019/06/20", + numOunces: 33 + }, + { + userID: 2, + date: "2019/06/21", + numOunces: 51 + }, + { + userID: 2, + date: "2019/06/22", + numOunces: 87 + }, + { + userID: 2, + date: "2019/06/23", + numOunces: 23 + } + ] + } + sleepData = { + sleepData: [{ + userID: 1, + date: "2019/06/15", + hoursSlept: 6.1, + sleepQuality: 2.2 + }, + { + userID: 2, + date: "2019/06/15", + hoursSlept: 7, + sleepQuality: 4.7 + }, + { + userID: 3, + date: "2019/06/15", + hoursSlept: 10.8, + sleepQuality: 4.7 + }, + { + userID: 1, + date: "2019/06/16", + hoursSlept: 5.4, + sleepQuality: 3 + }, + { + userID: 2, + date: "2019/06/16", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/17", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/18", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/19", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/20", + hoursSlept: 6.5, + sleepQuality: 1.1 + }, + { + userID: 2, + date: "2019/06/21", + hoursSlept: 4.1, + sleepQuality: 3.6 + }, + { + userID: 2, + date: "2019/06/22", + hoursSlept: 3.9, + sleepQuality: 5.4 + } + + ] + } + user1 = new User({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }, sleepData, hydrationData) + user2 = new User({ + "id": 2, + "name": "Jarvis Considine", + "address": "30086 Kathryn Port, Ciceroland NE 07273", + "email": "Dimitri.Bechtelar11@gmail.com", + "strideLength": 4.5, + "dailyStepGoal": 5000, + "friends": [ + 9, + 18, + 24, + 19 + ] + }, sleepData, hydrationData) + user3 = new User({ + "id": 3, + "name": "Herminia Witting", + "address": "85823 Bosco Fork, East Oscarstad MI 85126-5660", + "email": "Elwin.Tromp@yahoo.com", + "strideLength": 4.4, + "dailyStepGoal": 5000, + "friends": [ + 19, + 11, + 42, + 33 + ] + }, sleepData, hydrationData) + }) + + it('should be a function', function () { + + expect(User).to.be.a('function'); + }); + + it('should instantiate a new User', function () { + + expect(User).to.be.a('function'); + }) + + it('should have a Userdata parameter', function () { + + expect(user1.userData).to.deep.equal({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }); + }) + + it('should have an id', function () { + + expect(user1.userData.id).to.equal(1); + }) + + it('should have a name', function () { + + expect(user1.userData.name).to.equal("Luisa Hane"); + }) + + it('should have an address', function () { + + expect(user1.userData.address).to.equal("15195 Nakia Tunnel, Erdmanport VA 19901-1697"); + }) + + it('should have an email', function () { + + expect(user1.userData.email).to.equal("Diana.Hayes1@hotmail.com"); + }) + + it('should have a strideLength', function () { + + expect(user1.userData.strideLength).to.equal(4.3); + }) + + it('should have a step goal', function () { + + expect(user1.userData.dailyStepGoal).to.equal(10000); + }) + + it('should have friends', function () { + + expect(user1.userData.friends).to.deep.equal([16, 4, 8]); + }) + + it('should have a Userdata parameter', function () { + + expect(user1.userData).to.deep.equal({ + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }) + }); + + it('should return users first name', function () { + + expect(user1.getFirstName()).to.equal("Luisa"); + }) + + //Hydration + it('should output the average fluid ounces of water consumed daily', function () { + + expect(user1.getAvgDailyWater(1)).to.equal(61); + }) + + it('should identify how many ounces of water a user consumed on a specific day', function () { + + expect(user2.getWaterPerDay("2019/06/15")).to.equal(75); + expect(user3.getWaterPerDay("2019/06/15")).to.equal(47); + }) + + it('should calculate average ounces consumed daily over the course of one week', function () { + + expect(user2.getWeeklyConsumption()).to.deep.equal([ + { userID: 2, date: '2019/06/17', numOunces: 19 }, + { userID: 2, date: '2019/06/18', numOunces: 42 }, + { userID: 2, date: '2019/06/19', numOunces: 42 }, + { userID: 2, date: '2019/06/20', numOunces: 33 }, + { userID: 2, date: '2019/06/21', numOunces: 51 }, + { userID: 2, date: '2019/06/22', numOunces: 87 }, + { userID: 2, date: '2019/06/23', numOunces: 23 } + ]) + }) + + //Sleep + it('should return a users average number of hours of sleep per day', function () { + + expect(user1.getAverageDailySleep()).to.equal(5.75) + }) + + it('Should return a users average sleep quality', function () { + + expect(user1.getOverallQualityAvg()).to.equal(2.6) + }) + + it('Should give hours slept on a specific date', function () { + + expect(user2.sleepOnSpecificDate("2019/06/15")).to.equal(7); + expect(user3.sleepOnSpecificDate("2019/06/15")).to.equal(10.8) + }) + + it('Should provide users sleep quality on specific date', function () { + + expect(user2.sleepQualityOnSPecificDate("2019/06/15")).to.equal(4.7) + expect(user1.sleepQualityOnSPecificDate("2019/06/16")).to.equal(3) + }) + + it('Should provide daily sleep data for any given week', function () { + + expect(user2.givenWeekSleepDataByDay()).to.deep.equal([ + { '2019/06/16': 4.1 }, + { '2019/06/17': 4.1 }, + { '2019/06/18': 4.1 }, + { '2019/06/19': 4.1 }, + { '2019/06/20': 6.5 }, + { '2019/06/21': 4.1 }, + { '2019/06/22': 3.9 } + ]) + }) + + it('Should provide daily sleep quality for any given week', function () { + + expect(user2.givenWeeksSleepQualityByDay()).to.deep.equal([ + { '2019/06/16': 3.6 }, + { '2019/06/17': 3.6 }, + { '2019/06/18': 3.6 }, + { '2019/06/19': 3.6 }, + { '2019/06/20': 1.1 }, + { '2019/06/21': 3.6 }, + { '2019/06/22': 5.4 } + ]) + }) + + it('Should average overall sleep quality for all users', function () { + + expect(user1.averageSleepQuality()).to.equal(3.55) + }) +}) \ No newline at end of file diff --git a/test/UserRepository-test.js b/test/UserRepository-test.js index 5ae11729ad..1eff6eefea 100644 --- a/test/UserRepository-test.js +++ b/test/UserRepository-test.js @@ -1,8 +1,110 @@ import { expect } from 'chai'; +import User from '../src/User'; import UserRepository from '../src/UserRepository'; -describe('User Repository', () => { +describe('UserRepository', () => { + let userRepository, users; + + beforeEach(() => { + + users = { + userData: [ + { + id: 1, + name: "Luisa Hane", + address: "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + email: "Diana.Hayes1@hotmail.com", + strideLength: 4.3, + dailyStepGoal: 10000, + friends: [ + 16, + 4, + 8 + ] + }, + { + id: 2, + name: "Jarvis Considine", + address: "30086 Kathryn Port, Ciceroland NE 07273", + email: "Dimitri.Bechtelar11@gmail.com", + strideLength: 4.5, + dailyStepGoal: 5000, + friends: [ + 9, + 18, + 24, + 19 + ] + }, + { + id: 3, + name: "Herminia Witting", + address: "85823 Bosco Fork, East Oscarstad MI 85126-5660", + email: "Elwin.Tromp@yahoo.com", + strideLength: 4.4, + dailyStepGoal: 5000, + friends: [ + 19, + 11, + 42, + 33 + ] + }] + } + + userRepository = new UserRepository(users) + }) + it('should be a function', function () { + expect(UserRepository).to.be.a('function'); }); + + it('should instantiate a new user repository', function () { + + expect(userRepository.data).to.deep.equal(users); + }) + + it('should take in user data', function () { + + expect(userRepository.data.userData[0]).to.deep.equal( + { + "id": 1, + "name": "Luisa Hane", + "address": "15195 Nakia Tunnel, Erdmanport VA 19901-1697", + "email": "Diana.Hayes1@hotmail.com", + "strideLength": 4.3, + "dailyStepGoal": 10000, + "friends": [ + 16, + 4, + 8 + ] + }) + + }) + + it('should supply user data when given id', function () { + + expect(userRepository.getData(userRepository.data.userData[1].id)).to.deep.equal({ + id: 2, + name: "Jarvis Considine", + address: "30086 Kathryn Port, Ciceroland NE 07273", + email: "Dimitri.Bechtelar11@gmail.com", + strideLength: 4.5, + dailyStepGoal: 5000, + friends: [ + 9, + 18, + 24, + 19 + ] + }) + + }) + + it('should give the average step goal of all users', function () { + + expect(userRepository.stepGoalAverage()).to.equal(6666) + }) }); \ No newline at end of file