Client - refactor

This commit is contained in:
Sam
2021-10-30 12:01:55 +02:00
parent b695d665d2
commit 1911b03db5
34 changed files with 73 additions and 73 deletions

View File

@ -68,7 +68,7 @@
TStatisticsFromApi,
IStatisticsParams,
} from '@/types/statistics'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { useStore } from '@/use/useStore'
import { formatStats } from '@/utils/statistics'
@ -83,7 +83,7 @@
required: true,
},
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
chartParams: {
@ -140,7 +140,7 @@
}
function getApiParams(
chartParams: IStatisticsDateParams,
user: IAuthUserProfile
user: IUserProfile
): IStatisticsParams {
return {
from: format(chartParams.start, 'yyyy-MM-dd'),

View File

@ -44,7 +44,7 @@
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
import { WORKOUTS_STORE } from '@/store/constants'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { IWorkout } from '@/types/workouts'
import { useStore } from '@/use/useStore'
@ -60,7 +60,7 @@
required: true,
},
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -37,7 +37,7 @@
import CalendarHeader from '@/components/Dashboard/UserCalendar/CalendarHeader.vue'
import { WORKOUTS_STORE } from '@/store/constants'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { IWorkout, IWorkoutsPayload } from '@/types/workouts'
import { useStore } from '@/use/useStore'
import { getCalendarStartAndEnd } from '@/utils/dates'
@ -55,7 +55,7 @@
required: true,
},
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -21,7 +21,7 @@
import StatChart from '@/components/Common/StatsChart/index.vue'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
export default defineComponent({
name: 'UserMonthStats',
@ -34,7 +34,7 @@
required: true,
},
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -24,7 +24,7 @@
import RecordsCard from '@/components/Dashboard/UserRecords/RecordsCard.vue'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { getRecordsBySports } from '@/utils/records'
import { translateSports } from '@/utils/sports'
@ -39,7 +39,7 @@
required: true,
},
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -28,7 +28,7 @@
import { useI18n } from 'vue-i18n'
import StatCard from '@/components/Common/StatCard.vue'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
export default defineComponent({
name: 'UserStatsCards',
@ -37,7 +37,7 @@
},
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -84,7 +84,7 @@
import UserPicture from '@/components/User/UserPicture.vue'
import { ROOT_STORE, USER_STORE } from '@/store/constants'
import { IDropdownOption } from '@/types/forms'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { useStore } from '@/use/useStore'
import { getApiUrl } from '@/utils'
@ -101,7 +101,7 @@
const availableLanguages = availableLocales.map((l) => {
return { label: l.toUpperCase(), value: l }
})
const authUser: ComputedRef<IAuthUserProfile> = computed(
const authUser: ComputedRef<IUserProfile> = computed(
() => store.getters[USER_STORE.GETTERS.AUTH_USER_PROFILE]
)
const isAuthenticated: ComputedRef<boolean> = computed(

View File

@ -36,7 +36,7 @@
import SportsMenu from '@/components/Statistics/StatsSportsMenu.vue'
import { ISport, ITranslatedSport } from '@/types/sports'
import { IStatisticsDateParams } from '@/types/statistics'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { translateSports } from '@/utils/sports'
import { getStatsDateParams, updateChartParams } from '@/utils/statistics'
@ -53,7 +53,7 @@
required: true,
},
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -31,7 +31,7 @@
import { PropType, computed, defineComponent } from 'vue'
import UserPicture from '@/components/User/UserPicture.vue'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { getApiUrl } from '@/utils'
export default defineComponent({
@ -41,7 +41,7 @@
},
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -29,13 +29,13 @@
import { format } from 'date-fns'
import { PropType, computed, defineComponent } from 'vue'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
export default defineComponent({
name: 'UserInfos',
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -20,13 +20,13 @@
<script lang="ts">
import { PropType, computed, defineComponent } from 'vue'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
export default defineComponent({
name: 'UserPreferences',
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -13,7 +13,7 @@
import UserHeader from '@/components/User/ProfileDisplay/UserHeader.vue'
import UserProfileTabs from '@/components/User/UserProfileTabs.vue'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
export default defineComponent({
name: 'ProfileDisplay',
@ -23,7 +23,7 @@
},
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
tab: {

View File

@ -107,14 +107,14 @@
} from 'vue'
import { ROOT_STORE, USER_STORE } from '@/store/constants'
import { IAuthUserProfile, IUserPayload } from '@/types/user'
import { IUserProfile, IUserPayload } from '@/types/user'
import { useStore } from '@/use/useStore'
export default defineComponent({
name: 'UserInfosEdition',
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},
@ -148,7 +148,7 @@
}
})
function updateUserForm(user: IAuthUserProfile) {
function updateUserForm(user: IUserProfile) {
userForm.first_name = user.first_name ? user.first_name : ''
userForm.last_name = user.last_name ? user.last_name : ''
userForm.birth_date = user.birth_date

View File

@ -40,7 +40,7 @@
import UserPicture from '@/components/User/UserPicture.vue'
import { ROOT_STORE, USER_STORE } from '@/store/constants'
import { TAppConfig } from '@/types/application'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { useStore } from '@/use/useStore'
import { getReadableFileSize } from '@/utils/files'
@ -51,7 +51,7 @@
},
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -63,14 +63,14 @@
import { useI18n } from 'vue-i18n'
import { ROOT_STORE, USER_STORE } from '@/store/constants'
import { IAuthUserProfile, IUserPreferencesPayload } from '@/types/user'
import { IUserProfile, IUserPreferencesPayload } from '@/types/user'
import { useStore } from '@/use/useStore'
export default defineComponent({
name: 'UserPreferencesEdition',
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},
@ -108,7 +108,7 @@
}
})
function updateUserForm(user: IAuthUserProfile) {
function updateUserForm(user: IUserProfile) {
userForm.language = user.language ? user.language : 'en'
userForm.timezone = user.timezone ? user.timezone : 'Europe/Paris'
userForm.weekm = user.weekm ? user.weekm : false

View File

@ -22,7 +22,7 @@
import UserProfileTabs from '@/components/User/UserProfileTabs.vue'
import { USER_STORE } from '@/store/constants'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { useStore } from '@/use/useStore'
export default defineComponent({
@ -32,7 +32,7 @@
},
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
tab: {

View File

@ -15,14 +15,14 @@
<script lang="ts">
import { PropType, computed, defineComponent } from 'vue'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { getApiUrl } from '@/utils'
export default defineComponent({
name: 'UserPicture',
props: {
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
},

View File

@ -82,7 +82,7 @@
import StaticMap from '@/components/Common/StaticMap.vue'
import { ROOT_STORE } from '@/store/constants'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { IWorkout } from '@/types/workouts'
import { useStore } from '@/use/useStore'
import { getApiUrl } from '@/utils'
@ -99,7 +99,7 @@
required: false,
},
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
sport: {

View File

@ -42,7 +42,7 @@
import { LineChart, useLineChart } from 'vue-chart-3'
import { useI18n } from 'vue-i18n'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import {
IWorkoutChartData,
IWorkoutData,
@ -57,7 +57,7 @@
},
props: {
authUser: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
workoutData: {

View File

@ -43,7 +43,7 @@
import WorkoutMap from '@/components/Workout/WorkoutDetail/WorkoutMap.vue'
import { WORKOUTS_STORE } from '@/store/constants'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import {
IWorkout,
IWorkoutData,
@ -63,7 +63,7 @@
},
props: {
authUser: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
displaySegment: {

View File

@ -222,7 +222,7 @@
import { ROOT_STORE, WORKOUTS_STORE } from '@/store/constants'
import { TAppConfig } from '@/types/application'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { IWorkout, IWorkoutForm } from '@/types/workouts'
import { useStore } from '@/use/useStore'
import { formatWorkoutDate, getDateWithTZ } from '@/utils/dates'
@ -233,7 +233,7 @@
name: 'WorkoutEdition',
props: {
authUser: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
isCreation: {

View File

@ -139,14 +139,14 @@
import { useI18n } from 'vue-i18n'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { translateSports } from '@/utils/sports'
export default defineComponent({
name: 'WorkoutsFilters',
props: {
authUser: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
sports: {

View File

@ -118,7 +118,7 @@
import NoWorkouts from '@/components/Workouts/NoWorkouts.vue'
import { WORKOUTS_STORE } from '@/store/constants'
import { ITranslatedSport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import { IUserProfile } from '@/types/user'
import { IWorkout } from '@/types/workouts'
import { useStore } from '@/use/useStore'
import { getDateWithTZ } from '@/utils/dates'
@ -135,7 +135,7 @@
required: true,
},
user: {
type: Object as PropType<IAuthUserProfile>,
type: Object as PropType<IUserProfile>,
required: true,
},
sports: {