Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix no projects found, more styling, filterbuttons #159

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions frontend/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export default {
group: "Group {number}",
assignment: "Assignment:",
myProject: "My projects:",
not_found: "No projects found.",
archived: "Archived",
not_finished: "Not Finished"
},
navigation: {
home: "Home",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/i18n/locales/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export default {
group: "Groep {number}",
assignment: "Opdracht:",
myProject: "Mijn projecten:",
not_found: "Geen projecten teruggevonden.",
archived: "Gearchiveerd",
not_finished: "Onafgewerkt",
},
navigation: {
home: "Hoofdscherm",
Expand Down
69 changes: 58 additions & 11 deletions frontend/src/views/ProjectsView.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,73 @@
<template>
<h1 v-if="isLoading" class="welcome">{{ $t("default.loading.loading_page") }}</h1>
<h1 v-else-if="isError" class="welcome">No projects found!</h1>
<div v-else class="projectInfo">
<h1>{{ $t("project.myProject") }}</h1>
<ProjectMiniCard
v-for="project in projects"
:key="project.id"
:project="project"
class="project-card"
/>
<div>
<v-container>
<h1 v-if="isLoading" class="welcome">{{ $t("default.loading.loading_page") }}</h1>
<h1 v-else-if="isError || noProjectsFound" class="welcome"> {{ $t("project.not_found")}}</h1>
<div v-else class="projectInfo">
<v-row class="rowheader">
<h1>{{ $t("project.myProject") }}</h1>
<v-btn-toggle v-model="activeButton">
<v-btn value="archived" class="leftbuttonspace">{{ $t("project.archived") }}</v-btn>
<v-btn value="notFinished" class="leftbuttonspace">{{ $t("project.not_finished") }}</v-btn>
</v-btn-toggle>
</v-row>
<ProjectMiniCard
v-for="project in filteredProjects"
:key="project.id"
:project="project"
class="project-card"
/>
</div>
</v-container>
</div>
</template>

<script setup lang="ts">
import { useProjectsQuery } from "@/queries/Project";
import ProjectMiniCard from "@/components/project/ProjectMiniCard.vue";
import {computed, ref, watch} from "vue";

Check warning on line 28 in frontend/src/views/ProjectsView.vue

View workflow job for this annotation

GitHub Actions / Run linters

'watch' is defined but never used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

watch wordt nooit gebruikt

import Project from "@/models/Project";

const { data: projects, isLoading, isError } = useProjectsQuery();
const noProjectsFound = computed(() => projects.value.length === 0);

const activeButton = ref(null);

const filteredProjects = computed(() => {
if (!projects.value) return [];

const now = new Date();
switch (activeButton.value) {
case "archived":
return projects.value.slice().filter((project: Project) => {
return new Date(project.deadline) < now;
});
case "notFinished":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in de toekomst hier ook projecten uitfilteren die al een submission hebben met status Accepted

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is da nodig? mss wil je nog nieuwe submission maken?

return projects.value.slice().filter((project: Project) => {
return new Date(project.deadline) > now;
});
default:
return projects.value;
}
});

</script>

<style scoped>
.project-card {
margin-top: 10px; /* Adjust as needed */
margin-top: 10px;
}

.projectInfo {
padding: 10px;
}

.rowheader {
padding: 10px;
}

.leftbuttonspace {
margin-left: 10px;
}

</style>
Loading