Skip to content

Commit

Permalink
refactor(SummaryDisplay): Convert components to standalone (#2002)
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima authored Nov 26, 2024
1 parent 6b9d87e commit 5d51ab0
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/app/teacher/classroom-monitor.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ComponentNewWorkBadgeComponent } from '../classroom-monitor/component-n
import { ComponentSelectComponent } from '../classroom-monitor/component-select/component-select.component';
import { StepInfoComponent } from '../classroom-monitor/step-info/step-info.component';
import { PeerGroupGradingModule } from './peer-group-grading.module';
import { TeacherSummaryDisplay } from '../../assets/wise5/directives/teacher-summary-display/teacher-summary-display.component';
import { TeacherSummaryDisplayComponent } from '../../assets/wise5/directives/teacher-summary-display/teacher-summary-display.component';
import { HighchartsChartModule } from 'highcharts-angular';
import { StudentTeacherCommonModule } from '../student-teacher-common.module';
import { NodeInfoComponent } from '../../assets/wise5/classroomMonitor/classroomMonitorComponents/shared/node-info/node-info.component';
Expand Down Expand Up @@ -55,7 +55,6 @@ import { SelectPeriodComponent } from '../../assets/wise5/classroomMonitor/class
StudentGradingComponent,
StudentGradingToolsComponent,
StudentProgressComponent,
TeacherSummaryDisplay,
ToolBarComponent,
TopBarComponent,
ViewComponentRevisionsComponent
Expand All @@ -79,7 +78,8 @@ import { SelectPeriodComponent } from '../../assets/wise5/classroomMonitor/class
SelectPeriodComponent,
StepInfoComponent,
StepToolsComponent,
StudentTeacherCommonModule
StudentTeacherCommonModule,
TeacherSummaryDisplayComponent
]
})
export class ClassroomMonitorModule {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { provideHttpClientTesting } from '@angular/common/http/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogModule } from '@angular/material/dialog';
import { StudentTeacherCommonServicesModule } from '../../../../app/student-teacher-common-services.module';
import { ComponentContent } from '../../common/ComponentContent';
import { ConfigService } from '../../services/configService';
Expand All @@ -15,11 +12,9 @@ let fixture: ComponentFixture<StudentSummaryDisplay>;
describe('StudentSummaryDisplayComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [StudentSummaryDisplay],
schemas: [NO_ERRORS_SCHEMA],
imports: [MatDialogModule, StudentTeacherCommonServicesModule],
providers: [provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
});
imports: [StudentSummaryDisplay, StudentTeacherCommonServicesModule],
providers: [provideHttpClient(withInterceptorsFromDi())]
});
fixture = TestBed.createComponent(StudentSummaryDisplay);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ import { SummaryService } from '../../components/summary/summaryService';
import { SummaryDisplay } from '../summary-display/summary-display.component';
import { StudentDataService } from '../../services/studentDataService';
import { Subscription } from 'rxjs';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import { HighchartsChartModule } from 'highcharts-angular';

