Skip to content

Commit

Permalink
Migrate/project tasks list (#867)
Browse files Browse the repository at this point in the history
* feat: create initial files for migration of project-tasks-list

* feat: create initial files for migration of project-tasks-list

* Revert "feat: create initial files for migration of project-tasks-list"

This reverts commit 3d047b3.

* refactor: migrate project-tasks-list component to TypeScript

* chore: update Angular module files for project-tasks-list migration

* fix: update project progress dashboard template

* chore: update tasks CoffeeScript file

* style: update task status colors generator mixin

* feat: add order-by and tasks-for-group-set pipes

* fix: address layout and styling issues in project-tasks-list

- Ensure task boxes are consistent in size
- Align layout to match the original design for row consistency
- Correct hover effect to include bold styling for 'Assignment #'
  using a tooltip component and change color to black
- Add blue outline on task box click
- Update Angular module file
- Update global styles

* chore: remove deprecated CoffeeScript and template files for project-tasks-list

* style: update styles for project-tasks-list component

* style: update outline and styles for project-tasks-list component

* fix: minor fixes for project tasks list

---------

Co-authored-by: Andrew Cain <[email protected]>
  • Loading branch information
PrabhKamboj and macite authored Nov 3, 2024
1 parent 475c316 commit e9cf3ec
Show file tree
Hide file tree
Showing 15 changed files with 255 additions and 143 deletions.
1 change: 1 addition & 0 deletions src/app/api/models/doubtfire-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ export * from '../services/teaching-period-break.service';
export * from '../services/learning-outcome.service';
export * from '../services/group-set.service';
export * from '../services/task-similarity.service';
export * from '../../common/services/grade.service';
export * from '../services/test-attempt.service';
28 changes: 28 additions & 0 deletions src/app/common/filters/order-by.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'orderBy'
})
export class OrderByPipe implements PipeTransform {
transform(array: any[], field: string, reverse: boolean = false): any[] {
if (!array || !field) {
return array;
}

const sortedArray = [...array].sort((a, b) => {
if (a[field] < b[field]) {
return -1;
}
if (a[field] > b[field]) {
return 1;
}
return 0;
});

if (reverse) {
return sortedArray.reverse();
}

return sortedArray;
}
}
15 changes: 15 additions & 0 deletions src/app/common/filters/tasks-for-group-set.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Pipe, PipeTransform } from '@angular/core';
import { Task, GroupSet } from 'src/app/api/models/doubtfire-model';

