BigW Consortium Gitlab

total_time_component.js 964 Bytes
Newer Older
Alfredo Sumaran committed
1
/* eslint-disable no-param-reassign */
2 3

import Vue from 'vue';
4

5 6
const global = window.gl || (window.gl = {});
global.cycleAnalytics = global.cycleAnalytics || {};
7

8 9 10 11 12 13 14
global.cycleAnalytics.TotalTimeComponent = Vue.extend({
  props: {
    time: Object,
  },
  template: `
    <span class="total-time">
      <template v-if="Object.keys(time).length">
15
        <template v-if="time.days">{{ time.days }} <span>{{ n__('day', 'days', time.days) }}</span></template>
16 17
        <template v-if="time.hours">{{ time.hours }} <span>{{ n__('Time|hr', 'Time|hrs', time.hours) }}</span></template>
        <template v-if="time.mins && !time.days">{{ time.mins }} <span>{{ n__('Time|min', 'Time|mins', time.mins) }}</span></template>
18
        <template v-if="time.seconds && Object.keys(time).length === 1 || time.seconds === 0">{{ time.seconds }} <span>{{ s__('Time|s') }}</span></template>
19 20 21 22 23 24 25
      </template>
      <template v-else>
        --
      </template>
    </span>
  `,
});