From 056b2d30fa76df76b048696a91fda0169f833412 Mon Sep 17 00:00:00 2001 From: Joyelle Ndagijimana Date: Mon, 7 Apr 2025 00:01:31 +0200 Subject: [PATCH] feat(frontend): verschillende groepen tonen binnen een assignment --- frontend/src/utils/tempData.ts | 18 +++++ .../views/assignments/SingleAssignment.vue | 70 ++++++++++++++++--- 2 files changed, 77 insertions(+), 11 deletions(-) diff --git a/frontend/src/utils/tempData.ts b/frontend/src/utils/tempData.ts index 918546ac..6a17b64c 100644 --- a/frontend/src/utils/tempData.ts +++ b/frontend/src/utils/tempData.ts @@ -61,6 +61,7 @@ type Assignment = { description: string; }; + export const assignments: Assignment[] = Array.from({length: 4}, (_, i) => ({ id: `assignment${i}`, title: `Assignment ${i}`, @@ -80,6 +81,23 @@ export const assignments: Assignment[] = Array.from({length: 4}, (_, i) => ({ "Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. " + "Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. " + "Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,", + groups: [ + { + id: 'group1', + members: [ + student01, + student02 + ] + }, + { + id: 'group2', + members: [ + student01, + student03 + ] + } + ] })); + export const classes: Array = [class01, class02, class03]; diff --git a/frontend/src/views/assignments/SingleAssignment.vue b/frontend/src/views/assignments/SingleAssignment.vue index 1abfd20f..849b0b53 100644 --- a/frontend/src/views/assignments/SingleAssignment.vue +++ b/frontend/src/views/assignments/SingleAssignment.vue @@ -18,6 +18,18 @@ assignment.value = assignments[0]; }; + const myUsername = "id01"; //TODO: replace by username of logged in user + + + // Display group members + const myGroup = computed(() => { + if (!assignment.value || !assignment.value.groups) return null; + console.log(assignment.value.groups) + return assignment.value.groups.find(group => + group.members.some(m => m.username === myUsername) + ); + }); + const deleteAssignment = () => { console.log('Delete assignment:', assignmentId.value); }; @@ -50,12 +62,6 @@ {{ assignment.title }} - - {{ t('class') }}: - - {{ assignment.class }} - - {{ assignment.description }} + + +

{{ t("group") }}

+ + +
+
+
    +
  • + {{ student.firstName + ' ' + student.lastName}} +
  • +
+
+
+ + +
+ + + + {{ t("group") }} {{ index + 1 }} + + +
    +
  • + {{ student.firstName + ' ' + student.lastName }} +
  • +
+
+
+
+
+
+ @@ -100,14 +143,19 @@ color: red; } -.assignment-class { - color: #666; +.group-section { + margin-top: 2rem; } -.class-name { - font-weight: 500; - color: #333; +.group-section h3 { + margin-bottom: 0.5rem; } +.group-section ul { + padding-left: 1.2rem; + list-style-type: disc; +} + +