@Pipe({
name: 'tasksForGroupset'
})
export class TasksForGroupsetPipe implements PipeTransform {
transform(tasks: Task[], groupSet: GroupSet): Task[] {
if (!tasks) return tasks;

return tasks.filter(task => {
return (task.definition.groupSet === groupSet) || (!task.definition.groupSet && !groupSet);
});
}
}
6 changes: 6 additions & 0 deletions src/app/doubtfire-angular.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {
uploadSubmissionModalProvider,
ConfirmationModalProvider,
} from './ajs-upgraded-providers';
import {ProjectTasksListComponent} from './tasks/project-tasks-list/project-tasks-list.component';
import {
TaskCommentComposerComponent,
DiscussionComposerDialog,
Expand Down Expand Up @@ -140,6 +141,8 @@ import {TasksInTutorialsPipe} from './common/filters/tasks-in-tutorials.pipe';
import {TasksForInboxSearchPipe} from './common/filters/tasks-for-inbox-search.pipe';
import {StatusIconComponent} from './common/status-icon/status-icon.component';
import {ScrollingModule} from '@angular/cdk/scrolling';
import {TasksForGroupsetPipe} from './common/filters/tasks-for-group-set.pipe';
import {OrderByPipe} from './common/filters/order-by.pipe';
import {CheckForUpdateService} from './sessions/service-worker-updater/check-for-update.service';
import {
ActivityTypeService,
Expand Down Expand Up @@ -266,6 +269,7 @@ const MY_DATE_FORMAT = {
AlertComponent,
AboutDoubtfireModalContent,
TeachingPeriodUnitImportDialogComponent,
ProjectTasksListComponent,
TaskCommentComposerComponent,
AudioCommentRecorderComponent,
MicrophoneTesterComponent,
Expand Down Expand Up @@ -318,6 +322,8 @@ const MY_DATE_FORMAT = {
PdfViewerPanelComponent,
StaffTaskListComponent,
TaskSimilarityViewComponent,
TasksForGroupsetPipe,
OrderByPipe,
FiltersPipe,
TasksOfTaskDefinitionPipe,
TasksInTutorialsPipe,
Expand Down
7 changes: 6 additions & 1 deletion src/app/doubtfire-angularjs.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import 'build/src/app/tasks/modals/upload-submission-modal/upload-submission-mod
import 'build/src/app/tasks/modals/grade-task-modal/grade-task-modal.js';
import 'build/src/app/tasks/modals/modals.js';
import 'build/src/app/tasks/tasks.js';
import 'build/src/app/tasks/project-tasks-list/project-tasks-list.js';
import 'build/src/app/tasks/task-ilo-alignment/task-ilo-alignment.js';
import 'build/src/app/tasks/task-ilo-alignment/task-ilo-alignment-rater/task-ilo-alignment-rater.js';
import 'build/src/app/tasks/task-ilo-alignment/modals/task-ilo-alignment.js';
Expand Down Expand Up @@ -145,6 +144,7 @@ import 'build/src/i18n/resources-locale_en-GB.js';
//#endregion

import {AboutDoubtfireModal} from 'src/app/common/modals/about-doubtfire-modal/about-doubtfire-modal.component';
import {ProjectTasksListComponent} from './tasks/project-tasks-list/project-tasks-list.component';
import {TaskCommentComposerComponent} from 'src/app/tasks/task-comment-composer/task-comment-composer.component';
import {DoubtfireConstants} from 'src/app/config/constants/doubtfire-constants';
import {IntelligentDiscussionPlayerComponent} from './tasks/task-comments-viewer/intelligent-discussion-player/intelligent-discussion-player.component';
Expand Down Expand Up @@ -223,6 +223,7 @@ import { TaskVisualisationComponent } from './visualisations/task-visualisation/
import {FUnitsComponent} from './admin/states/units/units.component';
import {MarkedPipe} from './common/pipes/marked.pipe';
import {AlertService} from './common/services/alert.service';

import {GradeService} from './common/services/grade.service';
import {TaskScormCardComponent} from './projects/states/dashboard/directives/task-dashboard/directives/task-scorm-card/task-scorm-card.component';

Expand Down Expand Up @@ -305,6 +306,10 @@ DoubtfireAngularJSModule.factory(
DoubtfireAngularJSModule.factory('CreateNewUnitModal', downgradeInjectable(CreateNewUnitModal));

// directive -> component
DoubtfireAngularJSModule.directive(
'fProjectTasksList',
downgradeComponent({component: ProjectTasksListComponent}),
);
DoubtfireAngularJSModule.directive(
'taskCommentComposer',
downgradeComponent({component: TaskCommentComposerComponent}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,60 +1,95 @@
<div ng-if="unit" class="project-progress-dashboard">
<div class="col-md-4 col-md-push-8">
<div class="row">
<div class="col-sm-6 col-md-12">
<div class="panel panel-primary">
<div class="panel-heading clearfix">
<div class="pull-left">
<h4 class="panel-title">Task List</h4>
<div class="col-md-4 col-md-push-8">
<div class="row">
<div class="col-sm-6 col-md-12">
<div class="panel panel-primary">
<div class="panel-heading clearfix">
<div class="pull-left">
<h4 class="panel-title">Task List</h4>
</div>
</div>
<div class="panel-body">
<f-project-tasks-list [project]="project" [unit]="unit" ></f-project-tasks-list>
</div>
</div><!--task-lists-->
</div>
<div class="col-sm-6 col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Target Grade</h3>
Select the grade you wish to achieve in the unit.
</div>
<div class="panel-body text-center">
<p class="btn-group">
<label ng-repeat="grade in grades" ng-click="chooseGrade($index)" class="btn btn-default col-sm-3 text-center" ng-model="project.targetGrade" btn-radio="{{$index}}">
<grade-icon grade="grade" tooltip="Select a {{grade}} as your target grade" tooltip-append-to-body="true" class="text-{{$index == project.targetGrade ? 'primary' : 'muted'}}"></grade-icon>
</label>
</p>
</div>
</div>
<div class="panel-body">
<project-tasks-list project="project" student-project-id="studentProjectId" task-def="taskDef" unit="unit" assessing-unit-role="assessingUnitRole" on-select="showTaskView"></project-tasks-list>
</div>
</div><!--task-lists-->
</div>
</div>
<div class="col-sm-6 col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Target Grade</h3>
Select the grade you wish to achieve in the unit.
</div><!--right-hand-panel-->

<div class="col-md-8 col-md-pull-4">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="pull-left">
<div ng-show="currentVisualisation == 'burndown'">
<h3 class="panel-title">Burndown Chart</h3>
The Burndown chart shows how much work remains for you to achieve your target grade.
</div>
<div ng-show="currentVisualisation == 'taskSummary'">
<h3 class="panel-title">Task Summary Chart</h3>
Summary of each of your task statuses
</div>
</div><!--/headings-->
<div class="pull-right text-right toolbar">
<div class="buttons">
<div class="btn-group">
<label class="btn btn-default text-center" btn-radio="'burndown'" ng-model="currentVisualisation">
<i class="fa fa-line-chart"></i>
</label>
<label class="btn btn-default text-center" btn-radio="'taskSummary'" ng-model="currentVisualisation">
<i class="fa fa-pie-chart"></i>
</label>
</div>
</div>
</div><!--/button-switch-->
</div>
<div class="panel-body">
<div class="burndown-chart" ng-if="currentVisualisation == 'burndown'">
<!-- <progress-burndown-chart project="project" unit="unit"></progress-burndown-chart> -->
</div>
<div ng-if="currentVisualisation == 'taskSummary'">
<!-- <student-task-status-pie-chart project="project"></student-task-status-pie-chart> -->

<div class="panel-body text-center">
<p class="btn-group">
<label ng-repeat="grade in grades" ng-if="$index != 4" ng-click="chooseGrade($index)" class="btn btn-default col-sm-3 text-center" ng-model="project.targetGrade" btn-radio="{{$index}}">
<grade-icon grade="grade" tooltip="Select a {{grade}} as your target grade" tooltip-append-to-body="true" class="text-{{$index == project.targetGrade ? 'primary' : 'muted'}}"></grade-icon>
</label>
</p>
</div>
</div>
</div>
</div>
</div><!--right-hand-panel-->

<div class="col-md-8 col-md-pull-4">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<div class="pull-left">
<div ng-show="currentVisualisation == 'burndown'">
<h3 class="panel-title">Burndown Chart</h3>
The Burndown chart shows how much work remains for you to achieve your target grade.
</div>
</div>
<div class="panel-footer text-center">
<div ng-show="currentVisualisation == 'taskSummary'">
<h3 class="panel-title">Task Summary Chart</h3>
Summary of each of your task statuses
You have completed
<strong>{{taskStats.numberOfTasksCompleted}}</strong>
tasks and have
<strong>{{taskStats.numberOfTasksRemaining}}</strong>
left to complete to achieve a
<strong>{{grade.names[project.targetGrade]}}</strong>.
</div>
</div><!--/headings-->
<div class="pull-right text-right toolbar">
<div class="buttons">
<div class="btn-group">
<label class="btn btn-default text-center" btn-radio="'burndown'" ng-model="currentVisualisation">
<i class="fa fa-line-chart"></i>
</label>
<label class="btn btn-default text-center" btn-radio="'taskSummary'" ng-model="currentVisualisation">
<i class="fa fa-pie-chart"></i>
</label>
</div>
<div ng-show="currentVisualisation == 'burndown'">
Aim to keep your
<strong style="color: #e01b5d">Complete</strong>
line close to or ahead of the
<strong class="text-muted">Target</strong>
line to keep on track.
</div>

</div><!--/button-switch-->
</div>
<div class="panel-body">
Expand All @@ -80,8 +115,9 @@ <h3 class="panel-title">Task Summary Chart</h3>
line close to or ahead of the
<strong class="text-muted">Target</strong>
line to keep on track.

</div>
</div>
</div>
</div><!--primary-panel-->
</div>
</div><!--primary-panel-->
</div>
59 changes: 0 additions & 59 deletions src/app/tasks/project-tasks-list/project-tasks-list.coffee

This file was deleted.

22 changes: 22 additions & 0 deletions src/app/tasks/project-tasks-list/project-tasks-list.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<ul class="project-tasks-list">
<div *ngFor="let grouping of groupTasks" class="clearfix">
<h5 class="group-set-name" *ngIf="!hideGroupSetName">{{ grouping.name }}</h5>
<div class="grid grid-cols-3 sm:grid-cols-4 gap-2 outline-1">
<mat-chip
#tooltip="matTooltip"
matTooltip="{{ task.definition.name }}: {{ task.statusLabel() }}"
*ngFor="
let task of project.tasks
| tasksForGroupset: grouping.groupSet
| orderBy: ['definition.targetGrade', 'definition.seq'];
let i = index
" [class.mat-chip-clicked]="selectedTask === task" (click)="selectChip(task)"
class="task-status chip truncate text-center" [ngClass]="newTaskService.statusClass(task.status)">
<mat-icon svgIcon="visibility" *ngIf="task.similarityFlag"></mat-icon>

<span class="{{ task.status === 'not_started' ? 'text-black' : '' }}">{{
taskText(task)
}}</span></mat-chip>
</div>
</div>
</ul>
25 changes: 25 additions & 0 deletions src/app/tasks/project-tasks-list/project-tasks-list.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.project-tasks-list {
.chip {
border-radius: 4px;
::ng-deep .mdc-evolution-chip__text-label {
color: inherit !important;
}
}

.group-set-name {
color: #777;
text-align: center;
font-size: 1em;
font-weight: bold;
}

.mat-chip-clicked {
outline: #007bff auto 1px !important;
}

.task-status {
::ng-deep .mdc-evolution-chip__cell {
justify-content: center !important;
}
}
}
Loading

0 comments on commit e9cf3ec

Please sign in to comment.