import theme from '../styles/theme'
import { Formik, Form } from 'formik'
import { Query } from 'react-apollo'
import { TRAINING } from '../lib/graphql'
import { TextInput } from '../lib/forms'
function calculateRating(ratings) {
const numberOfRatings = ratings.length
const sumOfRatings = ratings.reduce(
(accumulator, rating) => accumulator + rating.value,
0
)
return numberOfRatings ? sumOfRatings / numberOfRatings : '-'
}
const TrainingArchive = props => (
Training Archive
{props.trainings.map(training => (
))}
)
const TrainingHint = props => (
{props.training.date}
{props.training.title}
)
const Training = props => (
{props.title}
Content
{props.content
.sort(block => block.sequence)
.map(block => (
))}
)
const Youtube = props => {
const { link, rest } = props
const [crap, src] = props.link.match(/\?v=(.*)/)
return (
)
}
const Spotify = props => {
const src = props.link.match(/track\/(.*)/)[1]
return (
)
}
const Media = props => {
if (props.link.includes('youtube.com')) {
return
} else if (props.link.includes('spotify.com')) {
return
} else {
return Link not recognized.
}
}
const Block = props => (
{props.title}
Duration:
{props.duration}
Variation:
{props.variation}
Description:
{props.description}
Format:
{props.format.name}{' '}
[?]
Tracks
{props.tracks.map(track => (
))}
Exercises
{props.exercises.map(exercise => (
))}
)
const Track = props => {
return (
Track {props.id}: {props.title} ({props.artist})
)
}
const Exercise = props => {
return (
Exercise {props.id}: {props.name}
)
}
const TrainingCreateForm = props => (
console.log(ev)}
>
{() => (
)}
)
export { TrainingArchive, TrainingCreateForm }
export default Training