Skip to content

Commit ceb25f6

Browse files
author
Derek Roode
committed
workout video playing on mobile
1 parent 6940fc0 commit ceb25f6

File tree

12 files changed

+97
-390
lines changed

12 files changed

+97
-390
lines changed

react-app/src/App.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import ProtectedRoute from "./components/auth/ProtectedRoute";
1111
// COMPONENTS
1212
import NavBar from "./components/Organisms/NavBar/NavBar";
1313
import UsersList from "./components/UsersList";
14-
import User from "./components/User/User";
15-
// import WelcomePage from "./components/Welcome/Welcome";
1614
import Workouts from "./components/Workouts/Workouts";
1715
import Groups from "./components/Groups/Groups";
1816
import GroupsIndividual from "./components/GroupsIndividual/GroupsIndividual";
@@ -22,6 +20,7 @@ import About from "./components/About/About";
2220
import ProgressPhotoIndividual from "./components/ProgressPhotoIndividual/ProgressPhotoIndividual";
2321
import Login from "./components/Pages/Login/Login";
2422
import Main from "./components/Pages/Main/Main";
23+
import Workout from "./components/Pages/Workout/Workout";
2524

2625
function App() {
2726
const [authenticated, setAuthenticated] = useState(true);
@@ -62,17 +61,15 @@ function App() {
6261
<UsersList />
6362
</Route>
6463
<Route path="/workout" exact={true}>
65-
<Workouts />
64+
<Workout/>
6665
</Route>
6766
<Route path="/my_progress" exact={true}>
6867
<ProgressPhotos />
6968
</Route>
7069
<Route path="/my_progress/:photoId" exact={true}>
7170
<ProgressPhotoIndividual />
7271
</Route>
73-
<Route path="/users/:userId" exact={true}>
74-
<User />
75-
</Route>
72+
7673

7774
<Route path="/workout/:workoutId" exact={true}>
7875
{/* SETUP ROUTE */}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@ import styles from './LoginPageVideo.module.css'
44
function LoginPageVideo() {
55
return (
66
// if you want a video to play just uncomment out the video
7-
<div >
7+
<div className={styles.login__background_container}>
88

99
<image className={styles.login__background_Image} src={'https://www.oxfordmail.co.uk/resources/images/10763753/'}/>
10+
{/* <div className={styles.login__background_gradient}> */}
11+
1012
<video
1113
className={styles.login__background_video}
1214
src="https://boxit.s3.us-east-2.amazonaws.com/video/welcomeHeaderVideo.m4v"
1315
autoPlay
1416
loop
1517
muted
18+
1619
/>
1720
</div>
21+
// </div>
1822
)
1923
}
2024

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
12
.login__background_video{
23
position: absolute;
34
top: 0;
45
left: 50%;
5-
/* remove the item in the left positioning */
66
transform: translateX(-50%);
77
width: auto;
88
height: 100%;
99
overflow: hidden;
10-
/* background-image: url("http://cdn.shopify.com/s/files/1/2510/5836/articles/Mike_Rashid_Heavyweight_Boxer_Training_1200x1200.png?v=1610545981"); */
1110
background-size: cover;
1211
background-position: center;
1312
background-repeat: no-repeat;
1413
z-index: -1;
14+
1515
}
1616

1717
@media screen and (max-width: 768px) {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React, { useState, useEffect } from "react";
2+
3+
4+
import styles from './WorkoutVideo.module.css'
5+
6+
function WorkoutVideo({video, onEnd}) {
7+
8+
9+
return (
10+
<div className={styles.workoutVideo_container}>
11+
<video src={video} autoPlay onEnded={onEnd}/>
12+
{/* <video src={workouts[pos]?.audio_url} autoPlay onEnded={() => logWorkout(workouts[pos].id)}/> */}
13+
</div>
14+
)
15+
}
16+
17+
export default WorkoutVideo
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.workoutVideo_container{
2+
width: 100%;
3+
height: 100%;
4+
display: flex;
5+
justify-content: center;
6+
align-items: center;
7+
}
8+
9+
.workoutVideo_container video{
10+
width: auto;
11+
height: 100%;
12+
overflow: hidden;
13+
}
14+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React, { useState, useEffect } from "react";
2+
import { useSelector, useDispatch } from "react-redux";
3+
import WorkoutVideo from '../../Atoms/WorkoutVideo/WorkoutVideo'
4+
5+
import { allWorkouts } from '../../../store/workouts';
6+
7+
import styes from './WorkoutBlock.module.css'
8+
9+
function WorkoutBlock() {
10+
const workouts = useSelector((state) => state.workout);
11+
console.log('workouts',workouts);
12+
const dispatch = useDispatch();
13+
14+
15+
16+
17+
useEffect( () => {
18+
19+
dispatch(allWorkouts());
20+
21+
}, []);
22+
23+
const logWorkout = () =>{
24+
return null
25+
}
26+
27+
28+
return (
29+
<div>
30+
<WorkoutVideo video={workouts[2]?.audio_url} onEnd={logWorkout(workouts[2])}/>
31+
32+
</div>
33+
)
34+
}
35+
36+
export default WorkoutBlock

react-app/src/components/Molecules/WorkoutBlock/WorkoutBlock.module.css

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react'
2+
import WorkoutBlock from '../../Molecules/WorkoutBlock/WorkoutBlock'
3+
4+
import styles from './Workout.module.css'
5+
6+
function Workout() {
7+
return (
8+
<div>
9+
<WorkoutBlock/>
10+
</div>
11+
)
12+
}
13+
14+
export default Workout

react-app/src/components/Pages/Workout/Workout.module.css

Whitespace-only changes.

react-app/src/components/User/User.css

Lines changed: 0 additions & 171 deletions
This file was deleted.

0 commit comments

Comments
 (0)