diff --git a/frontend/src/app/app.component.less b/frontend/src/app/app.component.less index 0dd5df25..9ff52ae7 100644 --- a/frontend/src/app/app.component.less +++ b/frontend/src/app/app.component.less @@ -1,15 +1,10 @@ main { - height: 100%; - width: 100%; - overflow-y: auto; + height: 100%; + width: 100%; + overflow-y: auto; } ::ng-deep .secondary-mat-card[class] { background-color: #ffffff; color: black; -} - -::ng-deep .secondary-mat-card[class]:hover { - background-color: black; - cursor: pointer; } \ No newline at end of file diff --git a/frontend/src/app/components/assignment/assignment.component.ts b/frontend/src/app/components/assignment/assignment.component.ts index cc326876..e073d651 100644 --- a/frontend/src/app/components/assignment/assignment.component.ts +++ b/frontend/src/app/components/assignment/assignment.component.ts @@ -112,7 +112,6 @@ export class AssignmentComponent implements OnInit { this.submissionStatsReady = false; this.currentLearningObjectId = node.value.metadata.hruid!; this.step = node.value.metadata.step!; - console.log(this.step, this.furthestStep); this.alreadySubmitted = this.step < this.furthestStep; this.fetchTaskAndSubmissions(); } diff --git a/frontend/src/app/components/class-pending-requests/class-pending-requests.component.ts b/frontend/src/app/components/class-pending-requests/class-pending-requests.component.ts index d50aae50..210c7394 100644 --- a/frontend/src/app/components/class-pending-requests/class-pending-requests.component.ts +++ b/frontend/src/app/components/class-pending-requests/class-pending-requests.component.ts @@ -27,15 +27,15 @@ export class ClassPendingRequestsComponent implements OnInit { public joinRequests: JoinRequestWithUser[] = []; // Messages for the snackbar - private readonly acceptedMessage: string = $localize `:@@accepted:Accepted!`; - private readonly rejectedMessage: string = $localize `:@@rejected:Rejected!`; + private readonly acceptedMessage: string = $localize`:@@accepted:Accepted!`; + private readonly rejectedMessage: string = $localize`:@@rejected:Rejected!`; // Snackbar private readonly snackBar = inject(MatSnackBar); public constructor( private joinRequestService: JoinRequestService - ) {} + ) { } /** * Requests the join requests for this class @@ -44,7 +44,7 @@ export class ClassPendingRequestsComponent implements OnInit { public ngOnInit(): void { const classId: string | null = this._class?.id || null; - if(classId) { + if (classId) { // Get all join requests const joinRequests$ = this.joinRequestService.getJoinRequestsForClass(classId); @@ -53,7 +53,6 @@ export class ClassPendingRequestsComponent implements OnInit { // Fill users of those join requests const joinRequestWithUser$ = this.joinRequestService.fillUsers(response); joinRequestWithUser$.subscribe(joinRequests => { - console.log(joinRequests); this.joinRequests = joinRequests; }); }); @@ -68,7 +67,7 @@ export class ClassPendingRequestsComponent implements OnInit { const accepted$ = this.joinRequestService.acceptRequest(requestId); accepted$.subscribe((response) => { - if(response) this.openSnackBar(this.acceptedMessage); + if (response) this.openSnackBar(this.acceptedMessage); window.location.reload(); }); } @@ -80,15 +79,15 @@ export class ClassPendingRequestsComponent implements OnInit { public rejectRequest(requestId: string): void { const rejected$ = this.joinRequestService.rejectRequest(requestId); - rejected$.subscribe((response) => { - if(response) this.openSnackBar(this.rejectedMessage); - window.location.reload(); - }); + rejected$.subscribe((response) => { + if (response) this.openSnackBar(this.rejectedMessage); + window.location.reload(); + }); } - private openSnackBar(message: string, action: string="Ok") { + private openSnackBar(message: string, action: string = "Ok") { this.snackBar.open(message, action, { - duration: 2500 + duration: 2500 }); } diff --git a/frontend/src/app/components/create-assignment/create-assignment.component.html b/frontend/src/app/components/create-assignment/create-assignment.component.html index fbe4b067..bce4ebb7 100644 --- a/frontend/src/app/components/create-assignment/create-assignment.component.html +++ b/frontend/src/app/components/create-assignment/create-assignment.component.html @@ -24,13 +24,19 @@ Class - + @for (class of classes; track class.id) { {{ class.name }} } + @if(!enableCreate){ + + You need students in your class! + + } + @@ -38,7 +44,7 @@ - @@ -52,7 +58,7 @@ } @if(initializeTasks) { - +
Create Tasks for your Assignment! diff --git a/frontend/src/app/components/create-assignment/create-assignment.component.ts b/frontend/src/app/components/create-assignment/create-assignment.component.ts index 9c54eab0..378c9d3a 100644 --- a/frontend/src/app/components/create-assignment/create-assignment.component.ts +++ b/frontend/src/app/components/create-assignment/create-assignment.component.ts @@ -19,6 +19,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { AssignmentComponent } from '../assignment/assignment.component'; import { MatIconModule } from '@angular/material/icon'; import { TaskService } from '../../services/task.service'; +import { MatSnackBar } from '@angular/material/snack-bar'; @Component({ selector: 'app-create-assignment', @@ -37,7 +38,7 @@ import { TaskService } from '../../services/task.service'; MatInputModule, MatDateRangeInput, MatNativeDateModule, - MatButtonModule + MatButtonModule, ], templateUrl: './create-assignment.component.html', styleUrl: './create-assignment.component.less', @@ -48,6 +49,7 @@ export class CreateAssignmentComponent implements OnInit { @Output() showGroups: EventEmitter = new EventEmitter private readonly route = inject(ActivatedRoute); + private readonly snackBar = inject(MatSnackBar); public learningPathId: string = ""; public language: string = "nl"; @@ -62,6 +64,8 @@ export class CreateAssignmentComponent implements OnInit { public assignmentId: string = ''; public classMembers: User[] = []; + public enableCreate: boolean = true; + constructor( private formBuilder: FormBuilder, private classesService: ClassesService, @@ -84,6 +88,12 @@ export class CreateAssignmentComponent implements OnInit { } + checkNonEmpty(classId: string) { + this.classesService.usersInClass(classId).subscribe( + value => this.enableCreate = value.students.length > 0 + ) + } + create(): void { const newAssignment: NewAssignment | null = this.extractFormValues(); @@ -101,6 +111,7 @@ export class CreateAssignmentComponent implements OnInit { } } + private getClasses(): void { this.classesService.classesOfUser().subscribe((response: Class[]) => { this.classes = response; @@ -152,10 +163,10 @@ export class CreateAssignmentComponent implements OnInit { // Initialize all empty tasks with an 'other'-type task without details this.taskService.fillRestWithEmptyTasks(this.assignmentId).subscribe({ next: () => { - console.log($localize`Assignment Created!`); + this.snackBar.open($localize`Assignment Created!`); }, - error: (err) => { - console.error(err); + error: () => { + this.snackBar.open($localize`Something went wrong!`); } }); @@ -164,4 +175,5 @@ export class CreateAssignmentComponent implements OnInit { // we can redirect to assignments page this.router.navigate(['/teacher/assignments']); } + } diff --git a/frontend/src/app/components/create-group/create-group.component.html b/frontend/src/app/components/create-group/create-group.component.html index 17ac05c7..f7442a3a 100644 --- a/frontend/src/app/components/create-group/create-group.component.html +++ b/frontend/src/app/components/create-group/create-group.component.html @@ -5,12 +5,13 @@

Create groups

Here you can divide the members of your class into groups. Drag a member into an existing group or onto the new group. + If you do not wish to assign a student to this assignment, you can keep them into the "Members" section.

Members

diff --git a/frontend/src/app/components/create-group/create-group.component.less b/frontend/src/app/components/create-group/create-group.component.less index 29206ac4..1ebd7393 100644 --- a/frontend/src/app/components/create-group/create-group.component.less +++ b/frontend/src/app/components/create-group/create-group.component.less @@ -4,6 +4,7 @@ align-items: center; justify-content: center; + gap: 20px; } diff --git a/frontend/src/app/components/create-group/create-group.component.ts b/frontend/src/app/components/create-group/create-group.component.ts index 7e63b290..4b64468d 100644 --- a/frontend/src/app/components/create-group/create-group.component.ts +++ b/frontend/src/app/components/create-group/create-group.component.ts @@ -110,11 +110,11 @@ export class CreateGroupComponent { * Make a call to the API to create the made groups. */ public createGroups(): void { - if (this.members.length > 0) { - this.openSnackBar($localize`There are still members not assigned to a group.`); - } else { - const nonEmptyGroups = this.groups.filter(group => group.length > 0); + const nonEmptyGroups = this.groups.filter(group => group.length > 0); + if (nonEmptyGroups.length === 0) { + this.openSnackBar($localize`You need to assign students!.`); + } else { this.groupService.createGroups(nonEmptyGroups, this.assignmentId!) .subscribe((response) => { if (response) { @@ -123,8 +123,10 @@ export class CreateGroupComponent { } else { this.openSnackBar($localize`Failed to create groups.`); } - }) + }); } + + } /** diff --git a/frontend/src/app/components/learning-path/learning-path.component.ts b/frontend/src/app/components/learning-path/learning-path.component.ts index 527efa0f..efb94fbc 100644 --- a/frontend/src/app/components/learning-path/learning-path.component.ts +++ b/frontend/src/app/components/learning-path/learning-path.component.ts @@ -148,7 +148,6 @@ export class LearningPathComponent implements OnInit { const resultNode = this.trajectoryGraph!.nodes[i]; if (resultNode) { this.selectedNode = resultNode; - console.log("in learning path", this.step) this.selectedNodeChanged.emit(resultNode); } else { // First node, navigate back to assignments diff --git a/frontend/src/app/components/manage-codes/manage-codes.component.ts b/frontend/src/app/components/manage-codes/manage-codes.component.ts index abf7e408..2ceb261d 100644 --- a/frontend/src/app/components/manage-codes/manage-codes.component.ts +++ b/frontend/src/app/components/manage-codes/manage-codes.component.ts @@ -34,16 +34,14 @@ export class ManageCodesComponent implements OnInit { public constructor( private activeRoute: ActivatedRoute, private classCodeService: ClassCodeService - ) {} + ) { } public ngOnInit(): void { const id: string | null = this.activeRoute.snapshot.paramMap.get('id'); - console.log(id); + if (id) this._classId = id; - if(id) this._classId = id; - - if(this._classId) { + if (this._classId) { this.classCodeService.getClassCodes(this._classId) .subscribe((codes: Code[]) => { this._codes = codes; @@ -64,7 +62,7 @@ export class ManageCodesComponent implements OnInit { public expireClassCode(code: Code): void { this.classCodeService.expireClassCode(code) .subscribe(response => { - if(!response) { + if (!response) { this.openSnackBar($localize`Could not expire code`); } else { @@ -77,7 +75,7 @@ export class ManageCodesComponent implements OnInit { public deleteClassCode(code: Code): void { this.classCodeService.deleteClassCode(code) .subscribe(response => { - if(!response) { + if (!response) { this.openSnackBar($localize`Could not delete code`); } else { @@ -88,15 +86,15 @@ export class ManageCodesComponent implements OnInit { } public createClassCode(): void { - if(this._classId) this.classCodeService.createClassCode(this._classId) - .subscribe(response => { - if(!response) { - this.openSnackBar($localize`Could not create code`); - } - else { - this.openSnackBar($localize`Code created successfully`); - location.reload(); - }; + if (this._classId) this.classCodeService.createClassCode(this._classId) + .subscribe(response => { + if (!response) { + this.openSnackBar($localize`Could not create code`); + } + else { + this.openSnackBar($localize`Code created successfully`); + location.reload(); + }; }); } @@ -112,9 +110,9 @@ export class ManageCodesComponent implements OnInit { this._codes = codes; } - private openSnackBar(message: string, action: string="Ok") { + private openSnackBar(message: string, action: string = "Ok") { this.snackBar.open(message, action, { - duration: 2500 + duration: 2500 }); } diff --git a/frontend/src/app/components/student-dashboard/student-dashboard.component.html b/frontend/src/app/components/student-dashboard/student-dashboard.component.html index f0aedcd1..2ceebed3 100644 --- a/frontend/src/app/components/student-dashboard/student-dashboard.component.html +++ b/frontend/src/app/components/student-dashboard/student-dashboard.component.html @@ -8,65 +8,50 @@

Your assignments

@if (loadingProgress || loadingGroups) { - - - - + + + + - - + + } @else { - - - - - - - + + + + + + + } - +

Your classes

- View all +
@if (loadingClasses) { - - - - + + + + - - + + } @else { - - + + - - - + + + }
- + \ No newline at end of file diff --git a/frontend/src/app/components/student-dashboard/student-dashboard.component.less b/frontend/src/app/components/student-dashboard/student-dashboard.component.less index 83b44f3c..afc4fbe6 100644 --- a/frontend/src/app/components/student-dashboard/student-dashboard.component.less +++ b/frontend/src/app/components/student-dashboard/student-dashboard.component.less @@ -1,31 +1,31 @@ .main-container { - grid-area: main; - overflow-y: auto; - padding: 20px 20px; - margin: 20px; + grid-area: main; + overflow-y: auto; + padding: 20px 20px; + margin: 20px; } .centered-title { - display: flex; - justify-content: center; - align-items: center; - - h1 { - text-align: center; - } + display: flex; + justify-content: center; + align-items: center; + + h1 { + text-align: center; } +} + - mat-paginator { - margin-top: 20px; - display: flex; - justify-content: right; + margin-top: 20px; + display: flex; + justify-content: right; } .header-container { display: flex; align-items: center; - gap:16px; + gap: 4rem; } .see-all-link { @@ -36,4 +36,9 @@ mat-paginator { .skeleton-loader { width: 100%; +} + +.viewClasses { + min-width: fit-content; + padding: 10px; } \ No newline at end of file diff --git a/frontend/src/app/components/student-dashboard/student-dashboard.component.ts b/frontend/src/app/components/student-dashboard/student-dashboard.component.ts index 70f0dd27..342ac670 100644 --- a/frontend/src/app/components/student-dashboard/student-dashboard.component.ts +++ b/frontend/src/app/components/student-dashboard/student-dashboard.component.ts @@ -19,6 +19,7 @@ import { CardSkeletonLoaderComponent } from '../small-components/card-skeleton-l import { Progress } from '../../interfaces/progress/progress'; import { ProgressService } from '../../services/progress.service'; import { forkJoin } from 'rxjs'; +import { MatCardModule } from '@angular/material/card'; @Component({ @@ -33,6 +34,7 @@ import { forkJoin } from 'rxjs'; MatPaginatorModule, MatButtonModule, PaginatedGridComponent, + MatCardModule, CardSkeletonLoaderComponent ], templateUrl: './student-dashboard.component.html', @@ -47,9 +49,9 @@ export class StudentDashboardComponent implements OnInit { public pagedAssignments: Assignment[] = []; // Array with useless info to render skeleton loaders - public LOADINGDATA: {id: number}[] = Array(6).fill(0).map((v, i) => ({id: i})) - public loadingProgress: boolean = true; - public loadingGroups: boolean = true; + public LOADINGDATA: { id: number }[] = Array(6).fill(0).map((v, i) => ({ id: i })) + public loadingProgress: boolean = true; + public loadingGroups: boolean = true; public loadingClasses: boolean = true; pageSize = 12; @@ -77,7 +79,7 @@ export class StudentDashboardComponent implements OnInit { }, complete: () => { this.loadingClasses = false; - } + } }); this.assignmentService.retrieveAssignments().subscribe({ @@ -95,7 +97,7 @@ export class StudentDashboardComponent implements OnInit { }); this.updatePagedAssignments(); - if(userId) { + if (userId) { const progressObservables = this.assignments.map(a => this.progressService.getUserAssignmentProgress(userId, a.id) ); @@ -107,19 +109,19 @@ export class StudentDashboardComponent implements OnInit { }, complete: () => { this.loadingProgress = false; - } + } }); this.groupService.getAllGroupsFromUser(userId) - .subscribe({ - next: (groups: Group[]) => { - groups.forEach(g => { - this._assignmentToGroup[g.assignment.id] = g - }) - }, - complete: () => { - this.loadingGroups = false; - } - }) + .subscribe({ + next: (groups: Group[]) => { + groups.forEach(g => { + this._assignmentToGroup[g.assignment.id] = g + }) + }, + complete: () => { + this.loadingGroups = false; + } + }) } }, complete: () => { @@ -129,7 +131,7 @@ export class StudentDashboardComponent implements OnInit { this.loadingGroups = false; this.loadingProgress = false; } - + } }); diff --git a/frontend/src/app/pages/create-assignment-page/create-assignment-page.component.html b/frontend/src/app/pages/create-assignment-page/create-assignment-page.component.html index 6acdb464..d0331cb0 100644 --- a/frontend/src/app/pages/create-assignment-page/create-assignment-page.component.html +++ b/frontend/src/app/pages/create-assignment-page/create-assignment-page.component.html @@ -3,7 +3,6 @@
@if(showLearningPath){ - }
Create your Assignment @@ -11,4 +10,4 @@
- \ No newline at end of file + diff --git a/frontend/src/app/pages/create-assignment-page/create-assignment-page.component.less b/frontend/src/app/pages/create-assignment-page/create-assignment-page.component.less index 60085a3b..ec45b4e5 100644 --- a/frontend/src/app/pages/create-assignment-page/create-assignment-page.component.less +++ b/frontend/src/app/pages/create-assignment-page/create-assignment-page.component.less @@ -10,14 +10,14 @@ justify-content: center; } -.wrap { - margin: 30px; -} +// .wrap { +// margin: 30px; +// } -.right-side { - width: inherit; - padding-left: 10%; -} +// .right-side { +// width: inherit; +// padding-left: 10%; +// } .mat-mdc-card-title, .mat-mdc-card-subtitle { @@ -30,4 +30,4 @@ .base { flex-direction: column; } -} \ No newline at end of file +} diff --git a/frontend/src/custom-theme.scss b/frontend/src/custom-theme.scss index afe369c7..cf700a35 100644 --- a/frontend/src/custom-theme.scss +++ b/frontend/src/custom-theme.scss @@ -12,4 +12,4 @@ html { typography: Roboto, density: 0, )); -} \ No newline at end of file +}