-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from joh748/main
Make the workout management page (with three divs) Resolves #9
- Loading branch information
Showing
10 changed files
with
793 additions
and
24 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import App from './App'; | ||
|
||
test('renders learn react link', () => { | ||
test('renders Routines', () => { | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
const rountinesElement = screen.getByText("Routines"); | ||
expect(rountinesElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('renders Today\'s Workout', () => { | ||
render(<App/>); | ||
const exercisesElemet = screen.getByText("Today's Workout"); | ||
expect(exercisesElemet).toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function ExercisesDisplay() { | ||
return ( | ||
<div> | ||
Exercises Display | ||
</div> | ||
) | ||
} | ||
|
||
export default ExercisesDisplay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { LineChart, Line, CartesianGrid, XAxis, YAxis, Brush, Legend, Tooltip } from 'recharts'; | ||
|
||
function GraphDisplay({ data }) { | ||
return ( | ||
<LineChart width={400} height={400} data={data}> | ||
<Line type="monotone" dataKey="volume1" stroke="#8884d8" strokeWidth={3} /> | ||
<Line type="monotone" dataKey="volume2" stroke="#afafaf" strokeWidth={3} /> | ||
<CartesianGrid stroke="#ccc" /> | ||
<XAxis dataKey="name" /> | ||
<YAxis /> | ||
<Tooltip /> | ||
<Legend /> | ||
<Brush dataKey='name' height={30} stroke="#8884d8"/> | ||
</LineChart> | ||
) | ||
} | ||
|
||
export default GraphDisplay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function RoutinesDisplay() { | ||
return ( | ||
<div> | ||
Routines Display | ||
</div> | ||
) | ||
} | ||
|
||
export default RoutinesDisplay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import Tabs from '@mui/material/Tabs'; | ||
import Tab from '@mui/material/Tab'; | ||
import Box from '@mui/material/Box'; | ||
import RoutinesDisplay from './RoutinesDisplay'; | ||
import ExercisesDisplay from './ExercisesDisplay'; | ||
|
||
function CustomTabPanel(props) { | ||
const { children, value, index, ...other } = props; | ||
|
||
return ( | ||
<div | ||
role="tabpanel" | ||
hidden={value !== index} | ||
id={`simple-tabpanel-${index}`} | ||
aria-labelledby={`simple-tab-${index}`} | ||
{...other} | ||
> | ||
{value === index && <Box sx={{ p: 3 }}>{children}</Box>} | ||
</div> | ||
); | ||
} | ||
|
||
CustomTabPanel.propTypes = { | ||
children: PropTypes.node, | ||
index: PropTypes.number.isRequired, | ||
value: PropTypes.number.isRequired, | ||
}; | ||
|
||
function a11yProps(index) { | ||
return { | ||
id: `simple-tab-${index}`, | ||
'aria-controls': `simple-tabpanel-${index}`, | ||
}; | ||
} | ||
|
||
// Todo: need to add swipe for mobile | ||
function TabDisplay() { | ||
const [value, setValue] = React.useState(0); | ||
|
||
const handleChange = (event, newValue) => { | ||
setValue(newValue); | ||
}; | ||
|
||
return ( | ||
<Box sx={{ width: '100%' }}> | ||
|
||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | ||
<Tabs value={value} onChange={handleChange} aria-label="Routines and Today's Workout Tab" centered={true}> | ||
<Tab label="Routines" {...a11yProps(0)} /> | ||
<Tab label="Today's Workout" {...a11yProps(1)} /> | ||
</Tabs> | ||
</Box> | ||
|
||
<CustomTabPanel value={value} index={0}> | ||
<RoutinesDisplay/> | ||
</CustomTabPanel> | ||
|
||
<CustomTabPanel value={value} index={1}> | ||
<ExercisesDisplay/> | ||
</CustomTabPanel> | ||
</Box> | ||
); | ||
} | ||
|
||
export default TabDisplay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters