diff --git a/package.json b/package.json index 6a9da49255..6896556574 100755 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "license": "AGPL-3.0", "version": "0.16.10", "myplanet": { - "latest": "v0.21.40", - "min": "v0.20.40" + "latest": "v0.21.42", + "min": "v0.20.42" }, "scripts": { "ng": "ng", diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index e8416ebb39..aec7227687 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -72,7 +72,7 @@

- + diff --git a/src/app/community/community.scss b/src/app/community/community.scss index 293fb05afe..3d8e70b249 100644 --- a/src/app/community/community.scss +++ b/src/app/community/community.scss @@ -35,6 +35,27 @@ planet-calendar { overflow-y: auto; } +.calendar-legend { + padding-top: 10px; + text-align: right; + display: flex; + flex-wrap: wrap; + justify-content: flex-end; + gap: 10px; +} + +.calendar-legend .legend-item { + display: inline-flex; + align-items: center; +} + +.calendar-legend .legend-color { + width: 20px; + height: 20px; + margin-right: 10px; + border-radius: 4px; +} + .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); @@ -60,6 +81,6 @@ mat-tab-group, mat-tab { padding-top: 0.5rem; } -.toggle-button{ +.toggle-button { margin-bottom: 1rem; } diff --git a/src/app/courses/courses.service.ts b/src/app/courses/courses.service.ts index 072e656893..78866f6d07 100644 --- a/src/app/courses/courses.service.ts +++ b/src/app/courses/courses.service.ts @@ -203,6 +203,7 @@ export class CoursesService { courseResignAdmission(courseId, type, courseTitle?) { const title = courseTitle ? courseTitle : this.getCourseNameFromId(courseId); + const truncatedTitle = title.length > 180 ? `${title.slice(0, 180)}...` : title; const courseIds: any = [ ...this.userService.shelf.courseIds ]; if (type === 'resign') { const myCourseIndex = courseIds.indexOf(courseId); @@ -211,8 +212,9 @@ export class CoursesService { courseIds.push(courseId); } return this.userService.updateShelf(courseIds, 'courseIds').pipe(map((res) => { - const admissionMessage = type === 'resign' ? $localize`${title} successfully removed from myCourses` : - $localize`${title} added to your dashboard`; + const admissionMessage = type === 'resign' + ? $localize`${truncatedTitle} successfully removed from myCourses` + : $localize`${truncatedTitle} added to your dashboard`; this.planetMessageService.showMessage(admissionMessage); return res; })); diff --git a/src/app/courses/progress-courses/courses-progress-chart.component.html b/src/app/courses/progress-courses/courses-progress-chart.component.html index fb3711547f..1b5508212b 100644 --- a/src/app/courses/progress-courses/courses-progress-chart.component.html +++ b/src/app/courses/progress-courses/courses-progress-chart.component.html @@ -41,6 +41,6 @@
{{set.total}}
-

{{set.label}}

+

{{set.label}}

diff --git a/src/app/courses/progress-courses/courses-progress-learner.component.html b/src/app/courses/progress-courses/courses-progress-learner.component.html index e46c021040..1258573afe 100644 --- a/src/app/courses/progress-courses/courses-progress-learner.component.html +++ b/src/app/courses/progress-courses/courses-progress-learner.component.html @@ -7,7 +7,7 @@ Courses: myProgress
- + No Progress record available
diff --git a/src/app/courses/progress-courses/courses-progress-learner.component.ts b/src/app/courses/progress-courses/courses-progress-learner.component.ts index 9c59bab079..c030e26b8e 100644 --- a/src/app/courses/progress-courses/courses-progress-learner.component.ts +++ b/src/app/courses/progress-courses/courses-progress-learner.component.ts @@ -62,6 +62,7 @@ export class CoursesProgressLearnerComponent implements OnInit, OnDestroy { createChartData(courses = [], submissions) { return courses.map((course: any) => ({ label: course.doc.courseTitle, + courseId: course._id, items: this.courseBySteps( course, submissions.filter(submission => submission.parentId.indexOf(course._id) > -1) @@ -106,4 +107,10 @@ export class CoursesProgressLearnerComponent implements OnInit, OnDestroy { changeData(event) {} + handleCourseClick(event: any) { + if (event.courseId) { + this.router.navigate([ '/courses', 'view', event.courseId ]); + } + } + } diff --git a/src/app/exams/exams-view.component.ts b/src/app/exams/exams-view.component.ts index 04cd67d8c1..c9b70fe540 100644 --- a/src/app/exams/exams-view.component.ts +++ b/src/app/exams/exams-view.component.ts @@ -279,13 +279,22 @@ export class ExamsViewComponent implements OnInit, OnDestroy { } setAnswer(event, option) { - this.answer.setValue(Array.isArray(this.answer.value) ? this.answer.value : []); - const value = this.answer.value; - if (event.checked === true) { - value.push(option); - } else if (event.checked === false) { - value.splice(value.indexOf(option), 1); + const value = this.answer.value || []; + + + if (event.checked) { + if (!value.includes(option)) { + value.push(option); + } + } else { + const index = value.indexOf(option); + if (index > -1) { + value.splice(index, 1); + } } + + this.answer.setValue(value); + this.answer.updateValueAndValidity(); this.checkboxState[option.id] = event.checked; } @@ -343,9 +352,14 @@ export class ExamsViewComponent implements OnInit, OnDestroy { answerValidator(ac: AbstractControl) { if (typeof ac.value === 'string') { - return CustomValidators.required(ac); + return ac.value.trim() ? null : { required: true }; } - return ac.value !== null ? null : { required: true }; + + if (Array.isArray(ac.value)) { + return ac.value.length > 0 ? null : { required: true }; + } + + return ac.value !== null && ac.value !== undefined ? null : { required: true }; } setViewAnswerText(answer: any) { diff --git a/src/app/shared/calendar.component.ts b/src/app/shared/calendar.component.ts index a45d582a21..80a05b48b9 100644 --- a/src/app/shared/calendar.component.ts +++ b/src/app/shared/calendar.component.ts @@ -16,6 +16,14 @@ import { addDateAndTime, styleVariables } from './utils'; selector: 'planet-calendar', template: ` +
+
+
+
+ {{ legend.label }} +
+
+
` }) export class PlanetCalendarComponent implements OnInit, OnChanges { @@ -25,6 +33,7 @@ export class PlanetCalendarComponent implements OnInit, OnChanges { @Input() link: any = {}; @Input() sync: { type: 'local' | 'sync', planetCode: string }; @Input() editable = true; + @Input() type = ''; @Input() header?: any = { left: 'title', @@ -47,6 +56,12 @@ export class PlanetCalendarComponent implements OnInit, OnChanges { dbName = 'meetups'; meetups: any[] = []; tasks: any[] = []; + showLegend = true; + eventLegend = [ + { color: styleVariables.primary, label: 'Event' }, + { color: 'orange', label: 'Uncompleted Task', type: 'team' }, + { color: 'grey', label: 'Completed Task', type: 'team' } + ]; calendarOptions: CalendarOptions = { initialView: 'dayGridMonth', diff --git a/src/app/teams/teams-view.component.html b/src/app/teams/teams-view.component.html index 9f2796632d..2a651303e3 100644 --- a/src/app/teams/teams-view.component.html +++ b/src/app/teams/teams-view.component.html @@ -131,7 +131,7 @@

{{configuration Calendar - +