Client - reformat js files w/ prettier
This commit is contained in:
@ -12,48 +12,49 @@ export default class ActivitiesList extends React.PureComponent {
|
||||
<div className="card-body">
|
||||
<table className="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" />
|
||||
<th scope="col">Workout</th>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col">Distance</th>
|
||||
<th scope="col">Duration</th>
|
||||
<th scope="col">Ave. speed</th>
|
||||
<th scope="col">Max. speed</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col" />
|
||||
<th scope="col">Workout</th>
|
||||
<th scope="col">Date</th>
|
||||
<th scope="col">Distance</th>
|
||||
<th scope="col">Duration</th>
|
||||
<th scope="col">Ave. speed</th>
|
||||
<th scope="col">Max. speed</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{sports && activities.map((activity, idx) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<tr key={idx}>
|
||||
<td>
|
||||
<img
|
||||
className="activity-sport"
|
||||
src={sports
|
||||
.filter(s => s.id === activity.sport_id)
|
||||
.map(s => s.img)}
|
||||
alt="activity sport logo"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<Link to={`/activities/${activity.id}`}>
|
||||
{activity.title}
|
||||
</Link>
|
||||
</td>
|
||||
<td>
|
||||
{format(
|
||||
getDateWithTZ(activity.activity_date, user.timezone),
|
||||
'dd/MM/yyyy HH:mm'
|
||||
)}
|
||||
</td>
|
||||
<td className="text-right">
|
||||
{Number(activity.distance).toFixed(2)} km
|
||||
</td>
|
||||
<td className="text-right">{activity.moving}</td>
|
||||
<td className="text-right">{activity.ave_speed} km/h</td>
|
||||
<td className="text-right">{activity.max_speed} km/h</td>
|
||||
</tr>
|
||||
))}
|
||||
{sports &&
|
||||
activities.map((activity, idx) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<tr key={idx}>
|
||||
<td>
|
||||
<img
|
||||
className="activity-sport"
|
||||
src={sports
|
||||
.filter(s => s.id === activity.sport_id)
|
||||
.map(s => s.img)}
|
||||
alt="activity sport logo"
|
||||
/>
|
||||
</td>
|
||||
<td>
|
||||
<Link to={`/activities/${activity.id}`}>
|
||||
{activity.title}
|
||||
</Link>
|
||||
</td>
|
||||
<td>
|
||||
{format(
|
||||
getDateWithTZ(activity.activity_date, user.timezone),
|
||||
'dd/MM/yyyy HH:mm'
|
||||
)}
|
||||
</td>
|
||||
<td className="text-right">
|
||||
{Number(activity.distance).toFixed(2)} km
|
||||
</td>
|
||||
<td className="text-right">{activity.moving}</td>
|
||||
<td className="text-right">{activity.ave_speed} km/h</td>
|
||||
<td className="text-right">{activity.max_speed} km/h</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -8,7 +8,6 @@ import ActivitiesList from './ActivitiesList'
|
||||
import { getOrUpdateData } from '../../actions'
|
||||
import { getMoreActivities } from '../../actions/activities'
|
||||
|
||||
|
||||
class Activities extends React.Component {
|
||||
constructor(props, context) {
|
||||
super(props, context)
|
||||
@ -36,12 +35,18 @@ class Activities extends React.Component {
|
||||
}
|
||||
render() {
|
||||
const {
|
||||
activities, loadActivities, loadMoreActivities, message, sports, user
|
||||
activities,
|
||||
loadActivities,
|
||||
loadMoreActivities,
|
||||
message,
|
||||
sports,
|
||||
user,
|
||||
} = this.props
|
||||
const { params } = this.state
|
||||
const paginationEnd = activities.length > 0
|
||||
? activities[activities.length - 1].previous_activity === null
|
||||
: true
|
||||
const paginationEnd =
|
||||
activities.length > 0
|
||||
? activities[activities.length - 1].previous_activity === null
|
||||
: true
|
||||
return (
|
||||
<div>
|
||||
<Helmet>
|
||||
@ -65,7 +70,7 @@ class Activities extends React.Component {
|
||||
sports={sports}
|
||||
user={user}
|
||||
/>
|
||||
{!paginationEnd &&
|
||||
{!paginationEnd && (
|
||||
<input
|
||||
type="submit"
|
||||
className="btn btn-default btn-md btn-block"
|
||||
@ -76,11 +81,11 @@ class Activities extends React.Component {
|
||||
this.setState(params)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
)}
|
||||
{activities.length === 0 && (
|
||||
<div className="card text-center">
|
||||
<div className="card-body">
|
||||
No workouts. {' '}
|
||||
No workouts.{' '}
|
||||
<Link to={{ pathname: '/activities/add' }}>
|
||||
Upload one !
|
||||
</Link>
|
||||
|
Reference in New Issue
Block a user