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

preliminary tests for user data and average step goals. Wireframe HTM… #419

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 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
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
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')
/******/
})()
;
92 changes: 87 additions & 5 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,96 @@
<!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="section3">
<div></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>name</h3>
<p id="account-name"></p>
<h3>address</h3>
<p id="account-address"></p>
<h3>email</h3>
<p id="account-email"></p>
<h3>stride length</h3>
<p id="account-stride"></p>
<h3>daily step goal</h3>
<p id="account-step"></p>
<h3>friends</h3>
<p id="account-friends"></p>
</div>
</section>
</main>
<!-- Do not include the scripts.js file here - it is done automatically by the webpack server -->
<script src="bundle.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<script>
var xValues = ["Your Step Goal", "Average Step Goal"];
var yValues = [11000, 6000];
var barColors = [
"#1a1a1a",
"#1a1a1a",
];

new Chart("stepChart", {
type: "horizontalBar",
data: {
labels: xValues,
datasets: [{
backgroundColor: barColors,
data: yValues
}]
},
options: {
scales: {
xAxes: [{
ticks: {min: 0, max:12000,
fontSize: 20},
}],
yAxes: [{
gridLines: {
display: false
},
barThickness: 25,
barPercentage: 1,
categoryPercentage: 1,
ticks: {fontSize: 20}
}],
},
legend: {display: false},
title: {
display: true,
}
}
});
</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"
}
}
93 changes: 90 additions & 3 deletions src/css/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,92 @@
* {
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.jpg') repeat-x top, url('../images/white-texture-invert.jpg') repeat-x bottom;
background-size: 25% 50%, 25% 50%;
}
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;
flex-direction: column;
justify-content: flex-start;
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