diff --git a/frontend/src/components/BackgroundContainer.vue b/frontend/src/components/BackgroundContainer.vue index b9623d9a..0ea05c3b 100644 --- a/frontend/src/components/BackgroundContainer.vue +++ b/frontend/src/components/BackgroundContainer.vue @@ -11,7 +11,6 @@ padding: 20px; height: 100vh; border: 25px solid white; - border-radius: 50px; background-color: var(--color-secondary); } diff --git a/frontend/src/components/buttons/HeaderSubtitleButton.vue b/frontend/src/components/buttons/HeaderSubtitleButton.vue index f622ccb6..ba34d3a3 100644 --- a/frontend/src/components/buttons/HeaderSubtitleButton.vue +++ b/frontend/src/components/buttons/HeaderSubtitleButton.vue @@ -25,10 +25,19 @@ defineProps<{ diff --git a/frontend/src/components/subject/body/projects/SubjectProjectPage.vue b/frontend/src/components/subject/body/projects/SubjectProjectPage.vue deleted file mode 100644 index 84d96ea7..00000000 --- a/frontend/src/components/subject/body/projects/SubjectProjectPage.vue +++ /dev/null @@ -1,129 +0,0 @@ - - - - - diff --git a/frontend/src/components/subject/extra/SubjectIcon.vue b/frontend/src/components/subject/extra/SubjectIcon.vue new file mode 100644 index 00000000..8dcd8a83 --- /dev/null +++ b/frontend/src/components/subject/extra/SubjectIcon.vue @@ -0,0 +1,26 @@ + + + + + diff --git a/frontend/src/components/subject/header/SubjectHeaderCard.vue b/frontend/src/components/subject/header/SubjectHeaderCard.vue deleted file mode 100644 index e368af31..00000000 --- a/frontend/src/components/subject/header/SubjectHeaderCard.vue +++ /dev/null @@ -1,63 +0,0 @@ - - - - - diff --git a/frontend/src/components/subject/header/SubjectHeaderContainer.vue b/frontend/src/components/subject/header/SubjectHeaderContainer.vue deleted file mode 100644 index c3953968..00000000 --- a/frontend/src/components/subject/header/SubjectHeaderContainer.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/frontend/src/components/subject/header/SubjectHeaderImage.vue b/frontend/src/components/subject/header/SubjectHeaderImage.vue deleted file mode 100644 index 2f079900..00000000 --- a/frontend/src/components/subject/header/SubjectHeaderImage.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/frontend/src/components/subject/subjectsview/SubjectCard.vue b/frontend/src/components/subject/subjectsview/SubjectCard.vue new file mode 100644 index 00000000..8701fce1 --- /dev/null +++ b/frontend/src/components/subject/subjectsview/SubjectCard.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/frontend/src/components/subject/subjectsview/SubjectsHeaderCard.vue b/frontend/src/components/subject/subjectsview/SubjectsHeaderCard.vue new file mode 100644 index 00000000..c70bb20e --- /dev/null +++ b/frontend/src/components/subject/subjectsview/SubjectsHeaderCard.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/frontend/src/components/subject/subjectsview/SubjectsHeaderContainer.vue b/frontend/src/components/subject/subjectsview/SubjectsHeaderContainer.vue new file mode 100644 index 00000000..6aa0eb17 --- /dev/null +++ b/frontend/src/components/subject/subjectsview/SubjectsHeaderContainer.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/frontend/src/components/subject/subjectsview/SubjectsHeaderImage.vue b/frontend/src/components/subject/subjectsview/SubjectsHeaderImage.vue new file mode 100644 index 00000000..1be93d63 --- /dev/null +++ b/frontend/src/components/subject/subjectsview/SubjectsHeaderImage.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/frontend/src/components/subject/body/SubjectBody.vue b/frontend/src/components/subject/subjectview/body/SubjectBody.vue similarity index 68% rename from frontend/src/components/subject/body/SubjectBody.vue rename to frontend/src/components/subject/subjectview/body/SubjectBody.vue index da4a6632..bc04c9c6 100644 --- a/frontend/src/components/subject/body/SubjectBody.vue +++ b/frontend/src/components/subject/subjectview/body/SubjectBody.vue @@ -14,31 +14,26 @@ - + - - - diff --git a/frontend/src/components/subject/body/groups/SubjectGroupsPage.vue b/frontend/src/components/subject/subjectview/body/groups/SubjectGroupsPage.vue similarity index 100% rename from frontend/src/components/subject/body/groups/SubjectGroupsPage.vue rename to frontend/src/components/subject/subjectview/body/groups/SubjectGroupsPage.vue diff --git a/frontend/src/components/subject/subjectview/body/projects/SubjectProjectPage.vue b/frontend/src/components/subject/subjectview/body/projects/SubjectProjectPage.vue new file mode 100644 index 00000000..a039d150 --- /dev/null +++ b/frontend/src/components/subject/subjectview/body/projects/SubjectProjectPage.vue @@ -0,0 +1,174 @@ + + + + + diff --git a/frontend/src/components/subject/body/projects/SubjectProjectsPage.vue b/frontend/src/components/subject/subjectview/body/projects/SubjectProjectsPage.vue similarity index 80% rename from frontend/src/components/subject/body/projects/SubjectProjectsPage.vue rename to frontend/src/components/subject/subjectview/body/projects/SubjectProjectsPage.vue index 0688227b..b84a79ec 100644 --- a/frontend/src/components/subject/body/projects/SubjectProjectsPage.vue +++ b/frontend/src/components/subject/subjectview/body/projects/SubjectProjectsPage.vue @@ -4,7 +4,6 @@ @@ -12,20 +11,19 @@
-

No projects available.

+

{{ $t("subject.projectsPage.no_projects") }}

@@ -34,15 +32,14 @@ @@ -81,7 +79,6 @@ const updateFilterOption = (option: FilterOptions) => { align-items: center; height: 400px; /* Adjust height as needed */ border: 1px solid #ccc; - border-radius: 8px; } .placeholder p { diff --git a/frontend/src/components/subject/body/projects/list/SubjectProjectsList.vue b/frontend/src/components/subject/subjectview/body/projects/list/SubjectProjectsList.vue similarity index 53% rename from frontend/src/components/subject/body/projects/list/SubjectProjectsList.vue rename to frontend/src/components/subject/subjectview/body/projects/list/SubjectProjectsList.vue index 7893885a..ffc25f33 100644 --- a/frontend/src/components/subject/body/projects/list/SubjectProjectsList.vue +++ b/frontend/src/components/subject/subjectview/body/projects/list/SubjectProjectsList.vue @@ -1,53 +1,45 @@ + + diff --git a/frontend/src/components/subject/subjectview/header/SubjectHeaderCard.vue b/frontend/src/components/subject/subjectview/header/SubjectHeaderCard.vue new file mode 100644 index 00000000..d054fb30 --- /dev/null +++ b/frontend/src/components/subject/subjectview/header/SubjectHeaderCard.vue @@ -0,0 +1,78 @@ + + + + + diff --git a/frontend/src/components/subject/subjectview/header/SubjectHeaderContainer.vue b/frontend/src/components/subject/subjectview/header/SubjectHeaderContainer.vue new file mode 100644 index 00000000..c3019e11 --- /dev/null +++ b/frontend/src/components/subject/subjectview/header/SubjectHeaderContainer.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/frontend/src/components/subject/subjectview/header/SubjectHeaderImage.vue b/frontend/src/components/subject/subjectview/header/SubjectHeaderImage.vue new file mode 100644 index 00000000..9f5434d7 --- /dev/null +++ b/frontend/src/components/subject/subjectview/header/SubjectHeaderImage.vue @@ -0,0 +1,27 @@ + + + + + diff --git a/frontend/src/components/subjects/SubjectCard.vue b/frontend/src/components/subjects/SubjectCard.vue deleted file mode 100644 index 2e125cf0..00000000 --- a/frontend/src/components/subjects/SubjectCard.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - - - diff --git a/frontend/src/components/subjects/SubjectsHeaderCard.vue b/frontend/src/components/subjects/SubjectsHeaderCard.vue deleted file mode 100644 index 4734454b..00000000 --- a/frontend/src/components/subjects/SubjectsHeaderCard.vue +++ /dev/null @@ -1,56 +0,0 @@ - - - - - diff --git a/frontend/src/components/subjects/SubjectsHeaderContainer.vue b/frontend/src/components/subjects/SubjectsHeaderContainer.vue deleted file mode 100644 index 399c2d3d..00000000 --- a/frontend/src/components/subjects/SubjectsHeaderContainer.vue +++ /dev/null @@ -1,13 +0,0 @@ - - - - - diff --git a/frontend/src/composables/useAcademicYear.ts b/frontend/src/composables/useAcademicYear.ts new file mode 100644 index 00000000..e772df24 --- /dev/null +++ b/frontend/src/composables/useAcademicYear.ts @@ -0,0 +1,14 @@ +export default function useAcademicYear(): number { + const currentDate = new Date(); + const currentYear = currentDate.getFullYear(); + const currentMonth = currentDate.getMonth(); + const currentDay = currentDate.getDate(); + + // If the current date is before September 15, the default selected academic year is the current year. + // Otherwise, the academic year is the next year. + if (currentMonth < 8 || (currentMonth === 8 && currentDay < 15)) { + return currentYear - 1 - 2000; + } else { + return currentYear - 2000; + } +} diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index 5f96584b..bbbc32c4 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -2,6 +2,7 @@ export default { default: { error: { "not-found": "Page not found", + "something-went-wrong": "Something went wrong", }, loading: { loading_page: "Loading...", @@ -99,15 +100,29 @@ export default { all: "All", active: "Active", completed: "Completed", + no_projects: "No projects found.", + show_assignment: "Show more", + hide_assignment: "Hide less", }, project: { assignment: "Assignment", group: "Group", submissions: "Submissions", }, + create_project: "Create project", + register_link_button: { + title: "Register link", + snackbar: "Register link copied to clipboard.", + tooltip: + "Copy register link for this subject, this can be shared with students to register for the subject.", + }, }, subjects: { title: "My Subjects", + create_subject: "Create subject", + instructor_subjects: "Show instructor subjects", + student_subjects: "Show student subjects", + no_subjects: "No subjects found.", }, group: { not_found: "Group not found", diff --git a/frontend/src/i18n/locales/nl.ts b/frontend/src/i18n/locales/nl.ts index 1fbb25a7..539076f5 100644 --- a/frontend/src/i18n/locales/nl.ts +++ b/frontend/src/i18n/locales/nl.ts @@ -2,6 +2,7 @@ export default { default: { error: { "not-found": "Pagina niet gevonden", + "something-went-wrong": "Er is iets misgegaan", }, loading: { loading_page: "Aan het laden...", @@ -99,16 +100,30 @@ export default { all: "Alle", active: "Actief", completed: "Voltooid", + no_projects: "Geen projecten gevonden.", + show_assignment: "Meer", + hide_assignment: "Minder", }, project: { assignment: "Opdracht", group: "Groep", submissions: "Indieningen", }, + create_project: "Nieuw project", + register_link_button: { + title: "Registratie link", + snackbar: "Registratie link gekopieerd naar klembord.", + tooltip: + "Kopieer de registratie link voor dit vak, deze kan gedeeld worden met studenten om zich te registreren voor het vak.", + }, }, subjects: { title: "Mijn vakken", + create_subject: "Nieuw vak", + instructor_subjects: "Toon lesgever vakken", + student_subjects: "Toon student vakken", + no_subjects: "Geen vakken gevonden.", }, group: { not_found: "Groep niet gevonden", diff --git a/frontend/src/models/Project.ts b/frontend/src/models/Project.ts index 5c747825..fa72c285 100644 --- a/frontend/src/models/Project.ts +++ b/frontend/src/models/Project.ts @@ -28,6 +28,6 @@ export interface Deadline { export enum FilterOptions { All = "All", - Completed = "Completed", Active = "Active", + Completed = "Completed", } diff --git a/frontend/src/models/Subject.ts b/frontend/src/models/Subject.ts index ff6d3ef1..9a391ec4 100644 --- a/frontend/src/models/Subject.ts +++ b/frontend/src/models/Subject.ts @@ -2,7 +2,6 @@ export default interface Subject { id: number; name: string; academic_year: number; - uuid: string; email: string; } @@ -10,3 +9,20 @@ export interface UserSubjectList { as_student: Subject[]; as_instructor: Subject[]; } + +export enum SubjectRole { + Student = "student", + Instructor = "instructor", + Admin = "admin", + None = "none", +} + +export interface SubjectFilter { + showInstructorSubjects: boolean; + showStudentSubjects: boolean; +} + +export interface SubjectDetails { + subjectData: Subject; + role: SubjectRole; +} diff --git a/frontend/src/models/SubjectDetails.ts b/frontend/src/models/SubjectDetails.ts deleted file mode 100644 index b142bc55..00000000 --- a/frontend/src/models/SubjectDetails.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type User from "@/models/User"; -import type Project from "@/models/Project"; - -export default interface SubjectDetails { - id: number; - name: string; - instructors: User[]; - students: User[]; - projects: Project[]; -} diff --git a/frontend/src/queries/Subject.ts b/frontend/src/queries/Subject.ts index e598543f..8ea2f5f0 100644 --- a/frontend/src/queries/Subject.ts +++ b/frontend/src/queries/Subject.ts @@ -9,6 +9,7 @@ import { getSubjectStudents, getSubjectByUuid, registerToSubject, + getSubjectUuid, } from "@/services/subject"; import { getSubjectProjects } from "@/services/project"; import type User from "@/models/User"; @@ -36,6 +37,10 @@ function SUBJECT_PROJECTS_QUERY_KEY(subjectId: number): (string | number)[] { return ["subject", "projects", subjectId]; } +function SUBJECT_UUID_QUERY_KEY(subjectId: number): (string | number)[] { + return ["subject", "uuid", subjectId]; +} + /** * Query composable for fetching a subject by id */ @@ -112,6 +117,16 @@ export function useSubjectProjectsQuery( }); } +export function useUuidSubjectQuery( + subjectId: MaybeRefOrGetter +): UseQueryReturnType { + return useQuery({ + queryKey: computed(() => SUBJECT_UUID_QUERY_KEY(toValue(subjectId)!)), + queryFn: () => getSubjectUuid(toValue(subjectId)!), + enabled: () => !!toValue(subjectId), + }); +} + /** * Mutation composable for registering the current user to a subject */ diff --git a/frontend/src/services/subject.ts b/frontend/src/services/subject.ts index fea50723..328c8e79 100644 --- a/frontend/src/services/subject.ts +++ b/frontend/src/services/subject.ts @@ -48,3 +48,8 @@ export async function registerToSubject(subjectUuid: string): Promise { method: "POST", }); } + +export async function getSubjectUuid(subjectId: number): Promise { + const result = await authorized_fetch(`/api/subjects/${subjectId}/uuid`, { method: "GET" }); + return result.subject_uuid; +} diff --git a/frontend/src/views/subject/SubjectView.vue b/frontend/src/views/subject/SubjectView.vue index 74f570fd..2e05df13 100644 --- a/frontend/src/views/subject/SubjectView.vue +++ b/frontend/src/views/subject/SubjectView.vue @@ -1,48 +1,91 @@ ; - + diff --git a/frontend/src/views/subject/SubjectsView.vue b/frontend/src/views/subject/SubjectsView.vue index 618f412c..a5aec499 100644 --- a/frontend/src/views/subject/SubjectsView.vue +++ b/frontend/src/views/subject/SubjectsView.vue @@ -2,39 +2,139 @@

Error: {{ error }}

-
Loading...
- + - - + + + + + + + + +
+

{{ $t("subjects.no_subjects") }}

+
+ + + +
+
-
- - - - + +
+ + + {{ $t("subjects.create_subject") }} + + +
-
+ - +