@Component({
imports: [CommonModule, HighchartsChartModule, MatCardModule],
selector: 'student-summary-display',
templateUrl: '../summary-display/summary-display.component.html',
styleUrls: ['../summary-display/summary-display.component.scss']
standalone: true,
styleUrl: '../summary-display/summary-display.component.scss',
templateUrl: '../summary-display/summary-display.component.html'
})
export class StudentSummaryDisplay extends SummaryDisplay {
private studentWorkSavedToServerSubscription: Subscription;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<mat-card appearance="outlined" *ngIf="nodeId != null && componentId != null" class="summary-card">
<mat-card appearance="outlined" class="summary-card">
<mat-card-content>
<p *ngIf="hasWarning" class="warn center">{{ warningMessage }}</p>
<div *ngIf="doRender && chartConfig != null">
@if (hasWarning) {
<p class="warn center">{{ warningMessage }}</p>
}
@if (doRender && chartConfig != null) {
<highcharts-chart [Highcharts]="Highcharts" [options]="chartConfig" class="highcharts-chart">
</highcharts-chart>
</div>
}
</mat-card-content>
</mat-card>
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,15 @@ import { copy } from '../../common/object/object';
import { rgbToHex } from '../../common/color/color';
import { DataService } from '../../../../app/services/data.service';
import { StudentDataService } from '../../services/studentDataService';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';

@Component({
imports: [CommonModule, MatCardModule],
selector: 'summary-display',
templateUrl: 'summary-display.component.html',
styleUrls: ['summary-display.component.scss']
standalone: true,
styleUrl: 'summary-display.component.scss',
templateUrl: 'summary-display.component.html'
})
export abstract class SummaryDisplay {
chartConfig: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ import { StudentComponentModule } from '../../../../app/student/student.componen
import { StudentSummaryDisplay } from '../student-summary-display/student-summary-display.component';

@NgModule({
declarations: [StudentSummaryDisplay],
imports: [StudentTeacherCommonModule, HighchartsChartModule, StudentComponentModule],
declarations: [],
imports: [
StudentSummaryDisplay,
StudentTeacherCommonModule,
HighchartsChartModule,
StudentComponentModule
],
exports: [StudentSummaryDisplay]
})
export class SummaryDisplayModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ import { ProjectService } from '../../services/projectService';
import { SummaryService } from '../../components/summary/summaryService';
import { SummaryDisplay } from '../summary-display/summary-display.component';
import { TeacherDataService } from '../../services/teacherDataService';
import { CommonModule } from '@angular/common';
import { MatCardModule } from '@angular/material/card';
import { HighchartsChartModule } from 'highcharts-angular';

@Component({
imports: [CommonModule, HighchartsChartModule, MatCardModule],
selector: 'teacher-summary-display',
templateUrl: '../summary-display/summary-display.component.html',
styleUrls: ['../summary-display/summary-display.component.scss']
standalone: true,
styleUrl: '../summary-display/summary-display.component.scss',
templateUrl: '../summary-display/summary-display.component.html'
})
export class TeacherSummaryDisplay extends SummaryDisplay {
export class TeacherSummaryDisplayComponent extends SummaryDisplay {
constructor(
protected annotationService: AnnotationService,
protected configService: ConfigService,
Expand Down
26 changes: 13 additions & 13 deletions src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -19706,11 +19706,11 @@ Warning: This will delete all existing choices and buckets in this component.</s
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">570</context>
<context context-type="linenumber">574</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">680</context>
<context context-type="linenumber">684</context>
</context-group>
</trans-unit>
<trans-unit id="2496818939481806999" datatype="html">
Expand All @@ -19721,11 +19721,11 @@ Warning: This will delete all existing choices and buckets in this component.</s
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">570</context>
<context context-type="linenumber">574</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">684</context>
<context context-type="linenumber">688</context>
</context-group>
</trans-unit>
<trans-unit id="3309404570196522710" datatype="html">
Expand Down Expand Up @@ -21574,63 +21574,63 @@ If this problem continues, let your teacher know and move on to the next activit
<source>The student will see a graph of their individual data here.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">150</context>
<context context-type="linenumber">154</context>
</context-group>
</trans-unit>
<trans-unit id="629070935308008546" datatype="html">
<source>Your Response</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">704</context>
<context context-type="linenumber">708</context>
</context-group>
</trans-unit>
<trans-unit id="610707389788117365" datatype="html">
<source>Your Score</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">706</context>
<context context-type="linenumber">710</context>
</context-group>
</trans-unit>
<trans-unit id="1159047178964534522" datatype="html">
<source>Period Responses</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">713</context>
<context context-type="linenumber">717</context>
</context-group>
</trans-unit>
<trans-unit id="6903542619561738551" datatype="html">
<source>Period Scores</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">718</context>
<context context-type="linenumber">722</context>
</context-group>
</trans-unit>
<trans-unit id="2142002953999044695" datatype="html">
<source>Class Responses</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">727</context>
<context context-type="linenumber">731</context>
</context-group>
</trans-unit>
<trans-unit id="489297649750722424" datatype="html">
<source>Class Scores</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">732</context>
<context context-type="linenumber">736</context>
</context-group>
</trans-unit>
<trans-unit id="4270887249744454870" datatype="html">
<source><x id="PH" equiv-text="this.percentResponded"/>% Responded (<x id="PH_1" equiv-text="this.numResponses"/>/<x id="PH_2" equiv-text="this.totalWorkgroups"/>)</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">743</context>
<context context-type="linenumber">747</context>
</context-group>
</trans-unit>
<trans-unit id="8177873832400820695" datatype="html">
<source>Count</source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/directives/summary-display/summary-display.component.ts</context>
<context context-type="linenumber">860</context>
<context context-type="linenumber">864</context>
</context-group>
</trans-unit>
<trans-unit id="d53b401d14b43833857138029db823612e52f518" datatype="html">
Expand Down

0 comments on commit 5d51ab0

Please sign in to comment.