Skip to content

Commit

Permalink
chore: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutV committed Apr 10, 2024
1 parent 32a15da commit bba01c7
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
4 changes: 1 addition & 3 deletions frontend/src/components/courses/CourseDetailCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ defineProps<{
/* Composable injections */
const { t } = useI18n();
const { getRandomImport } = useGlob(
import.meta.glob('@/assets/img/placeholders/*.png', { eager: true })
);
const { getRandomImport } = useGlob(import.meta.glob('@/assets/img/placeholders/*.png', { eager: true }));
</script>

<template>
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/components/courses/CourseGeneralCard.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import StudentCourseJoinButton from '@/components/courses/students/StudentCourseJoinButton.vue';
import type { Course } from '@/types/Course.ts';
import { type Faculty } from '@/types/Faculty.ts';
import { useAuthStore } from '@/store/authentication.store.ts';
import { storeToRefs } from 'pinia';
import { type Student } from '@/types/users/Student.ts';
Expand All @@ -16,9 +15,7 @@ defineProps<{
const { user } = storeToRefs(useAuthStore());
/* State */
const { getImport } = useGlob(
import.meta.glob('@/assets/img/faculties/*.png', { eager: true })
);
const { getImport } = useGlob(import.meta.glob('@/assets/img/faculties/*.png', { eager: true }));
</script>

<template>
Expand Down
25 changes: 16 additions & 9 deletions frontend/src/components/projects/ProjectList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const props = withDefaults(
{
courses: () => [],
showPast: false,
cols: 4
cols: 4,
},
);
Expand All @@ -34,17 +34,14 @@ const allProjects = computed(() => props.courses?.flatMap((course) => course.pro
* Sorts the projects by deadline
*/
const sortedProjects = computed(() => {
const projects = allProjects.value?.filter((project) =>
!props.showPast ? moment(project.deadline).isAfter() : true,
) ?? null;
const projects =
allProjects.value?.filter((project) => (!props.showPast ? moment(project.deadline).isAfter() : true)) ?? null;
if (projects === null) {
return projects;
}
return [...projects].sort((a, b) =>
new Date(a.deadline).getTime() - new Date(b.deadline).getTime()
);
return [...projects].sort((a, b) => new Date(a.deadline).getTime() - new Date(b.deadline).getTime());
});
/* Watchers */
Expand Down Expand Up @@ -76,8 +73,18 @@ watch(
<div class="grid align-items-stretch">
<template v-if="sortedProjects !== null">
<template v-if="sortedProjects.length > 0">
<div class="col-12 md:col-6 lg:col-4" :class="'xl:col-' + 12 / cols" v-for="project in sortedProjects" :key="project.id">
<ProjectCard class="h-100" :project="project" :course="project.course" v-if="project.course !== null" />
<div
class="col-12 md:col-6 lg:col-4"
:class="'xl:col-' + 12 / cols"
v-for="project in sortedProjects"
:key="project.id"
>
<ProjectCard
class="h-100"
:project="project"
:course="project.course"
v-if="project.course !== null"
/>
</div>
</template>
<template v-else>
Expand Down
11 changes: 6 additions & 5 deletions frontend/src/composables/glob.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export type GlobModule = {
export interface GlobModule {
default: any;
}

export type GlobState = {
export interface GlobState {
getRandomImport: () => any;
getImport: (key: string) => any;
}
Expand Down Expand Up @@ -36,6 +36,7 @@ export function useGlob(glob: Record<string, GlobModule>): GlobState {
}

return {
getRandomImport, getImport
}
}
getRandomImport,
getImport,
};
}
6 changes: 2 additions & 4 deletions frontend/src/views/dashboard/roles/StudentDashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ const { courses, getCoursesByStudent } = useCourses();
const selectedYear = ref(User.getAcademicYear());
const showPast = ref(false);
const filteredCourses = computed(() =>
courses.value?.filter((course) =>
course.academic_startyear === selectedYear.value
) ?? null,
const filteredCourses = computed(
() => courses.value?.filter((course) => course.academic_startyear === selectedYear.value) ?? null,
);
/* Watchers */
Expand Down

0 comments on commit bba01c7

Please sign in to comment.