Skip to content

Commit defbfcd

Browse files
author
Derek Roode
committed
total workout mobile
1 parent 5be966c commit defbfcd

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

react-app/src/components/Atoms/Rank/Rank.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import React, { useState, useEffect } from "react";
22
import { useSelector, useDispatch } from "react-redux";
3+
import { allWorkoutsComplete } from "../../../store/ranking";
34
import styles from './Rank.module.css'
45

56
function Rank() {
7+
const dispatch = useDispatch();
68
const sessionUser = useSelector((state) => state.session.user);
79
const allWorkoutsCompleted = useSelector((state) =>
810
Object.values(state.ranking)
911
);
1012

13+
useEffect(() => {
14+
dispatch(allWorkoutsComplete())
15+
}, [dispatch, sessionUser]);
16+
1117
//get overall rank
1218
const overallRank = () => {
1319
let place = 0;

react-app/src/components/Atoms/TotalWorkouts/TotalWorkouts.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
import React, { useState, useEffect } from "react";
22
import { useSelector, useDispatch } from "react-redux";
3+
import { userWorkouts } from "../../../store/userWorkouts";
4+
5+
6+
37
import styles from './TotalWorkouts.module.css'
48

59
function TotalWorkouts() {
10+
const dispatch = useDispatch();
611
const userWorkout = useSelector((state) => Object.values(state.userWorkouts));
712

813

14+
useEffect(()=>{
15+
dispatch(userWorkouts())
16+
},[dispatch])
917
//get workouts completed
1018
const workoutData = () => {
1119
let num = 0;

react-app/src/components/Atoms/UserProfilePhotoBlock/UserProfilePhotoBlock.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ function UserProfilePhotoBlock({profilePhoto, userName}) {
1717

1818
<li><UserStats/></li>
1919
<li><TotalWorkouts/></li>
20-
<li><TotalWorkouts/></li>
21-
<li><TotalWorkouts/></li>
20+
2221

2322
</ul>
2423
</div>

react-app/src/components/Atoms/UserProfilePhotoBlock/UserProfilePhotoBlock.module.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
.UserProfilePhotoBlock_container__mobile_block {
5151
display: flex;
5252
flex-direction: column;
53-
background-color: green;
5453
padding-top: 1.2em;
5554
}
5655
.UserProfilePhotoBlock_container__mobile_block ul {
@@ -61,7 +60,6 @@
6160
padding: 0;
6261
margin: 0;
6362
color: #fff;
64-
background-color: red;
6563
}
6664

6765
.UserProfilePhotoBlock_container__mobile_block ul li {

react-app/src/components/Organisms/UserDataBlock/UserDataBlock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function UserDataBlock() {
1212

1313

1414
<UserProfilePhotoBlock profilePhoto={sessionUser.profile_photo} userName={sessionUser.user_name}/>
15-
{/* <UserStats/> */}
15+
1616

1717

1818
</div>

react-app/src/components/Organisms/UserDataBlock/UserDataBlock.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
width: 100%;
77
height: 100%;
88
padding: 0px;
9-
background-color: red;
109

1110

1211
}

0 commit comments

Comments
 (0)