Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/tc it2 #423

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5ad0e4b
preliminary tests for user data and average step goals. Wireframe HTM…
tconey23 Feb 5, 2024
096b47b
Merge pull request #1 from edwin-chalmers/feat/toms_branch
edwin-chalmers Feb 5, 2024
dc4f90a
First run of connecting webpack to HTML
tconey23 Feb 6, 2024
bdf0543
Merge pull request #2 from edwin-chalmers/feat/toms_branch
edwin-chalmers Feb 6, 2024
581bfd3
bug fixes
edwin-chalmers Feb 6, 2024
0effc84
Merge pull request #3 from edwin-chalmers/ed/bugs
edwin-chalmers Feb 6, 2024
ac4c824
refactor code and restructure files
Virulencies Feb 6, 2024
8dda76f
Merge branch 'main' into bugfix/refactor-and-restructure
edwin-chalmers Feb 6, 2024
304ad2d
Merge pull request #4 from edwin-chalmers/bugfix/refactor-and-restruc…
edwin-chalmers Feb 6, 2024
b68c825
bug fixes
edwin-chalmers Feb 6, 2024
33d9761
Merge pull request #5 from edwin-chalmers/ed/bugs
edwin-chalmers Feb 6, 2024
1084c18
add css styling and paper texture
edwin-chalmers Feb 6, 2024
b043fe0
Merge pull request #6 from edwin-chalmers/ed/it1
tconey23 Feb 6, 2024
26dfd01
Add step goals with displayStepGoal() and compareStepGoalToAverage()
edwin-chalmers Feb 7, 2024
eec7c62
Merge pull request #7 from edwin-chalmers/ed/it1
tconey23 Feb 7, 2024
7996a83
added respetive functions to display user info
edwin-chalmers Feb 7, 2024
ad111fa
Merge pull request #8 from edwin-chalmers/ed/it1
Virulencies Feb 7, 2024
e171bae
slight CSS adjustments
edwin-chalmers Feb 7, 2024
11bce7f
Merge pull request #9 from edwin-chalmers/ed/it1
Virulencies Feb 7, 2024
931e8a9
Improved background image CSS and added dynamic updates to the stepCh…
tconey23 Feb 7, 2024
0492a11
Add files with some respective tests for domUpdates and scriptes
edwin-chalmers Feb 7, 2024
c10f608
Fixed merge conflicts, installed charts.js, updated CSS and other for…
tconey23 Feb 7, 2024
12faa4f
Merge branch 'main' into feat/toms_branch
tconey23 Feb 7, 2024
01911ce
Fixed merge conflicts
tconey23 Feb 7, 2024
4157242
Merge pull request #10 from edwin-chalmers/ed/tests
Virulencies Feb 7, 2024
c971294
Merge pull request #11 from edwin-chalmers/feat/toms_branch
Virulencies Feb 7, 2024
8c7ff1b
Add average hydration function
Virulencies Feb 8, 2024
8ed3df6
Add hydration functions
Virulencies Feb 8, 2024
f00ff4a
Merge pull request #12 from edwin-chalmers/feat/hydration-functions
Virulencies Feb 8, 2024
7f293c6
resolved merge conflicts
tconey23 Feb 8, 2024
35352ad
added new CSS and moved chart set up to its own file
tconey23 Feb 8, 2024
e03ca4b
updated background image and chart setup file.
tconey23 Feb 8, 2024
7536ad8
Merge pull request #19 from edwin-chalmers/feat/tc_it2
edwin-chalmers Feb 8, 2024
b10abdd
Adjusted code for hydration data
tconey23 Feb 9, 2024
5b51b37
Merge pull request #20 from edwin-chalmers/feat/tc_it2
Virulencies Feb 9, 2024
a99eff7
Fix hydration logic and set up dom interaction
Virulencies Feb 9, 2024
5d498cf
Merge branch 'main' into feat/hydration-DOM-interactions
Virulencies Feb 9, 2024
fbb1993
Merge pull request #21 from edwin-chalmers/feat/hydration-DOM-interac…
tconey23 Feb 9, 2024
f5a67e0
installed chart.js
tconey23 Feb 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/bundle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******/ (() => { // webpackBootstrap
var __webpack_exports__ = {};
alert('hello')
// alert('hello')
/******/
})()
;
60 changes: 56 additions & 4 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="UTF-8">
<title>Fitlit</title>
</head>
<body>
<h1>Activity Tracker</h1>
<img src="./images/turing-logo.png" alt="turing logo" height="100px" width="100px">
<nav>
<a class="home-button" href="#top">Home</a>
<a class="steps-button" href="#section2">Steps</a>
<a class="water-button" href="#section3">Water</a>
<a class="sleep-button" href="#section4">Sleep</a>
<a class="account-button" href="#section5">Account</a>
</nav>
<main id="top">
<article>
<img src="./images/fitlit-logo.png">
<h1 class="welcome-message" id="welcomeMessage">welcome back (person.name)</h1>
</article>
<section class="steps-main info-card" id="section2">
<div class="section-text">
<h3>Your daily step goal: </h3>
<p class="user-step">xx,xxx</p>
<h3>The average daily step goal is: </h3>
<p class="average-step">x,xxx</p>
<canvas id="stepChart" style="width:100%;max-width:700px"></canvas>
</div>
</section>
<section class="water-main info-card" id="waterCard">
<h2>Hydration Info</h2>
<div>
<h3>Average Daily Hydration:</h3>
<p id="averageDailyOunces">0 oz</p>
</div>
<div>
<label for="specificDayInput">Hydration for a specific day:</label>
<input type="date" id="specificDayInput">
<p id="specificDayOunces">0 oz</p>
</div>
<div>
<label for="weeklyStartDayInput">Start date for weekly hydration:</label>
<input type="date" id="weeklyStartDayInput">
<ul id="weeklyOuncesList">
<!-- list items dynamically added here -->
</ul>

