Skip to content

Commit

Permalink
Client - minor refacto
Browse files Browse the repository at this point in the history
  • Loading branch information
SamR1 committed Dec 29, 2024
1 parent 648c1b7 commit cca42d6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
import { availableDateFormatOptions } from '@/utils/dates'
import { availableLanguages, languageLabels } from '@/utils/locales'
import {
visibilityLevels,
getAllVisibilityLevels,
getVisibilityLevels,
getUpdatedVisibility,
} from '@/utils/visibility_levels'
Expand Down Expand Up @@ -440,7 +440,9 @@
userForm.language
)
)
const visibilityLevels: ComputedRef<TVisibilityLevels[]> = computed(() =>
getAllVisibilityLevels()
)
const analysisVisibilityLevels: ComputedRef<TVisibilityLevels[]> = computed(
() => getVisibilityLevels(userForm.workouts_visibility)
)
Expand Down
5 changes: 4 additions & 1 deletion fittrackee_client/src/components/Workout/WorkoutEdition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
import { translateSports } from '@/utils/sports'
import { convertDistance } from '@/utils/units'
import {
visibilityLevels,
getAllVisibilityLevels,
getVisibilityLevels,
getUpdatedVisibility,
} from '@/utils/visibility_levels'
Expand Down Expand Up @@ -512,6 +512,9 @@
)
: []
)
const visibilityLevels: ComputedRef<TVisibilityLevels[]> = computed(() =>
getAllVisibilityLevels()
)
const analysisVisibilityLevels: ComputedRef<TVisibilityLevels[]> = computed(
() => getVisibilityLevels(workoutForm.workoutVisibility)
)
Expand Down
8 changes: 3 additions & 5 deletions fittrackee_client/src/utils/visibility_levels.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { TVisibilityLevels } from '@/types/user'

export const visibilityLevels: TVisibilityLevels[] = [
'private',
'followers_only',
'public',
]
export const getAllVisibilityLevels = (): TVisibilityLevels[] => {
return ['private', 'followers_only', 'public']
}

export const getUpdatedVisibility = (
visibility: TVisibilityLevels,
Expand Down

0 comments on commit cca42d6

Please sign in to comment.