Skip to content

Commit

Permalink
fix after merge
Browse files Browse the repository at this point in the history
- apply new ESLint config on files
- Typescript fix 
- fix wrong conflict resolution
  • Loading branch information
SamR1 committed Nov 18, 2023
1 parent 8207885 commit 0acfb93
Show file tree
Hide file tree
Showing 98 changed files with 1,392 additions and 1,570 deletions.
15 changes: 8 additions & 7 deletions fittrackee_client/src/components/Administration/AdminReport.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { Locale, formatDistance } from 'date-fns'
import { formatDistance } from 'date-fns'
import type { Locale } from 'date-fns'
import { computed, onBeforeMount, ref, watch } from 'vue'
import type { ComputedRef, Ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
Expand All @@ -17,10 +18,10 @@
SPORTS_STORE,
USERS_STORE,
} from '@/store/constants'
import { ICustomTextareaData } from '@/types/forms'
import { IReportForAdmin } from '@/types/reports'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import type { ICustomTextareaData } from '@/types/forms'
import type { IReportForAdmin } from '@/types/reports'
import type { ISport } from '@/types/sports'
import type { IAuthUserProfile } from '@/types/user'
import { useStore } from '@/use/useStore'
import { formatDate, getDateFormat } from '@/utils/dates'
Expand Down Expand Up @@ -143,7 +144,7 @@
:title="$t('common.CONFIRMATION')"
message="admin.CONFIRM_USER_ACCOUNT_DEACTIVATION"
:strongMessage="report.reported_user.username"
@confirmAction="updateUserActiveStatus(report.reported_user.username)"
@confirmAction="updateUserActiveStatus"
@cancelAction="updateDisplayModal('')"
@keydown.esc="updateDisplayModal('')"
/>
Expand Down Expand Up @@ -309,7 +310,7 @@
</form>
</div>
<div v-else class="actions-buttons">
<button @click="displayTextArea">
<button @click="displayTextArea()">
{{ $t('admin.APP_MODERATION.ACTIONS.ADD_COMMENT') }}
</button>
<button>
Expand Down
29 changes: 14 additions & 15 deletions fittrackee_client/src/components/Administration/AdminReports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,23 +165,24 @@

