Merge branch 'master' into v0.3.0

This commit is contained in:
Sam
2019-12-29 13:39:26 +01:00
57 changed files with 2214 additions and 1679 deletions

View File

@ -8,14 +8,14 @@
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous"
>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/fork-awesome@1.1.5/css/fork-awesome.min.css"
integrity="sha256-P64qV9gULPHiZTdrS1nM59toStkgjM0dsf5mK/UwBV4="
href="https://cdn.jsdelivr.net/npm/fork-awesome@1.1.7/css/fork-awesome.min.css"
integrity="sha256-gsmEoJAws/Kd3CjuOQzLie5Q3yshhvmo7YNtBG7aaEY="
crossorigin="anonymous"
>
<link
@ -24,8 +24,8 @@
>
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css"
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ=="
href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""
>
<title>FitTrackee</title>
@ -36,18 +36,18 @@
</noscript>
<div id="root"></div>
<script
src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
src="https://code.jquery.com/jquery-3.4.1.slim.min.js"
integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n"
crossorigin="anonymous"
></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"
integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut"
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k"
src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"
></script>
</body>

View File

@ -155,7 +155,9 @@ class ActivityDisplay extends React.Component {
<div className="card-body">
<div className="row">
<div className="col">
<div className="chart-title">Chart</div>
<div className="chart-title">
{t('activities:Chart')}
</div>
<ActivityCharts
activity={activity}
dataType={dataType}

View File

@ -6,17 +6,18 @@ import {
editActivity,
} from '../../../actions/activities'
import { history } from '../../../index'
import { getDateWithTZ } from '../../../utils'
import { formatActivityDate, translateSports } from '../../../utils/activities'
function FormWithoutGpx(props) {
const { activity, onAddOrEdit, sports, t } = props
const { activity, onAddOrEdit, sports, t, user } = props
const translatedSports = translateSports(sports, t, true)
let activityDate,
activityTime,
sportId = ''
if (activity) {
const activityDateTime = formatActivityDate(
activity.activity_date,
getDateWithTZ(activity.activity_date, user.timezone),
'yyyy-MM-dd'
)
activityDate = activityDateTime.activity_date
@ -133,7 +134,9 @@ function FormWithoutGpx(props) {
}
export default connect(
() => ({}),
state => ({
user: state.user,
}),
dispatch => ({
onAddOrEdit: (e, activity) => {
const d = e.target.form.duration.value.split(':')

View File

@ -296,7 +296,11 @@ label {
}
.dropdown-item-selected {
font-weight: bold;
font-weight: bold;
}
.dropdown-item-selected::after {
content: " ✔";
}
.fa-question-circle {
@ -341,10 +345,6 @@ label {
color: lightgrey;
}
.img-disabled {
opacity: .4;
}
.leaflet-container {
height: 400px;
}
@ -594,3 +594,11 @@ label {
flex-basis: calc(100%/7);
width: calc(100%/7);
}
.calendar .body .img-disabled {
opacity: .4;
}
.calendar .body .weekend {
background: #f5f5f5;
}

View File

@ -92,7 +92,7 @@ class Calendar extends React.Component {
}
renderCells() {
const { currentMonth, startDate, endDate } = this.state
const { currentMonth, startDate, endDate, weekStartOnMonday } = this.state
const { sports } = this.props
const dateFormat = 'd'
@ -106,40 +106,45 @@ class Calendar extends React.Component {
for (let i = 0; i < 7; i++) {
formattedDate = format(day, dateFormat)
const dayActivities = this.filterActivities(day)
const isDisabled = isSameMonth(day, currentMonth) ? '' : 'disabled'
const isDisabled = isSameMonth(day, currentMonth) ? '' : '-disabled'
const isWeekEnd = weekStartOnMonday
? [5, 6].includes(i)
: [0, 6].includes(i)
days.push(
<div className={`col cell img-${isDisabled}`} key={day}>
<span className="number">{formattedDate}</span>
{dayActivities.map(act => (
<Link key={act.id} to={`/activities/${act.id}`}>
<Fragment>
<img
alt="activity sport logo"
className={`activity-sport ${isDisabled}`}
src={sports
.filter(s => s.id === act.sport_id)
.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(
rec =>
` ${
recordsLabels.filter(
r => r.record_type === rec.record_type
)[0].label
}`
)}
/>
</sup>
)}
</Fragment>
</Link>
))}
<div className={`col cell ${isWeekEnd ? ' weekend' : ''}`} key={day}>
<div className={`img${isDisabled}`}>
<span className="number">{formattedDate}</span>
{dayActivities.map(act => (
<Link key={act.id} to={`/activities/${act.id}`}>
<Fragment>
<img
alt="activity sport logo"
className={`activity-sport ${isDisabled}`}
src={sports
.filter(s => s.id === act.sport_id)
.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(
rec =>
` ${
recordsLabels.filter(
r => r.record_type === rec.record_type
)[0].label
}`
)}
/>
</sup>
)}
</Fragment>
</Link>
))}
</div>
</div>
)
day = addDays(day, 1)

View File

@ -2,56 +2,20 @@ import i18n from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import XHR from 'i18next-xhr-backend'
import EnActivitiesTranslations from './locales/en/activities.json'
import EnAdministrationTranslations from './locales/en/administration.json'
import EnCommonTranslations from './locales/en/common.json'
import EnDashboardTranslations from './locales/en/dashboard.json'
import EnMessagesTranslations from './locales/en/messages.json'
import EnSportsTranslations from './locales/en/sports.json'
import EnStatisticsTranslations from './locales/en/statistics.json'
import EnUserTranslations from './locales/en/user.json'
import FrActivitiesTranslations from './locales/fr/activities.json'
import FrAdministrationTranslations from './locales/fr/administration.json'
import FrCommonTranslations from './locales/fr/common.json'
import FrDashboardTranslations from './locales/fr/dashboard.json'
import FrMessagesTranslations from './locales/fr/messages.json'
import FrSportsTranslations from './locales/fr/sports.json'
import FrStatisticsTranslations from './locales/fr/statistics.json'
import FrUserTranslations from './locales/fr/user.json'
import { resources } from './locales'
i18n
.use(XHR)
.use(LanguageDetector)
.init({
debug: true,
debug: process.env.NODE_ENV === 'development',
lng: 'en',
fallbackLng: 'en',
keySeparator: false,
interpolation: {
escapeValue: false,
},
resources: {
en: {
activities: EnActivitiesTranslations,
administration: EnAdministrationTranslations,
common: EnCommonTranslations,
dashboard: EnDashboardTranslations,
messages: EnMessagesTranslations,
sports: EnSportsTranslations,
statistics: EnStatisticsTranslations,
user: EnUserTranslations,
},
fr: {
activities: FrActivitiesTranslations,
administration: FrAdministrationTranslations,
common: FrCommonTranslations,
dashboard: FrDashboardTranslations,
messages: FrMessagesTranslations,
sports: FrSportsTranslations,
statistics: FrStatisticsTranslations,
user: FrUserTranslations,
},
},
resources,
ns: ['common'],
defaultNS: 'common',
})

View File

@ -6,6 +6,7 @@
"Ave. speed": "Ave. speed",
"Ascent": "Ascent",
"Average speed": "Average speed",
"Chart": "Chart",
"Confirmation": "Confirmation",
"data from gpx, without any cleaning": "data from gpx, without any cleaning",
"Date": "Date",

View File

@ -0,0 +1,17 @@
import EnActivitiesTranslations from './activities.json'
import EnCommonTranslations from './common.json'
import EnDashboardTranslations from './dashboard.json'
import EnMessagesTranslations from './messages.json'
import EnSportsTranslations from './sports.json'
import EnStatisticsTranslations from './statistics.json'
import EnUserTranslations from './user.json'
export const enResources = {
activities: EnActivitiesTranslations,
common: EnCommonTranslations,
dashboard: EnDashboardTranslations,
messages: EnMessagesTranslations,
sports: EnSportsTranslations,
statistics: EnStatisticsTranslations,
user: EnUserTranslations,
}

View File

@ -6,6 +6,7 @@
"Ave. speed": "Vitesse moyenne",
"Ascent": "Dénivelé positif",
"Average speed": "Vitesse moyenne",
"Chart": "Analyse",
"Confirmation": "Confirmation",
"data from gpx, without any cleaning": "données issues du fichier gpx, sans correction",
"Date": "Date",

View File

@ -0,0 +1,17 @@
import FrActivitiesTranslations from './activities.json'
import FrCommonTranslations from './common.json'
import FrDashboardTranslations from './dashboard.json'
import FrMessagesTranslations from './messages.json'
import FrSportsTranslations from './sports.json'
import FrStatisticsTranslations from './statistics.json'
import FrUserTranslations from './user.json'
export const frResources = {
activities: FrActivitiesTranslations,
common: FrCommonTranslations,
dashboard: FrDashboardTranslations,
messages: FrMessagesTranslations,
sports: FrSportsTranslations,
statistics: FrStatisticsTranslations,
user: FrUserTranslations,
}

View File

@ -0,0 +1,7 @@
import { enResources } from './en/resources'
import { frResources } from './fr/resources'
export const resources = {
en: enResources,
fr: frResources,
}