summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/cycle_analytics/components/total_time_component.vue
blob: 9941b997b3f7045ac6d6c674da937e279274c55f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<script>
  export default {
    props: {
      time: {
        type: Object,
        required: false,
        default: () => ({}),
      },
    },
    computed: {
      hasData() {
        return Object.keys(this.time).length;
      },
    },
  };
</script>
<template>
  <span class="total-time">
    <template v-if="hasData">
      <template v-if="time.days">{{ time.days }} <span>{{ n__('day', 'days', time.days) }}</span></template>
      <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>
      <template v-if="time.seconds && hasDa === 1 || time.seconds === 0">{{ time.seconds }} <span>{{ s__('Time|s') }}</span></template>
    </template>
    <template v-else>
      --
    </template>
    </span>
</template>