2021-10-03 19:23:17 +02:00
|
|
|
<template>
|
2021-11-03 09:10:23 +01:00
|
|
|
<div id="statistics" class="view">
|
2021-10-03 19:23:17 +02:00
|
|
|
<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>
|
|
|
|
|
2021-11-10 21:19:27 +01:00
|
|
|
<script setup lang="ts">
|
|
|
|
import { ComputedRef, computed } from 'vue'
|
2021-10-03 19:23:17 +02:00
|
|
|
|
|
|
|
import Statistics from '@/components/Statistics/index.vue'
|
2021-10-13 09:57:48 +02:00
|
|
|
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
|
2021-11-03 10:41:53 +01:00
|
|
|
import { AUTH_USER_STORE, SPORTS_STORE } from '@/store/constants'
|
2021-10-03 19:23:17 +02:00
|
|
|
import { ISport } from '@/types/sports'
|
2022-03-13 09:50:09 +01:00
|
|
|
import { IAuthUserProfile } from '@/types/user'
|
2021-10-03 19:23:17 +02:00
|
|
|
import { useStore } from '@/use/useStore'
|
|
|
|
|
2021-11-10 21:19:27 +01:00
|
|
|
const store = useStore()
|
|
|
|
|
2022-03-13 09:50:09 +01:00
|
|
|
const authUser: ComputedRef<IAuthUserProfile> = computed(
|
2021-11-10 21:19:27 +01:00
|
|
|
() => store.getters[AUTH_USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
|
|
|
)
|
|
|
|
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
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
#statistics {
|
2021-10-04 13:53:48 +02:00
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
.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>
|