FitTrackee/fittrackee_client/src/components/Dashboard/UserMonthStats.vue

51 lines
1.2 KiB
Vue
Raw Normal View History

<template>
<div class="user-month-stats">
<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"
:hide-chart-if-no-data="true"
2021-10-03 19:23:17 +02:00
/>
</template>
2021-09-04 19:40:27 +02:00
</Card>
</div>
</template>
2021-09-04 19:40:27 +02:00
<script setup lang="ts">
2021-10-03 19:23:17 +02:00
import { endOfMonth, startOfMonth } from 'date-fns'
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
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-09-04 19:40:27 +02:00
@import '~@/scss/base';
2021-09-20 18:23:05 +02:00
.user-month-stats {
::v-deep(.card-content) {
padding: $default-padding;
2021-09-04 19:40:27 +02:00
}
}
</style>