2021-07-25 13:34:44 +02:00
|
|
|
<template>
|
2021-09-27 13:06:17 +02:00
|
|
|
<div id="dashboard" v-if="authUser.username && sports.length > 0">
|
2021-09-29 18:41:51 +02:00
|
|
|
<div class="container mobile-menu">
|
2021-10-05 19:02:08 +02:00
|
|
|
<div class="box">
|
|
|
|
<div
|
|
|
|
class="mobile-menu-item"
|
|
|
|
:class="{ 'is-selected': isSelected === 'chart' }"
|
|
|
|
@click="updateDisplayColumn('chart')"
|
|
|
|
>
|
|
|
|
<i class="fa fa-bar-chart" aria-hidden="true" />
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="mobile-menu-item"
|
|
|
|
:class="{ 'is-selected': isSelected === 'calendar' }"
|
|
|
|
@click="updateDisplayColumn('calendar')"
|
|
|
|
>
|
|
|
|
<i class="fa fa-calendar" aria-hidden="true" />
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="mobile-menu-item"
|
|
|
|
:class="{ 'is-selected': isSelected === 'timeline' }"
|
|
|
|
@click="updateDisplayColumn('timeline')"
|
|
|
|
>
|
|
|
|
<i class="fa fa-map-o" aria-hidden="true" />
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
class="mobile-menu-item"
|
|
|
|
:class="{ 'is-selected': isSelected === 'records' }"
|
|
|
|
@click="updateDisplayColumn('records')"
|
|
|
|
>
|
|
|
|
<i class="fa fa-trophy" aria-hidden="true" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-09-29 18:41:51 +02:00
|
|
|
</div>
|
2021-08-18 17:10:16 +02:00
|
|
|
<div class="container">
|
2021-09-08 18:54:22 +02:00
|
|
|
<UserStatsCards :user="authUser" />
|
2021-08-18 17:10:16 +02:00
|
|
|
</div>
|
2021-09-05 09:41:39 +02:00
|
|
|
<div class="container dashboard-container">
|
|
|
|
<div class="left-container dashboard-sub-container">
|
2021-09-29 18:41:51 +02:00
|
|
|
<UserMonthStats
|
|
|
|
:sports="sports"
|
|
|
|
:user="authUser"
|
|
|
|
:class="{ 'is-hidden': !(isSelected === 'chart') }"
|
|
|
|
/>
|
|
|
|
<UserRecords
|
|
|
|
:sports="sports"
|
|
|
|
:user="authUser"
|
|
|
|
:class="{ 'is-hidden': !(isSelected === 'records') }"
|
|
|
|
/>
|
2021-08-21 18:47:35 +02:00
|
|
|
</div>
|
2021-09-05 09:41:39 +02:00
|
|
|
<div class="right-container dashboard-sub-container">
|
2021-09-29 18:41:51 +02:00
|
|
|
<UserCalendar
|
|
|
|
:sports="sports"
|
|
|
|
:user="authUser"
|
|
|
|
:class="{ 'is-hidden': !(isSelected === 'calendar') }"
|
|
|
|
/>
|
|
|
|
<Timeline
|
|
|
|
:sports="sports"
|
|
|
|
:user="authUser"
|
|
|
|
:class="{ 'is-hidden': !(isSelected === 'timeline') }"
|
|
|
|
/>
|
2021-08-21 18:47:35 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-09-29 20:16:04 +02:00
|
|
|
<div id="bottom" />
|
2021-07-25 13:34:44 +02:00
|
|
|
</div>
|
2021-10-05 19:52:24 +02:00
|
|
|
<div v-else class="app-loading">
|
|
|
|
<Loader />
|
|
|
|
</div>
|
2021-07-25 13:34:44 +02:00
|
|
|
</template>
|
2021-08-18 17:10:16 +02:00
|
|
|
|
|
|
|
<script lang="ts">
|
2021-09-29 18:41:51 +02:00
|
|
|
import {
|
|
|
|
ComputedRef,
|
|
|
|
Ref,
|
|
|
|
computed,
|
|
|
|
defineComponent,
|
|
|
|
ref,
|
|
|
|
onUnmounted,
|
|
|
|
} from 'vue'
|
2021-08-18 17:10:16 +02:00
|
|
|
|
2021-10-13 09:57:48 +02:00
|
|
|
import Timeline from '@/components/Dashboard/Timeline.vue'
|
2021-09-05 17:43:14 +02:00
|
|
|
import UserCalendar from '@/components/Dashboard/UserCalendar/index.vue'
|
2021-09-20 18:23:05 +02:00
|
|
|
import UserMonthStats from '@/components/Dashboard/UserMonthStats.vue'
|
2021-09-22 10:39:25 +02:00
|
|
|
import UserRecords from '@/components/Dashboard/UserRecords/index.vue'
|
2021-09-25 11:28:40 +02:00
|
|
|
import UserStatsCards from '@/components/Dashboard/UserStatsCards/index.vue'
|
2021-09-28 09:10:01 +02:00
|
|
|
import { SPORTS_STORE, USER_STORE, WORKOUTS_STORE } from '@/store/constants'
|
2021-09-27 13:06:17 +02:00
|
|
|
import { ISport } from '@/types/sports'
|
2021-10-30 12:01:55 +02:00
|
|
|
import { IUserProfile } from '@/types/user'
|
2021-08-18 17:10:16 +02:00
|
|
|
import { useStore } from '@/use/useStore'
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'Dashboard',
|
|
|
|
components: {
|
2021-08-21 18:47:35 +02:00
|
|
|
Timeline,
|
|
|
|
UserCalendar,
|
2021-09-20 18:23:05 +02:00
|
|
|
UserMonthStats,
|
2021-09-22 10:39:25 +02:00
|
|
|
UserRecords,
|
2021-09-08 18:54:22 +02:00
|
|
|
UserStatsCards,
|
2021-08-18 17:10:16 +02:00
|
|
|
},
|
|
|
|
setup() {
|
|
|
|
const store = useStore()
|
2021-10-30 12:01:55 +02:00
|
|
|
const authUser: ComputedRef<IUserProfile> = computed(
|
2021-08-18 17:10:16 +02:00
|
|
|
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
|
|
|
|
)
|
2021-09-27 13:06:17 +02:00
|
|
|
const sports: ComputedRef<ISport[]> = computed(
|
|
|
|
() => store.getters[SPORTS_STORE.GETTERS.SPORTS]
|
|
|
|
)
|
2021-09-29 18:41:51 +02:00
|
|
|
const isSelected: Ref<string> = ref('chart')
|
2021-09-28 09:10:01 +02:00
|
|
|
onUnmounted(() => {
|
|
|
|
store.commit(WORKOUTS_STORE.MUTATIONS.EMPTY_WORKOUTS)
|
|
|
|
})
|
2021-09-29 18:41:51 +02:00
|
|
|
|
|
|
|
function updateDisplayColumn(target: string) {
|
|
|
|
isSelected.value = target
|
|
|
|
}
|
|
|
|
|
|
|
|
return { authUser, sports, isSelected, updateDisplayColumn }
|
2021-08-18 17:10:16 +02:00
|
|
|
},
|
|
|
|
})
|
|
|
|
</script>
|
2021-08-21 18:47:35 +02:00
|
|
|
|
2021-09-20 12:18:40 +02:00
|
|
|
<style lang="scss" scoped>
|
2021-08-21 18:47:35 +02:00
|
|
|
@import '~@/scss/base';
|
2021-09-29 18:41:51 +02:00
|
|
|
#dashboard {
|
2021-09-29 20:16:04 +02:00
|
|
|
padding-bottom: 30px;
|
2021-09-05 09:41:39 +02:00
|
|
|
.dashboard-container {
|
|
|
|
display: flex;
|
2021-09-29 18:41:51 +02:00
|
|
|
flex-direction: row;
|
|
|
|
|
|
|
|
.dashboard-sub-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
}
|
|
|
|
|
2021-09-05 09:41:39 +02:00
|
|
|
.left-container {
|
2021-09-29 18:41:51 +02:00
|
|
|
width: 32%;
|
2021-09-05 09:41:39 +02:00
|
|
|
}
|
2021-09-29 18:41:51 +02:00
|
|
|
|
2021-09-05 09:41:39 +02:00
|
|
|
.right-container {
|
2021-09-29 18:41:51 +02:00
|
|
|
width: 68%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.mobile-menu {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2021-10-02 16:16:58 +02:00
|
|
|
@media screen and (max-width: $medium-limit) {
|
2021-10-01 17:40:58 +02:00
|
|
|
padding-bottom: 60px;
|
2021-09-29 18:41:51 +02:00
|
|
|
.dashboard-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
.left-container {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.right-container {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.mobile-menu {
|
|
|
|
display: flex;
|
2021-10-05 19:02:08 +02:00
|
|
|
.box {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
padding: 0;
|
2021-09-29 18:41:51 +02:00
|
|
|
width: 100%;
|
2021-10-05 19:02:08 +02:00
|
|
|
|
|
|
|
.mobile-menu-item {
|
2021-09-29 18:41:51 +02:00
|
|
|
display: flex;
|
2021-10-05 19:02:08 +02:00
|
|
|
justify-content: space-around;
|
|
|
|
border: none;
|
|
|
|
border-radius: $border-radius;
|
|
|
|
box-shadow: none;
|
|
|
|
font-size: 0.95em;
|
|
|
|
padding: $default-padding;
|
|
|
|
width: 25%;
|
2021-09-29 18:41:51 +02:00
|
|
|
|
2021-10-05 19:02:08 +02:00
|
|
|
.fa-trophy {
|
|
|
|
color: var(--app-color);
|
|
|
|
}
|
|
|
|
&.is-selected {
|
2021-09-29 18:41:51 +02:00
|
|
|
.fa-trophy {
|
|
|
|
color: var(--mobile-menu-selected-color);
|
|
|
|
}
|
2021-10-05 19:02:08 +02:00
|
|
|
color: var(--mobile-menu-selected-color);
|
|
|
|
background-color: var(--mobile-menu-selected-bgcolor);
|
2021-09-29 18:41:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.is-hidden {
|
|
|
|
display: none;
|
2021-09-05 09:41:39 +02:00
|
|
|
}
|
|
|
|
}
|
2021-08-21 18:47:35 +02:00
|
|
|
}
|
|
|
|
</style>
|