<script setup lang="ts">
import {
ComputedRef,
capitalize,
computed,
reactive,
watch,
onBeforeMount,
onUnmounted,
} from 'vue'
import { LocationQuery, useRoute, useRouter } from 'vue-router'
import type { ComputedRef } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import type { LocationQuery } from 'vue-router'
import FilterSelects from '@/components/Common/FilterSelects.vue'
import Pagination from '@/components/Common/Pagination.vue'
import UserPicture from '@/components/User/UserPicture.vue'
import { AUTH_USER_STORE, REPORTS_STORE, ROOT_STORE } from '@/store/constants'
import { IPagination, TPaginationPayload } from '@/types/api'
import { IReport } from '@/types/reports'
import { IAuthUserProfile } from '@/types/user'
import type { IPagination, TPaginationPayload } from '@/types/api'
import type { IReport } from '@/types/reports'
import type { IAuthUserProfile } from '@/types/user'
import { useStore } from '@/use/useStore'
import { getQuery, sortList } from '@/utils/api'
import { formatDate } from '@/utils/dates'
Expand Down Expand Up @@ -219,21 +220,19 @@
function loadReports(queryParams: TPaginationPayload) {
store.dispatch(REPORTS_STORE.ACTIONS.GET_REPORTS, queryParams)
}
function reloadReportsOnTypeChange(
event: Event & { target: HTMLInputElement }
) {
if (event.target.value) {
query.object_type = event.target.value
function reloadReportsOnTypeChange(event: Event) {
const target = event.target as HTMLInputElement
if (target.value) {
query.object_type = target.value
} else {
delete query.object_type
}
router.push({ path: '/admin/reports', query })
}
function reloadReportsOnResolvedChange(
event: Event & { target: HTMLInputElement }
) {
if (event.target.value) {
query.resolved = event.target.value
function reloadReportsOnResolvedChange(event: Event) {
const target = event.target as HTMLInputElement
if (target.value) {
query.resolved = target.value
} else {
delete query.resolved
}
Expand Down
23 changes: 11 additions & 12 deletions fittrackee_client/src/components/Comment/Comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,25 +159,24 @@
</template>

<script setup lang="ts">
import { Locale, formatDistance } from 'date-fns'
import {
ComputedRef,
computed,
toRefs,
onUnmounted,
withDefaults,
watch,
} from 'vue'
import { formatDistance } from 'date-fns'
import type { Locale } from 'date-fns'
import { computed, toRefs, onUnmounted, withDefaults, watch } from 'vue'
import type { ComputedRef } from 'vue'
import { useRoute } from 'vue-router'
import WorkoutCommentEdition from '@/components/Comment/CommentEdition.vue'
import ReportForm from '@/components/Common/ReportForm.vue'
import Username from '@/components/User/Username.vue'
import UserPicture from '@/components/User/UserPicture.vue'
import { REPORTS_STORE, ROOT_STORE, WORKOUTS_STORE } from '@/store/constants'
import { IDisplayOptions } from '@/types/application'
import { IAuthUserProfile, IUserProfile } from '@/types/user'
import { IComment, ICurrentCommentEdition, IWorkout } from '@/types/workouts'
import type { IDisplayOptions } from '@/types/application'
import type { IAuthUserProfile, IUserProfile } from '@/types/user'
import type {
IComment,
ICurrentCommentEdition,
IWorkout,
} from '@/types/workouts'
import { useStore } from '@/use/useStore'
import { formatDate } from '@/utils/dates'
import { linkifyAndClean } from '@/utils/inputs'
Expand Down
13 changes: 9 additions & 4 deletions fittrackee_client/src/components/Comment/CommentEdition.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,18 @@
</template>

<script setup lang="ts">
import { ComputedRef, Ref, computed, onUnmounted, ref, toRefs } from 'vue'
import { computed, onUnmounted, ref, toRefs } from 'vue'
import type { ComputedRef, Ref } from 'vue'
import UserPicture from '@/components/User/UserPicture.vue'
import { ROOT_STORE, USERS_STORE, WORKOUTS_STORE } from '@/store/constants'
import { ICustomTextareaData } from '@/types/forms'
import { IAuthUserProfile, IUserProfile, TPrivacyLevels } from '@/types/user'
import { IComment, ICommentForm, IWorkout } from '@/types/workouts'
import type { ICustomTextareaData } from '@/types/forms'
import type {
IAuthUserProfile,
IUserProfile,
TPrivacyLevels,
} from '@/types/user'
import type { IComment, ICommentForm, IWorkout } from '@/types/workouts'
import { useStore } from '@/use/useStore'
import { getUsernameQuery, replaceUsername } from '@/utils/inputs'
import { getCommentVisibilityLevels } from '@/utils/privacy'
Expand Down
21 changes: 11 additions & 10 deletions fittrackee_client/src/components/Comment/Comments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

<script setup lang="ts">
import {
ComputedRef,
capitalize,
computed,
nextTick,
Expand All @@ -57,14 +56,14 @@
ref,
toRefs,
watch,
withDefaults,
} from 'vue'
import type { ComputedRef } from 'vue'
import { useRoute } from 'vue-router'
import WorkoutCommentEdition from '@/components/Comment/CommentEdition.vue'
import { WORKOUTS_STORE } from '@/store/constants'
import { IAuthUserProfile } from '@/types/user'
import { IComment, IWorkoutData } from '@/types/workouts'
import type { IAuthUserProfile } from '@/types/user'
import type { IComment, IWorkoutData } from '@/types/workouts'
import { useStore } from '@/use/useStore'
interface Props {
Expand Down Expand Up @@ -94,8 +93,8 @@
const isDeleting: ComputedRef<boolean> = computed(
() => workoutData.value.commentsLoading === 'delete'
)
const commentId: ComputedRef<string | null> = computed(
() => route.params.commentId
const commentId: ComputedRef<string> = computed(
() => route.params.commentId as string
)
const timer = ref<number | undefined>()
Expand All @@ -109,11 +108,13 @@
function getComments(): IComment[] {
store.commit(WORKOUTS_STORE.MUTATIONS.SET_COMMENT_LOADING, 'all')
let allComments = []
let allComments: IComment[] = []
if (!withParent.value || !workoutData.value.comments[0].reply_to) {
allComments = workoutData.value.comments
} else {
const replyToComment = Object.assign(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const replyToComment: IComment = Object.assign(
{},
workoutData.value.comments[0].reply_to
)
Expand All @@ -125,7 +126,7 @@
}
function deleteComment() {
const commentToDelete: IComment | null =
const commentToDelete: IComment | undefined =
workoutData.value.currentCommentEdition.comment
if (commentToDelete) {
store.dispatch(WORKOUTS_STORE.ACTIONS.DELETE_WORKOUT_COMMENT, {
Expand All @@ -149,7 +150,7 @@
}
}, 100)
}
function scrollToComment(commentId) {
function scrollToComment(commentId: string) {
timer.value = setTimeout(() => {
const comment = document.getElementById(commentId)
if (comment) {
Expand Down
4 changes: 1 addition & 3 deletions fittrackee_client/src/components/Common/CustomTextArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
name: string
charLimit?: number
disabled?: boolean
input?: string | null
input?: string
required?: boolean
placeholder?: string
}
Expand All @@ -43,9 +43,7 @@
function updateText(event: Event) {
const target = event.target as HTMLInputElement
emit('updateValue', {
value: event.target.value,
value: target.value,
selectionStart: event.target.selectionStart,
selectionStart: target.selectionStart,
})
}
Expand Down
3 changes: 2 additions & 1 deletion fittrackee_client/src/components/Common/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@
interface Props {
title: string
message: string
strongMessage?: string | null
strongMessage?: string
loading?: boolean
}
const props = withDefaults(defineProps<Props>(), {
loading: false,
strongMessage: () => '',
})
Expand Down
5 changes: 3 additions & 2 deletions fittrackee_client/src/components/Common/ReportForm.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script setup lang="ts">
import { computed, ComputedRef, Ref, ref, toRefs } from 'vue'
import { computed, ref, toRefs } from 'vue'
import type { ComputedRef, Ref } from 'vue'
import {
REPORTS_STORE,
ROOT_STORE,
USERS_STORE,
WORKOUTS_STORE,
} from '@/store/constants'
import { ICustomTextareaData } from '@/types/forms'
import type { ICustomTextareaData } from '@/types/forms'
import { useStore } from '@/use/useStore'
interface Props {
Expand Down
44 changes: 22 additions & 22 deletions fittrackee_client/src/components/Common/VisibilityIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
<i
:class="`fa fa-${getPrivacyIcon(visibility)}`"
aria-hidden="true"
:title="$t(`privacy.${isComment ? 'COMMENT_': ''}LEVELS.${visibility}`)"
:title="$t(`privacy.${isComment ? 'COMMENT_' : ''}LEVELS.${visibility}`)"
/>
</div>
</template>

<script setup lang="ts">
import { toRefs, withDefaults } from 'vue'
import { toRefs } from 'vue'
import { TPrivacyLevels } from "@/types/user";
import type { TPrivacyLevels } from '@/types/user'
interface Props {
visibility: TPrivacyLevels,
isComment?: boolean
}
interface Props {
visibility: TPrivacyLevels
isComment?: boolean
}
const props = withDefaults(defineProps<Props>(), {
isComment: false
})
const { visibility, isComment } = toRefs(props)
const props = withDefaults(defineProps<Props>(), {
isComment: false,
})
const { visibility, isComment } = toRefs(props)
function getPrivacyIcon(privacyLevel: TPrivacyLevels): string {
switch (privacyLevel) {
case 'public':
return 'globe'
case 'followers_only':
return 'users'
default:
case 'private':
return 'lock'
function getPrivacyIcon(privacyLevel: TPrivacyLevels): string {
switch (privacyLevel) {
case 'public':
return 'globe'
case 'followers_only':
return 'users'
default:
case 'private':
return 'lock'
}
}
}
</script>
</script>
2 changes: 1 addition & 1 deletion fittrackee_client/src/components/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
)
const isMenuOpen: Ref<boolean> = ref(false)
const displayModal: Ref<boolean> = ref(false)
const hasUnreadNotifications: ComputedRef<string> = computed(
const hasUnreadNotifications: ComputedRef<boolean> = computed(
() => store.getters[NOTIFICATIONS_STORE.GETTERS.UNREAD_STATUS]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
import ReportNotification from '@/components/Notifications/ReportNotification.vue'
import WorkoutCard from '@/components/Workout/WorkoutCard.vue'
import { ROOT_STORE, SPORTS_STORE } from '@/store/constants'
import { INotification, TNotificationType } from '@/types/notifications'
import { ISport } from '@/types/sports'
import { IAuthUserProfile } from '@/types/user'
import type { INotification, TNotificationType } from '@/types/notifications'
import type { ISport } from '@/types/sports'
import type { IAuthUserProfile } from '@/types/user'
import { useStore } from '@/use/useStore'
import { getDateFormat } from '@/utils/dates'
Expand Down
Loading

0 comments on commit 0acfb93

Please sign in to comment.