</div>
</section>
<section class="sleep-main info-card" id="section4">
<div></div>
</section>
<section class="account-main info-card" id="section5">
<div class="section-text">
<h3 id="account-name">name</h3>
<h3 id="account-address">address</h3>
<h3 id="account-email">email</h3>
<h3 id="account-stride">stride length</h3>
<h3 id="account-step">daily step goal</h3>
<h3 id="account-friends">friends</h3>
</div>
</section>
</main>
<!-- Do not include the scripts.js file here - it is done automatically by the webpack server -->
<script src="bundle.js"></script>
</body>
</html>
</html>
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
"webpack": "^5.38.1",
"webpack-cli": "^4.7.0",
"webpack-dev-server": "^3.11.2"
},
"dependencies": {
"chart.js": "^4.4.1"
}
}
60 changes: 60 additions & 0 deletions src/chartSetup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { Chart, registerables } from 'chart.js/auto';
Chart.register(...registerables);

const ctx = document.getElementById('stepChart').getContext('2d');

ctx.canvas.height = 100;
ctx.canvas.width = 500;

const stepChartData = {
labels: ['Your step goal', 'Average step goal'],
datasets: [{
label: '',
data: [],
backgroundColor: [
'#1a1a1a',
'#1a1a1a',
],
borderColor: [
'#1a1a1a',
'#1a1a1a',
],
borderWidth: 1
}]
};

const options = {
indexAxis: 'y',
scales: {
x: {
beginAtZero: true,
ticks: {
color: 'black'
}
},
y: {
beginAtZero: true,
ticks: {
color: 'black'
}
}
},
plugins: {
legend: {
display: false
}
},
};

const stepChart = new Chart(ctx, {
type: 'bar',
data: stepChartData,
options: options
});

export {
ctx,
stepChartData,
options,
stepChart
}
98 changes: 95 additions & 3 deletions src/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,97 @@
* {
font-family: "Baskerville Old Face";
font-style: normal;
}
body, html {
background-image: linear-gradient(to top, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
background-repeat: no-repeat;
height: 100%;
scroll-behavior: smooth;
background: url('../images/white-texture.png') repeat-x;
background-size: 100% 100%;
}
main {
scroll-behavior: smooth;
display: flex;
flex-direction: column;
align-items: center;
}

nav {
overflow: hidden;
background:rgba(0, 0, 0, 0);
color: #1a1a1a;
position: fixed;
top: 10px;
width: 100%;
height: 2em;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}

nav a {
color: #000000;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 18px;
font-variant: unicase;
font-weight: bolder;
margin: 10px;
}

nav a:hover {
text-shadow: 0px 0px 11px rgb(0, 0, 0);
}

.info-card {
width: 75%;
height: 100vh;
padding: 6%;
margin: 10px;
display: flex;
justify-content: center;
}

.info-card div {
border: rgb(0, 0, 0) solid;
width: 75%;
height: 75%;
display: flex;
box-shadow: rgba(0, 0, 0, 0.631372549) 12px 12px 20px 4px;
overflow: hidden;
flex-direction: column;
flex-wrap: wrap;
align-content: stretch;
justify-content: space-around;
max-width: 75%;
align-items: center;
}

article {
display: flex;
flex-wrap: nowrap;
align-items: center;
flex-direction: column;
padding-top: 10em;
height: 100vh;
}

article img {
mix-blend-mode: color-burn;
}

.step-text {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

.step-text h3 {
margin-bottom: 0;
}

#stepChart {
width: 10px;
mix-blend-mode: color-burn;
}
18 changes: 18 additions & 0 deletions src/data/calendar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function createCalendar(month, day, year) {

const calendar = {
month: month,
day: day,
year: year
}

return calendar

}




module.exports = {
createCalendar
}
22 changes: 22 additions & 0 deletions src/data/load.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// const { default: users } = require("./users")
import users from "./users"
console.log("load:", users)

var randomUser = []

function generateUser(id) {
return users.users.find(user => user.id === id)
};

/* */

function getAverageStepGoal() {
const totalStepsGoal = users.users.reduce((total, user) => total + user.dailyStepGoal, 0);
let averageSteps = totalStepsGoal / users.users.length;
return averageSteps
}

module.exports = {
generateUser,
getAverageStepGoal
}
Loading