Skip to content

Commit

Permalink
Merge pull request #50 from Official-Codaisseur-Graduate/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
apavlushina committed Dec 9, 2019
2 parents dfa333a + f9a7357 commit 2bab810
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 39 deletions.
3 changes: 1 addition & 2 deletions src/components/Calendar/Day.js
Expand Up @@ -120,7 +120,6 @@ export default function Day(props) {
<ListItemAvatar>
<Avatar>
{/* <img src={images[day.id - 1].image} alt="" /> */}
{/* <img src={images[day.day - 1].image} alt="" /> */}
{/* style={{ width: '60px' }} */}
</Avatar>
</ListItemAvatar>
Expand All @@ -129,7 +128,7 @@ export default function Day(props) {
secondary={`${firstWorkout()} & ${secondWorkout()}`}
// Workouts:
/> */}
<Typography variant="p" color="inherit">
<Typography variant="div" color="inherit">
{`Day ${day.day}, ${second}`}
<br></br>
<Route
Expand Down
2 changes: 1 addition & 1 deletion src/components/Calendar/WeekContainer.js
Expand Up @@ -131,7 +131,7 @@ const WeekContainer = props => {
<Typography>Week 1</Typography>
</ExpansionPanelSummary>
<ExpansionPanelDetails>
<Typography>
<Typography component="div">
{/* <Grid container spacing={2}> */}
<List className={classes.root}>
{week.map(day => (
Expand Down
41 changes: 21 additions & 20 deletions src/components/Video/Video.js
Expand Up @@ -18,9 +18,7 @@ import { workouts } from "../../data";
import Workout from "./Workout";

class Video extends React.Component {
state = { trophy: false,
achievement: "",
start: false };
state = { trophy: false, achievement: "", start: false };

finishWorkout = id => {
this.props.dispatch({
Expand All @@ -43,14 +41,16 @@ class Video extends React.Component {
const { classes, todaysWorkouts, workoutList } = this.props;
if (this.state.trophy) {
return <Trophy achievement={this.state.achievement} />;
} if(!this.state.start){
return <Workout
startWorkout={this.startWorkout}
title={workoutList[todaysWorkouts[0]].title}
description={workoutList[todaysWorkouts[0]].description}
/>
}
else {
if (!this.state.start) {
return (
<Workout
startWorkout={this.startWorkout}
title={workoutList[todaysWorkouts[0]].title}
description={workoutList[todaysWorkouts[0]].description}
/>
);
} else {
return (
<Container component="main" maxWidth="xs">
<CssBaseline />
Expand All @@ -61,17 +61,18 @@ class Video extends React.Component {
autoPlay
src={workoutList[todaysWorkouts[0]].videoUrl}
/>
{/* <Typography className={classes.title} component="p">
<Typography
className={classes.title}
component="h1"
variant="h5"
color="primary"
>
{workouts[this.props.workouts[0]].title}
</Typography>
<Typography className={classes.title} component="div">
<Typography
className={classes.title}
component="h1"
variant="h5"
color="primary"
>
{workouts[this.props.workouts[0]].title}
</Typography>
{workouts[this.props.workouts[0]].description}
</Typography> */}
</Typography>{" "}
*/}
<Grid container spacing={3}>
<Grid item xs={4}>
<Paper className={classes.grid}>
Expand Down
5 changes: 1 addition & 4 deletions src/components/Video/Workout.js
@@ -1,10 +1,7 @@
import React from "react";
import {
Button,
CssBaseline,
Paper,
Grid,
Box,
Typography, Container
} from "@material-ui/core";
import { makeStyles } from '@material-ui/core/styles';
Expand Down Expand Up @@ -103,7 +100,7 @@ export default function Workout(props) {
>
{title} workout
</Typography>
<Typography>
<Typography component="div">
{description}
</Typography>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/components/Video/styles.js
@@ -1,4 +1,3 @@
import { textAlign } from "@material-ui/system";

export default theme => ({
paper: {
Expand Down
3 changes: 0 additions & 3 deletions src/components/login/Login.js
Expand Up @@ -2,8 +2,6 @@ import React, { Component } from "react";
import Button from "@material-ui/core/Button";
import CssBaseline from "@material-ui/core/CssBaseline";
import TextField from "@material-ui/core/TextField";
import FormControlLabel from "@material-ui/core/FormControlLabel";
import Checkbox from "@material-ui/core/Checkbox";
import Link from "@material-ui/core/Link";
import Grid from "@material-ui/core/Grid";
import Box from "@material-ui/core/Box";
Expand All @@ -12,7 +10,6 @@ import Container from "@material-ui/core/Container";
import { withStyles } from "@material-ui/core/styles";
import styles from "./styles";
import logo from "../../images/logo.png";
import { Link as Route } from "react-router-dom";
import { users } from "../../data.js";
import request from "superagent";
import { connect } from "react-redux";
Expand Down
10 changes: 6 additions & 4 deletions src/components/training/Training.js
Expand Up @@ -11,7 +11,7 @@ import { withStyles } from "@material-ui/core/styles";
import styles from "./styles";
import Container from "@material-ui/core/Container";
import logo from "../../images/logo.png";
import { Done, ArrowRight, ArrowLeft } from "@material-ui/icons";
import { ArrowRight, ArrowLeft } from "@material-ui/icons";
import { Link } from "react-router-dom";
import Trophy from "../trophy/Trophy";
import { connect } from "react-redux";
Expand Down Expand Up @@ -76,7 +76,7 @@ class Training extends React.Component {
<Grid item xs={4}>
<Paper className={classes.grid}>
<p>Time</p>
<p>{this.props.workout.totalTime * 0.0001 || "ccc"}</p>
<p>{this.props.workout.totalTime * 0.0001}</p>
</Paper>
</Grid>
<Grid item xs={4}>
Expand All @@ -86,7 +86,7 @@ class Training extends React.Component {
</Paper>
</Grid>
</Grid>
<Button
{/* <Button
onClick={() => this.finishWorkout()}
fullWidth
variant="contained"
Expand All @@ -95,7 +95,9 @@ class Training extends React.Component {
>
<Done />
Done!
</Button>
</Button>{" "}
*/}
<Grid style={{ height: "20px", width: "100%" }}></Grid>
<Grid container>
<Grid item xs>
<Link to="/dashboard" variant="body2">
Expand Down
2 changes: 0 additions & 2 deletions src/components/training/styles.js
@@ -1,5 +1,3 @@
import { textAlign } from "@material-ui/system";

export default theme => ({
paper: {
paddingTop: theme.spacing(2),
Expand Down
6 changes: 4 additions & 2 deletions src/reducers/workout.js
Expand Up @@ -3,8 +3,10 @@
const reducer = (state = [], action = {}) => {
switch (action.type) {
case "WORKOUT":
return action.payload.workoutList.find(workout => workout.id == action.payload.trainingId);
// return workouts.find(workout => workout.id == action.payload);
return action.payload.workoutList.find(
workout => workout.id == action.payload.trainingId
);
// return workouts.find(workout => workout.id == action.payload);
default:
return state;
}
Expand Down
12 changes: 12 additions & 0 deletions src/reducers/workouts.js
@@ -0,0 +1,12 @@
const reducer = (state = initialState, action = {}) => {
switch (action.type) {
case "TODAY_WORKOUTS":
return state.filter(workoutId => workoutId !== action.payload);
default:
return state;
}
};

const initialState = [1, 3];

export default reducer;

0 comments on commit 2bab810

Please sign in to comment.