Skip to content

Commit

Permalink
Glob import fix (#285)
Browse files Browse the repository at this point in the history
* fix: glob imports

* chore: linting
  • Loading branch information
EwoutV authored and DeLany123 committed Apr 15, 2024
1 parent b9d3a2a commit 3aa658f
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions frontend/src/components/projects/ProjectList.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
<script setup lang="ts">
import { type Course } from '@/types/Course.ts';
import { computed, ref, watch } from 'vue';
import { computed, watch } from 'vue';
import { useProject } from '@/composables/services/project.service.ts';
import ProjectCard from '@/components/projects/ProjectCard.vue';
import { useI18n } from 'vue-i18n';
import moment from 'moment';
import Skeleton from 'primevue/skeleton';
import InputSwitch from 'primevue/inputswitch';
/* Props */
const props = withDefaults(
defineProps<{
courses: Course[] | null;
showPast?: boolean;
cols?: number;
}>(),
{
courses: () => [],
showPast: false,
cols: 4,
},
);
Expand All @@ -25,7 +26,6 @@ const { t } = useI18n();
const { projects, getProjectsByCourse } = useProject();
/* State */
const showPast = ref(false);
// The merged projects from all courses
const allProjects = computed(() => props.courses?.flatMap((course) => course.projects) ?? null);
Expand All @@ -35,7 +35,7 @@ const allProjects = computed(() => props.courses?.flatMap((course) => course.pro
*/
const sortedProjects = computed(() => {
const projects =
allProjects.value?.filter((project) => (!showPast.value ? moment(project.deadline).isAfter() : true)) ?? null;
allProjects.value?.filter((project) => (!props.showPast ? moment(project.deadline).isAfter() : true)) ?? null;
if (projects === null) {
return projects;
Expand Down Expand Up @@ -70,19 +70,11 @@ watch(
</script>

<template>
<!-- Show past projects switch -->
<div class="flex gap-3 align-items-center mb-5">
<InputSwitch input-id="show-past" v-model="showPast" />
<label for="show-past">
{{ t('views.dashboard.showPastProjects') }}
</label>
</div>
<!-- Project list -->
<div class="grid align-items-stretch">
<template v-if="sortedProjects !== null">
<template v-if="sortedProjects.length > 0">
<div
class="col-12 md:col-6"
class="col-12 md:col-6 lg:col-4"
:class="'xl:col-' + 12 / cols"
v-for="project in sortedProjects"
:key="project.id"
Expand Down

0 comments on commit 3aa658f

Please sign in to comment.