From 873a4bbbf29d4864a47d7d8ce5ad067322d6f28e Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Tue, 26 Nov 2024 15:32:11 -0800 Subject: [PATCH] refactor(PauseScreensMenu): Convert to standalone --- src/app/teacher/classroom-monitor.module.ts | 2 +- .../pause-screens-menu.component.html | 25 +++++++++-------- .../pause-screens-menu.component.ts | 28 +++++++++++++++---- .../shared/top-bar/top-bar.component.spec.ts | 10 ++----- src/messages.xlf | 2 +- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/src/app/teacher/classroom-monitor.module.ts b/src/app/teacher/classroom-monitor.module.ts index 965e758f776..d166238d9d8 100644 --- a/src/app/teacher/classroom-monitor.module.ts +++ b/src/app/teacher/classroom-monitor.module.ts @@ -47,7 +47,6 @@ import { SelectPeriodComponent } from '../../assets/wise5/classroomMonitor/class NotebookGradingComponent, NotebookWorkgroupGradingComponent, NotificationsMenuComponent, - PauseScreensMenuComponent, StepItemComponent, StudentGradingComponent, StudentGradingToolsComponent, @@ -67,6 +66,7 @@ import { SelectPeriodComponent } from '../../assets/wise5/classroomMonitor/class ManageStudentsModule, MilestoneModule, NavItemScoreComponent, + PauseScreensMenuComponent, PeerGroupGradingModule, PreviewComponentComponent, ProjectProgressComponent, diff --git a/src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.html b/src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.html index 640ca165a96..8e66ac04c69 100644 --- a/src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.html +++ b/src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.html @@ -21,17 +21,18 @@ > All Periods - - - Period: {{ period.periodName }} - + + @for (period of periods; track period.periodId) { + + } diff --git a/src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.ts b/src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.ts index 0aadc2f4d01..82d0c73838c 100644 --- a/src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.ts +++ b/src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.ts @@ -1,20 +1,38 @@ import { Component } from '@angular/core'; import { TeacherDataService } from '../../../services/teacherDataService'; import { TeacherPauseScreenService } from '../../../services/teacherPauseScreenService'; +import { CommonModule } from '@angular/common'; +import { FlexLayoutModule } from '@angular/flex-layout'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; +import { MatIconModule } from '@angular/material/icon'; +import { MatToolbarModule } from '@angular/material/toolbar'; +import { MatDividerModule } from '@angular/material/divider'; +import { FormsModule } from '@angular/forms'; class Period { paused: boolean; periodId: number; + periodName: string; } @Component({ + imports: [ + CommonModule, + FlexLayoutModule, + FormsModule, + MatDividerModule, + MatIconModule, + MatSlideToggleModule, + MatToolbarModule + ], selector: 'pause-screens-menu', - styleUrls: ['./pause-screens-menu.component.scss'], + standalone: true, + styleUrl: './pause-screens-menu.component.scss', templateUrl: './pause-screens-menu.component.html' }) export class PauseScreensMenuComponent { - allPeriodsPaused: boolean; - periods: Period[]; + protected allPeriodsPaused: boolean; + protected periods: Period[]; constructor( private dataService: TeacherDataService, @@ -23,11 +41,11 @@ export class PauseScreensMenuComponent { this.periods = this.dataService.getPeriods().filter((period) => period.periodId !== -1); } - togglePeriod(period: Period): void { + protected togglePeriod(period: Period): void { this.pauseScreenService.pauseScreensChanged(period.periodId, period.paused); } - toggleAllPeriods(): void { + protected toggleAllPeriods(): void { this.periods.forEach((period) => { this.pauseScreenService.pauseScreensChanged(period.periodId, this.allPeriodsPaused); }); diff --git a/src/assets/wise5/classroomMonitor/classroomMonitorComponents/shared/top-bar/top-bar.component.spec.ts b/src/assets/wise5/classroomMonitor/classroomMonitorComponents/shared/top-bar/top-bar.component.spec.ts index 882798646a6..bb62aa2ae14 100644 --- a/src/assets/wise5/classroomMonitor/classroomMonitorComponents/shared/top-bar/top-bar.component.spec.ts +++ b/src/assets/wise5/classroomMonitor/classroomMonitorComponents/shared/top-bar/top-bar.component.spec.ts @@ -1,10 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormsModule } from '@angular/forms'; -import { MatDividerModule } from '@angular/material/divider'; import { MatIconModule } from '@angular/material/icon'; import { MatListModule } from '@angular/material/list'; import { MatMenuModule } from '@angular/material/menu'; -import { MatSlideToggleModule } from '@angular/material/slide-toggle'; import { MatToolbarModule } from '@angular/material/toolbar'; import { MatTooltipModule } from '@angular/material/tooltip'; import { ConfigService } from '../../../../services/configService'; @@ -12,7 +9,6 @@ import { NotificationService } from '../../../../services/notificationService'; import { ClassroomMonitorTestingModule } from '../../../classroom-monitor-testing.module'; import { PauseScreensMenuComponent } from '../../pause-screens-menu/pause-screens-menu.component'; import { NotificationsMenuComponent } from '../notifications-menu/notifications-menu.component'; - import { TopBarComponent } from './top-bar.component'; describe('TopBarComponent', () => { @@ -21,15 +17,13 @@ describe('TopBarComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [NotificationsMenuComponent, PauseScreensMenuComponent, TopBarComponent], + declarations: [NotificationsMenuComponent, TopBarComponent], imports: [ ClassroomMonitorTestingModule, - FormsModule, - MatDividerModule, + PauseScreensMenuComponent, MatIconModule, MatListModule, MatMenuModule, - MatSlideToggleModule, MatToolbarModule, MatTooltipModule ] diff --git a/src/messages.xlf b/src/messages.xlf index 91e8f322637..3b108413298 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -14404,7 +14404,7 @@ The branches will be removed but the steps will remain in the unit. 28 - + Period: src/assets/wise5/classroomMonitor/classroomMonitorComponents/pause-screens-menu/pause-screens-menu.component.html