|
@@ -1,4 +1,4 @@
|
|
|
-function calculateRating(ratings) {
|
|
|
+function calculateRating (ratings) {
|
|
|
const numberOfRatings = ratings.length
|
|
|
const sumOfRatings = ratings.reduce(
|
|
|
(accumulator, rating) => accumulator + rating.value,
|
|
@@ -30,49 +30,87 @@ const TrainingHint = props => (
|
|
|
const Training = props => (
|
|
|
<article>
|
|
|
<h2>{props.title}</h2>
|
|
|
- <section id='info'>
|
|
|
- <p>
|
|
|
+ <aside>
|
|
|
+ <div id='trainingType'>
|
|
|
<span className='caption'>Type: </span>
|
|
|
<span className='data'>{props.type.name}</span>
|
|
|
- </p>
|
|
|
- <p>
|
|
|
+ </div>
|
|
|
+ <div id='trainingDate'>
|
|
|
<span className='caption'>Date: </span>
|
|
|
- <span className='data'>{(new Date(props.trainingDate)).toLocaleDateString()}</span>
|
|
|
- </p>
|
|
|
- <p>
|
|
|
+ <date className='data'>
|
|
|
+ {new Date(props.trainingDate).toLocaleDateString()}
|
|
|
+ </date>
|
|
|
+ </div>
|
|
|
+ <div id='trainingLocation'>
|
|
|
<span className='caption'>Location: </span>
|
|
|
<span className='data'>{props.location}</span>
|
|
|
- </p>
|
|
|
- <p>
|
|
|
+ </div>
|
|
|
+ <div id='trainingRegistrations'>
|
|
|
<span className='caption'>Registrations: </span>
|
|
|
- <span className='data'>{props.registration.length} <a href=''>Register!</a></span>
|
|
|
- </p>
|
|
|
- <p>
|
|
|
+ <span className='data'>
|
|
|
+ {props.registration.length} <a href=''>Register!</a>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div id='trainingAttendance'>
|
|
|
<span className='caption'>Attendance: </span>
|
|
|
<span className='data'>{props.attendance}</span>
|
|
|
- </p>
|
|
|
- <p>
|
|
|
+ </div>
|
|
|
+ <div id='trainingRatings'>
|
|
|
<span className='caption'>Rating: </span>
|
|
|
- <span className='data'>{calculateRating(props.ratings)} [<a href=''>{props.ratings.length}</a>]
|
|
|
- Rate it!
|
|
|
+ <span className='data'>
|
|
|
+ {calculateRating(props.ratings)} [
|
|
|
+ <a href=''>{props.ratings.length}</a>] Rate it!
|
|
|
<a href=''>*</a>
|
|
|
<a href=''>*</a>
|
|
|
<a href=''>*</a>
|
|
|
<a href=''>*</a>
|
|
|
<a href=''>*</a>
|
|
|
</span>
|
|
|
- </p>
|
|
|
- </section>
|
|
|
- <section id='content'>
|
|
|
+ </div>
|
|
|
+ </aside>
|
|
|
+ <section>
|
|
|
<h3>Content</h3>
|
|
|
- {props.content.sort(block => block.sequence).map(block => <Block key={block.id} {...block} />)}
|
|
|
+ <ol>
|
|
|
+ {props.content
|
|
|
+ .sort(block => block.sequence)
|
|
|
+ .map(block => (
|
|
|
+ <Block key={block.id} {...block} />
|
|
|
+ ))}
|
|
|
+ </ol>
|
|
|
+ <iframe
|
|
|
+ width='560'
|
|
|
+ height='315'
|
|
|
+ src='https://www.youtube.com/embed/hRz0qPREKho'
|
|
|
+ frameborder='0'
|
|
|
+ allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture'
|
|
|
+ allowfullscreen
|
|
|
+ />
|
|
|
</section>
|
|
|
+
|
|
|
+ <style jsx>
|
|
|
+ {`
|
|
|
+ article {
|
|
|
+ border: 1px solid black;
|
|
|
+ }
|
|
|
+
|
|
|
+ article > h2 {
|
|
|
+ font-size: 120%;
|
|
|
+ font-family: roboto_black;
|
|
|
+ }
|
|
|
+
|
|
|
+ aside {
|
|
|
+ }
|
|
|
+
|
|
|
+ section {
|
|
|
+ }
|
|
|
+ `}
|
|
|
+ </style>
|
|
|
</article>
|
|
|
)
|
|
|
|
|
|
-const Block = props => <article>
|
|
|
- <h2>{props.title}</h2>
|
|
|
- <section id='info'>
|
|
|
+const Block = props => (
|
|
|
+ <li>
|
|
|
+ <h2>{props.title}</h2>
|
|
|
<p>
|
|
|
<span className='caption'>Duration: </span>
|
|
|
<span className='data'>{props.duration}</span>
|
|
@@ -83,22 +121,38 @@ const Block = props => <article>
|
|
|
</p>
|
|
|
<p>
|
|
|
<span className='caption'>Format: </span>
|
|
|
- <span className='data'>{props.format.name}</span>
|
|
|
+ <span className='data'>
|
|
|
+ {props.format.name}{' '}
|
|
|
+ <sup>
|
|
|
+ <a title={props.format.description}>[?]</a>
|
|
|
+ </sup>
|
|
|
+ </span>
|
|
|
</p>
|
|
|
<p>
|
|
|
<span className='caption'>Description: </span>
|
|
|
<span className='data'>{props.description}</span>
|
|
|
</p>
|
|
|
- </section>
|
|
|
-</article>
|
|
|
+ </li>
|
|
|
+)
|
|
|
|
|
|
class TrainingCreateForm extends React.Component {
|
|
|
- render() {
|
|
|
- return <form>
|
|
|
- <label htmlFor="title">Title<input type="text" id="title" /></label>
|
|
|
- <label htmlFor="title">Title<input type="text" id="title" /></label>
|
|
|
- <label htmlFor="title">Title<input type="text" id="title" /></label>
|
|
|
- </form>
|
|
|
+ render () {
|
|
|
+ return (
|
|
|
+ <form>
|
|
|
+ <label htmlFor='title'>
|
|
|
+ Title
|
|
|
+ <input type='text' id='title' />
|
|
|
+ </label>
|
|
|
+ <label htmlFor='title'>
|
|
|
+ Title
|
|
|
+ <input type='text' id='title' />
|
|
|
+ </label>
|
|
|
+ <label htmlFor='title'>
|
|
|
+ Title
|
|
|
+ <input type='text' id='title' />
|
|
|
+ </label>
|
|
|
+ </form>
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
|