-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb1c8b5
commit a8989c6
Showing
5 changed files
with
71 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,22 @@ | ||
<template> | ||
<HomeScreenCard :title="'homescreen.deadlines'"> | ||
<DeadlineItem | ||
v-for="deadline in deadlines" | ||
:deadline="deadline" | ||
:key="deadline.project.id" | ||
/> | ||
<DeadlineItem v-for="project in filteredProjects" :project="project" :key="project.id" /> | ||
</HomeScreenCard> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import HomeScreenCard from "@/components/home/cards/HomeScreenCard.vue"; | ||
import DeadlineItem from "@/components/home/listcontent/DeadlineItem.vue"; | ||
import { type Deadline } from "@/models/Project"; | ||
import { useProjectsQuery } from "@/queries/Project"; | ||
import { computed } from "vue"; | ||
const { data: projects } = useProjectsQuery(); | ||
const deadlines = computed<Deadline[]>(() => { | ||
const filteredProjects = computed(() => { | ||
if (!projects.value) return []; | ||
return ( | ||
[...projects.value.as_student, ...projects.value.as_instructor] | ||
.filter((project) => project.deadline > new Date()) | ||
.sort((a, b) => a.deadline.getTime() - b.deadline.getTime()) | ||
.slice(0, 5) | ||
.map((project) => ({ | ||
project, | ||
status: "none", | ||
})) || [] | ||
); | ||
return [...projects.value.as_student, ...projects.value.as_instructor] | ||
.filter((project) => project.deadline > new Date()) | ||
.sort((a, b) => a.deadline.getTime() - b.deadline.getTime()) | ||
.slice(0, 5); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters