2021-10-03 19:23:17 +02:00
|
|
|
<template>
|
|
|
|
<div id="statistics">
|
|
|
|
<div class="container" v-if="authUser.username">
|
2021-10-04 13:53:48 +02:00
|
|
|
<Card>
|
|
|
|
<template #title>{{ $t('statistics.STATISTICS') }}</template>
|
|
|
|
<template #content>
|
2021-10-05 17:52:36 +02:00
|
|
|
<Statistics
|
|
|
|
:class="{ 'stats-disabled': authUser.nb_workouts === 0 }"
|
|
|
|
:user="authUser"
|
|
|
|
:sports="sports"
|
|
|
|
/>
|
2021-10-04 13:53:48 +02:00
|
|
|
</template>
|
|
|
|
</Card>
|
2021-10-05 17:52:36 +02:00
|
|
|
<NoWorkouts v-if="authUser.nb_workouts === 0"></NoWorkouts>
|
2021-10-03 19:23:17 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { ComputedRef, computed, defineComponent } from 'vue'
|
|
|
|
|
2021-10-04 13:53:48 +02:00
|
|
|
import Card from '@/components/Common/Card.vue'
|
2021-10-05 17:52:36 +02:00
|
|
|
import NoWorkouts from '@/components/Common/NoWorkouts.vue'
|
2021-10-03 19:23:17 +02:00
|
|
|
import Statistics from '@/components/Statistics/index.vue'
|
|
|
|
import { USER_STORE, SPORTS_STORE } from '@/store/constants'
|
|
|
|
import { ISport } from '@/types/sports'
|
|
|
|
import { IAuthUserProfile } from '@/types/user'
|
|
|
|
import { useStore } from '@/use/useStore'
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'StatisticsView',
|
|
|
|
components: {
|
2021-10-04 13:53:48 +02:00
|
|
|
Card,
|
2021-10-05 17:52:36 +02:00
|
|
|
NoWorkouts,
|
2021-10-03 19:23:17 +02:00
|
|
|
Statistics,
|
|
|
|
},
|
|
|
|
setup() {
|
|
|
|
const store = useStore()
|
|
|
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
|
|
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
|
|
|
)
|
2021-10-04 09:22:15 +02:00
|
|
|
const sports: ComputedRef<ISport[]> = computed(() =>
|
|
|
|
store.getters[SPORTS_STORE.GETTERS.SPORTS].filter((sport) =>
|
|
|
|
authUser.value.sports_list.includes(sport.id)
|
|
|
|
)
|
2021-10-03 19:23:17 +02:00
|
|
|
)
|
|
|
|
return { authUser, sports }
|
|
|
|
},
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import '~@/scss/base';
|
|
|
|
#statistics {
|
2021-10-04 13:53:48 +02:00
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
margin-bottom: 30px;
|
|
|
|
.container {
|
2021-10-05 17:52:36 +02:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2021-10-04 13:53:48 +02:00
|
|
|
width: 100%;
|
|
|
|
}
|
2021-10-03 19:23:17 +02:00
|
|
|
}
|
|
|
|
</style>
|