-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to customize autopilot content (#3488)
- Loading branch information
1 parent
3479aed
commit 46d6e0f
Showing
11 changed files
with
223 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
.../meetings/pages/autopilot/components/autopilot-settings/autopilot-settings.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<h1 mat-dialog-title translate>Enabled content elements</h1> | ||
<div mat-dialog-content> | ||
<div *ngFor="let option of autopilotContentElements" class="option"> | ||
<mat-checkbox | ||
(ngModelChange)="updateDisabled(option.key, $event)" | ||
[ngModel]="!disabledAutopilotContentElements[option.key]" | ||
> | ||
{{ option.description | translate }} | ||
</mat-checkbox> | ||
</div> | ||
|
||
<small translate>This settings are only applied locally.</small> | ||
</div> | ||
|
||
<div mat-dialog-actions> | ||
<button mat-button (click)="close()" translate>Close</button> | ||
</div> |
Empty file.
24 changes: 24 additions & 0 deletions
24
...etings/pages/autopilot/components/autopilot-settings/autopilot-settings.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { AutopilotSettingsComponent } from './autopilot-settings.component'; | ||
|
||
xdescribe(`AutopilotSettingsComponent`, () => { | ||
let component: AutopilotSettingsComponent; | ||
let fixture: ComponentFixture<AutopilotSettingsComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [AutopilotSettingsComponent] | ||
}).compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(AutopilotSettingsComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it(`should create`, () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
57 changes: 57 additions & 0 deletions
57
...es/meetings/pages/autopilot/components/autopilot-settings/autopilot-settings.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core'; | ||
import { MatDialogRef } from '@angular/material/dialog'; | ||
import { marker as _ } from '@colsen1991/ngx-translate-extract-marker'; | ||
import { first } from 'rxjs'; | ||
|
||
import { BaseMeetingComponent } from '../../../../base/base-meeting.component'; | ||
import { AutopilotService } from '../../services/autopilot.service'; | ||
|
||
@Component({ | ||
selector: `os-autopilot-settings`, | ||
templateUrl: `./autopilot-settings.component.html`, | ||
styleUrls: [`./autopilot-settings.component.scss`], | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class AutopilotSettingsComponent extends BaseMeetingComponent implements OnInit { | ||
public readonly autopilotContentElements: { key: string; description: string }[] = [ | ||
{ key: `title`, description: _(`Autopilot content title`) }, | ||
{ key: `list-of-speakers`, description: _(`List of speakers`) }, | ||
{ key: `moderation-note`, description: _(`Moderation note`) }, | ||
{ key: `poll-finished`, description: _(`Poll results`) }, | ||
{ key: `poll-running`, description: _(`Running poll`) }, | ||
{ key: `projector`, description: _(`Projector`) }, | ||
{ key: `speaking-times`, description: _(`Speaking times`) } | ||
]; | ||
|
||
public disabledAutopilotContentElements: { [key: string]: boolean } = {}; | ||
|
||
public constructor( | ||
private dialogRef: MatDialogRef<AutopilotSettingsComponent>, | ||
private cd: ChangeDetectorRef, | ||
private autopilotService: AutopilotService | ||
) { | ||
super(); | ||
} | ||
|
||
public ngOnInit(): void { | ||
this.autopilotService.disabledContentElements.pipe(first()).subscribe(keys => { | ||
this.disabledAutopilotContentElements = Object.assign( | ||
this.autopilotContentElements.mapToObject(el => ({ [el.key]: false })), | ||
keys | ||
); | ||
this.cd.markForCheck(); | ||
}); | ||
} | ||
|
||
public isDisabled(key: string): boolean { | ||
return this.disabledAutopilotContentElements[key] === true; | ||
} | ||
|
||
public updateDisabled(key: string, status: boolean): void { | ||
this.autopilotService.updateContentElementVisibility(key, !status); | ||
} | ||
|
||
public close(): void { | ||
this.dialogRef.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 8 additions & 6 deletions
14
.../pages/meetings/pages/autopilot/components/poll-collection/poll-collection.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.