Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 91 additions & 91 deletions public/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,102 +9,102 @@ COBI.devkit.overrideThumbControllerMapping.write(true);
var inEditMode = (COBI.parameters.context() == COBI.context.offRideSettings || COBI.parameters.context() == COBI.context.onRideSettings);

// Allow user to zoom in and out
COBI.hub.externalInterfaceAction.subscribe(function(action) {
// Listen to inputs and update zoom index variable
if ((action == 'UP' || action == 'RIGHT')) {
zoomIn();
}
if ((action == 'DOWN' || action == 'LEFT')) {
zoomOut();
}
COBI.hub.externalInterfaceAction.subscribe(function (action) {
// Listen to inputs and update zoom index variable
if ((action == 'UP' || action == 'RIGHT')) {
zoomIn();
}
if ((action == 'DOWN' || action == 'LEFT')) {
zoomOut();
}
});

// Display detailled item names if touch interaction is allowed
COBI.app.touchInteractionEnabled.subscribe(function(touchInteractionEnabled) {
updateInterfaceVisibility(touchInteractionEnabled);
COBI.app.touchInteractionEnabled.subscribe(function (touchInteractionEnabled) {
updateInterfaceVisibility(touchInteractionEnabled);
});

// Define id, name, events, formatting functions, units and default value for each item
var definitions = [
{
id: 'speed',
name: 'Speed',
subscribe: COBI.rideService.speed.subscribe,
unsubscribe: COBI.rideService.speed.unsubscribe,
formatter: formatSpeedDot1,
unit: 'km/h',
defaultValue: '-'
},
{
id: 'average_speed',
name: 'Avg Speed',
subscribe: COBI.tourService.averageSpeed.subscribe,
unsubscribe: COBI.tourService.averageSpeed.unsubscribe,
formatter: formatSpeedDot1,
unit: 'Ø km/h',
defaultValue: '-'
},
{
id: 'user_power',
name: 'User Power',
subscribe: COBI.rideService.userPower.subscribe,
unsubscribe: COBI.rideService.userPower.unsubscribe,
formatter: formatInt,
unit: 'watts',
defaultValue: '-'
},
{
id: 'cadence',
name: 'Cadence',
subscribe: COBI.rideService.cadence.subscribe,
unsubscribe: COBI.rideService.cadence.unsubscribe,
formatter: formatInt,
unit: 'rpm',
defaultValue: '-'
},
{
id: 'distance',
name: 'Distance',
subscribe: COBI.tourService.ridingDistance.subscribe,
unsubscribe: COBI.tourService.ridingDistance.unsubscribe,
formatter: formatDistanceDot1,
unit: 'km total',
defaultValue: '-'
},
{
id: 'calories',
name: 'Calories',
subscribe: COBI.tourService.calories.subscribe,
unsubscribe: COBI.tourService.calories.unsubscribe,
formatter: formatInt,
unit: 'kcal',
defaultValue: '-'
},
{
id: 'ascent',
name: 'Ascent',
subscribe: COBI.tourService.ascent.subscribe,
unsubscribe: COBI.tourService.ascent.unsubscribe,
formatter: formatInt,
unit: 'm',
defaultValue: '-'
},
{
id: 'heart_rate',
name: 'Heart Rate',
subscribe: COBI.rideService.heartRate.subscribe,
unsubscribe: COBI.rideService.heartRate.unsubscribe,
formatter: formatInt,
unit: 'bpm',
defaultValue: '-'
},
{
id: 'duration',
name: 'Duration',
subscribe: COBI.tourService.ridingDuration.subscribe,
unsubscribe: COBI.tourService.ridingDuration.unsubscribe,
formatter: formatMins,
unit: 'min',
defaultValue: '-'
}
{
id: 'speed',
name: i18next.t('speed'),
subscribe: COBI.rideService.speed.subscribe,
unsubscribe: COBI.rideService.speed.unsubscribe,
formatter: formatSpeedDot1,
unit: 'km/h',
defaultValue: '-'
},
{
id: 'average_speed',
name: i18next.t('average_speed'),
subscribe: COBI.tourService.averageSpeed.subscribe,
unsubscribe: COBI.tourService.averageSpeed.unsubscribe,
formatter: formatSpeedDot1,
unit: 'Ø km/h',
defaultValue: '-'
},
{
id: 'user_power',
name: i18next.t('user_power'),
subscribe: COBI.rideService.userPower.subscribe,
unsubscribe: COBI.rideService.userPower.unsubscribe,
formatter: formatInt,
unit: 'watts',
defaultValue: '-'
},
{
id: 'cadence',
name: i18next.t('cadence'),
subscribe: COBI.rideService.cadence.subscribe,
unsubscribe: COBI.rideService.cadence.unsubscribe,
formatter: formatInt,
unit: 'rpm',
defaultValue: '-'
},
{
id: 'distance',
name: i18next.t('distance'),
subscribe: COBI.tourService.ridingDistance.subscribe,
unsubscribe: COBI.tourService.ridingDistance.unsubscribe,
formatter: formatDistanceDot1,
unit: 'km total',
defaultValue: '-'
},
{
id: 'calories',
name: i18next.t('calories'),
subscribe: COBI.tourService.calories.subscribe,
unsubscribe: COBI.tourService.calories.unsubscribe,
formatter: formatInt,
unit: 'kcal',
defaultValue: '-'
},
{
id: 'ascent',
name: i18next.t('ascent'),
subscribe: COBI.tourService.ascent.subscribe,
unsubscribe: COBI.tourService.ascent.unsubscribe,
formatter: formatInt,
unit: 'm',
defaultValue: '-'
},
{
id: 'heart_rate',
name: i18next.t('heart_rate'),
subscribe: COBI.rideService.heartRate.subscribe,
unsubscribe: COBI.rideService.heartRate.unsubscribe,
formatter: formatInt,
unit: 'bpm',
defaultValue: '-'
},
{
id: 'duration',
name: i18next.t('duration'),
subscribe: COBI.tourService.ridingDuration.subscribe,
unsubscribe: COBI.tourService.ridingDuration.unsubscribe,
formatter: formatMins,
unit: 'min',
defaultValue: '-'
}
];
52 changes: 52 additions & 0 deletions public/localization.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Initialize localization with language set by cobi parameter
i18next.init(
{
lng: COBI.parameters.language(),
fallbackLng: ['en', 'de', 'fr'],
whitelist: ['en', 'de', 'fr'],
resources: {
en: {
translation: {
'speed': 'Speed',
'average_speed': 'Avg Speed',
'user_power': 'User Power',
'cadence': 'Cadence',
'distance': 'Distance',
'calories': 'Calories',
'ascent': 'Ascent',
'heart_rate': 'Heart Rate',
'duration': 'Duration'
}
},
de: {
translation: {
'speed': 'Geschwindigkeit',
'average_speed': 'durchschnittliche Geschwindigkeit',
'user_power': 'Benutzerleistung',
'cadence': 'Kadenz',
'distance': 'Entfernung',
'calories': 'Kalorien',
'ascent': 'Aufstieg',
'heart_rate': 'Puls',
'duration': 'Dauer'
}
},
fr: {
translation: {
'speed': 'Vitesse',
'average_speed': 'Vitesse moyenne',
'user_power': 'Energie utilisée',
'cadence': 'Fréquence de pédalage',
'distance': 'Distance',
'calories': 'Calories',
'ascent': 'Dénilevé',
'heart_rate': 'Rythme cardiaque',
'duration': 'Durée de la session'

}
}
}
},
function (err, t) {
}
);
3 changes: 2 additions & 1 deletion public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ul {
.uk-card-default {
background: #2d2d37;
color: #FFF;
box-shadow: 0;
box-shadow: none;
padding: .7rem .5rem;
}

Expand All @@ -31,6 +31,7 @@ ul {
letter-spacing: .05rem;
text-transform: uppercase;
margin-bottom: 1.2rem;
max-height: 15px;
}

.value {
Expand Down
Loading