2021-08-21 18:47:35 +02:00
|
|
|
<template>
|
2021-09-05 09:41:39 +02:00
|
|
|
<div class="user-month-stats">
|
2021-10-02 16:16:58 +02:00
|
|
|
<Card>
|
2021-09-04 19:40:27 +02:00
|
|
|
<template #title>{{ $t('dashboard.THIS_MONTH') }}</template>
|
|
|
|
<template #content>
|
2021-10-03 19:23:17 +02:00
|
|
|
<StatChart
|
|
|
|
:sports="sports"
|
|
|
|
:user="user"
|
|
|
|
:chart-params="chartParams"
|
|
|
|
:displayed-sport-ids="selectedSportIds"
|
2021-10-05 17:52:36 +02:00
|
|
|
:hide-chart-if-no-data="true"
|
2021-10-03 19:23:17 +02:00
|
|
|
/>
|
2021-09-21 08:51:07 +02:00
|
|
|
</template>
|
2021-09-04 19:40:27 +02:00
|
|
|
</Card>
|
|
|
|
</div>
|
2021-08-21 18:47:35 +02:00
|
|
|
</template>
|
2021-09-04 19:40:27 +02:00
|
|
|
|
2021-11-10 21:19:27 +01:00
|
|
|
<script setup lang="ts">
|
2021-10-03 19:23:17 +02:00
|
|
|
import { endOfMonth, startOfMonth } from 'date-fns'
|
2021-11-10 21:19:27 +01:00
|
|
|
import { toRefs } from 'vue'
|
2021-09-04 19:40:27 +02:00
|
|
|
|
2021-10-03 19:23:17 +02:00
|
|
|
import StatChart from '@/components/Common/StatsChart/index.vue'
|
2021-09-04 19:40:27 +02:00
|
|
|
import { ISport } from '@/types/sports'
|
2021-10-30 12:01:55 +02:00
|
|
|
import { IUserProfile } from '@/types/user'
|
2021-09-04 19:40:27 +02:00
|
|
|
|
2021-11-10 21:19:27 +01:00
|
|
|
interface Props {
|
|
|
|
sports: ISport[]
|
|
|
|
user: IUserProfile
|
|
|
|
}
|
|
|
|
const props = defineProps<Props>()
|
|
|
|
|
|
|
|
const { sports, user } = toRefs(props)
|
|
|
|
const date = new Date()
|
|
|
|
const chartParams = {
|
|
|
|
duration: 'week',
|
|
|
|
start: startOfMonth(date),
|
|
|
|
end: endOfMonth(date),
|
|
|
|
}
|
|
|
|
const selectedSportIds = props.sports.map((sport) => sport.id)
|
2021-09-04 19:40:27 +02:00
|
|
|
</script>
|
|
|
|
|
2021-09-20 18:23:05 +02:00
|
|
|
<style lang="scss" scoped>
|
2021-11-29 11:23:21 +01:00
|
|
|
@import '~@/scss/vars.scss';
|
2021-09-04 19:40:27 +02:00
|
|
|
|
2021-09-20 18:23:05 +02:00
|
|
|
.user-month-stats {
|
2021-09-22 11:49:56 +02:00
|
|
|
::v-deep(.card-content) {
|
|
|
|
padding: $default-padding;
|
2021-09-04 19:40:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|