display records on calendar - fix #25

This commit is contained in:
Sam 2018-07-29 11:50:45 +02:00
parent 35e80de953
commit 0c8921a6ff
2 changed files with 26 additions and 11 deletions

View File

@ -98,8 +98,8 @@ label {
.activity-sport { .activity-sport {
margin-right: 1px; margin-right: 1px;
max-width: 20px; max-width: 18px;
max-height: 20px; max-height: 18px;
} }
.add-activity { .add-activity {
@ -177,6 +177,10 @@ label {
margin-right: 5px; margin-right: 5px;
} }
.custom-fa-small {
font-size: 0.8em;
}
.dashboard, .history { .dashboard, .history {
margin-top: 30px; margin-top: 30px;
} }

View File

@ -1,7 +1,7 @@
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
// source: https://blog.flowandform.agency/create-a-custom-calendar-in-react-3df1bfd0b728 // source: https://blog.flowandform.agency/create-a-custom-calendar-in-react-3df1bfd0b728
import dateFns from 'date-fns' import dateFns from 'date-fns'
import React from 'react' import React, { Fragment } from 'react'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
@ -111,14 +111,25 @@ class Calendar extends React.Component {
<span className="number">{formattedDate}</span> <span className="number">{formattedDate}</span>
{dayActivities.map(act => ( {dayActivities.map(act => (
<Link key={act.id} to={`/activities/${act.id}`}> <Link key={act.id} to={`/activities/${act.id}`}>
<img <Fragment>
alt="activity sport logo" <img
className={`activity-sport ${isDisabled}`} alt="activity sport logo"
src={sports className={`activity-sport ${isDisabled}`}
.filter(s => s.id === act.sport_id) src={sports
.map(s => s.img)} .filter(s => s.id === act.sport_id)
title={act.title} .map(s => s.img)}
/> title={act.title}
/>
{act.records.length > 0 && (
<sup>
<i
className="fa fa-trophy custom-fa-small"
aria-hidden="true"
title={act.records.map(r => ` ${r.record_type}`)}
/>
</sup>
)}
</Fragment>
</Link> </Link>
))} ))}
</div> </div>