Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Component, Input } from '@angular/core';
import { NotebookService } from '../../../assets/wise5/services/notebookService';
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { Subscription } from 'rxjs';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatDialog } from '@angular/material/dialog';
import { NotebookNotesComponent } from '../notebook-notes/notebook-notes.component';

@Component({
imports: [MatButtonModule, MatIconModule, MatTooltipModule],
Expand All @@ -17,7 +18,7 @@ export class NotebookLauncherComponent {
private subscription: Subscription = new Subscription();

constructor(
private notebookService: NotebookService,
private dialog: MatDialog,
private projectService: ProjectService
) {}

Expand All @@ -35,6 +36,8 @@ export class NotebookLauncherComponent {
}

protected showNotes(): void {
this.notebookService.setNotesVisible(true);
this.dialog.open(NotebookNotesComponent, {
panelClass: 'dialog-lg'
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@for (note of group.items; track note) {
@if (note.serverDeleteTime == null) {
<notebook-item
class="w-full sm:w-1/2"
class="w-full sm:w-1/2 md:w-1/3 lg:w-1/4"
[config]="config"
[group]="group.name"
[itemId]="note.localNotebookItemId"
Expand Down
24 changes: 10 additions & 14 deletions src/app/notebook/notebook-notes/notebook-notes.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, ViewEncapsulation } from '@angular/core';
import { Component, Inject, Input, Optional, ViewEncapsulation } from '@angular/core';
import { Subscription } from 'rxjs';
import { ConfigService } from '../../../assets/wise5/services/configService';
import { NotebookService } from '../../../assets/wise5/services/notebookService';
Expand All @@ -13,6 +13,7 @@ import { MatDividerModule } from '@angular/material/divider';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';

@Component({
imports: [
Expand All @@ -34,9 +35,6 @@ export class NotebookNotesComponent extends NotebookParentComponent {
protected groups = [];
private groupNameToGroup = {};
protected hasPrivateNotes: boolean = false;
protected insertArgs: any = {
insertMode: false
};
protected label: any;
protected selectedTabIndex = 0;
private subscriptions: Subscription = new Subscription();
Expand All @@ -46,9 +44,16 @@ export class NotebookNotesComponent extends NotebookParentComponent {
configService: ConfigService,
private dataService: StudentDataService,
NotebookService: NotebookService,
private projectService: ProjectService
private projectService: ProjectService,
@Optional() @Inject(MAT_DIALOG_DATA) public insertArgs: any
) {
super(configService, NotebookService);
this.insertArgs = this.insertArgs ?? {
insertMode: false
};
if (this.insertArgs.visibleSpace) {
this.selectedTabIndex = this.insertArgs.visibleSpace === 'public' ? 1 : 0;
}
}

ngOnInit(): void {
Expand All @@ -73,15 +78,6 @@ export class NotebookNotesComponent extends NotebookParentComponent {
})
);

this.subscriptions.add(
this.NotebookService.insertMode$.subscribe((args) => {
this.insertArgs = args;
if (args.visibleSpace) {
this.selectedTabIndex = args.visibleSpace === 'public' ? 1 : 0;
}
})
);

this.subscriptions.add(
this.NotebookService.publicNotebookItemsRetrieved$.subscribe(() => {
for (const group of this.groups) {
Expand Down
9 changes: 7 additions & 2 deletions src/app/notebook/notebook-report/notebook-report.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { NotebookService } from '../../../assets/wise5/services/notebookService'
import { ProjectService } from '../../../assets/wise5/services/projectService';
import { NotebookParentComponent } from '../notebook-parent/notebook-parent.component';
import { BreakpointObserver } from '@angular/cdk/layout';
import { NotebookNotesComponent } from '../notebook-notes/notebook-notes.component';
import { MatDialog } from '@angular/material/dialog';

@Component({
imports: [
Expand Down Expand Up @@ -48,6 +50,7 @@ export class NotebookReportComponent extends NotebookParentComponent {
constructor(
private breakpointObserver: BreakpointObserver,
configService: ConfigService,
private dialog: MatDialog,
notebookService: NotebookService,
private projectService: ProjectService
) {
Expand Down Expand Up @@ -148,8 +151,10 @@ export class NotebookReportComponent extends NotebookParentComponent {
}

protected addNotebookItemContent($event: any): void {
this.NotebookService.setInsertMode({ insertMode: true, requester: 'report' });
this.NotebookService.setNotesVisible(true);
this.dialog.open(NotebookNotesComponent, {
data: { insertMode: true, requester: 'report' },
panelClass: 'dialog-md'
});
}

protected changed(value: string): void {
Expand Down
33 changes: 19 additions & 14 deletions src/assets/wise5/components/component-student.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ComponentStateRequest } from './ComponentStateRequest';
import { ComponentStateWrapper } from './ComponentStateWrapper';
import { Annotation } from '../common/Annotation';
import $ from 'jquery';
import { NotebookNotesComponent } from '../../../app/notebook/notebook-notes/notebook-notes.component';

@Directive()
export abstract class ComponentStudent {
Expand Down Expand Up @@ -630,14 +631,16 @@ export abstract class ComponentStudent {
}

copyPublicNotebookItem() {
this.notebookService.setInsertMode({
nodeId: this.nodeId,
componentId: this.componentId,
insertMode: true,
requester: this.nodeId + '-' + this.componentId,
visibleSpace: 'public'
this.dialog.open(NotebookNotesComponent, {
data: {
nodeId: this.nodeId,
componentId: this.componentId,
insertMode: true,
requester: this.nodeId + '-' + this.componentId,
visibleSpace: 'public'
},
panelClass: 'dialog-md'
});
this.notebookService.setNotesVisible(true);
}

isNotebookEnabled() {
Expand Down Expand Up @@ -745,14 +748,16 @@ export abstract class ComponentStudent {
}

copyPublicNotebookItemButtonClicked(): void {
this.notebookService.setInsertMode({
nodeId: this.nodeId,
componentId: this.componentId,
insertMode: true,
requester: this.nodeId + '-' + this.componentId,
visibleSpace: 'public'
this.dialog.open(NotebookNotesComponent, {
data: {
nodeId: this.nodeId,
componentId: this.componentId,
insertMode: true,
requester: this.nodeId + '-' + this.componentId,
visibleSpace: 'public'
},
panelClass: 'dialog-md'
});
this.notebookService.setNotesVisible(true);
}

getElementById(id: string, getFirstResult: boolean = false): any {
Expand Down
15 changes: 1 addition & 14 deletions src/assets/wise5/services/notebookService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ export class NotebookService {
public publicNotebookItemsRetrieved$ = this.publicNotebookItemsRetrievedSource.asObservable();
private showReportAnnotationsSource: Subject<void> = new Subject<void>();
public showReportAnnotations$ = this.showReportAnnotationsSource.asObservable();
private notesVisibleSource: Subject<boolean> = new Subject<boolean>();
public notesVisible$ = this.notesVisibleSource.asObservable();
private insertModeSource: Subject<any> = new Subject<any>();
public insertMode$ = this.insertModeSource.asObservable();
private reportFullScreenSource: Subject<boolean> = new Subject<boolean>();
public reportFullScreen$ = this.reportFullScreenSource.asObservable();

Expand Down Expand Up @@ -641,16 +637,7 @@ export class NotebookService {
}

closeNotes(): void {
this.setNotesVisible(false);
this.setInsertMode({ insertMode: false });
}

setNotesVisible(value: boolean): void {
this.notesVisibleSource.next(value);
}

setInsertMode(args: any): void {
this.insertModeSource.next(args);
this.dialog.closeAll();
}

setReportFullScreen(value: boolean): void {
Expand Down
4 changes: 0 additions & 4 deletions src/assets/wise5/vle/vle.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
<link rel="stylesheet" [href]="projectStylePath | safeUrl" />
@if (initialized) {
<mat-drawer-container [hasBackdrop]="false">
<mat-drawer #drawer mode="over" position="end" (keydown.escape)="closeNotes()">
<notebook-notes [config]="notebookConfig" />
</mat-drawer>
@if (chatbotEnabled) {
<mat-drawer
#chatbotDrawer
[mode]="mdScreen ? 'over' : 'side'"
position="end"
(keydown.escape)="chatbotVisible = false"
Expand Down
23 changes: 1 addition & 22 deletions src/assets/wise5/vle/vle.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { Node } from '../common/Node';
import { NodeComponent } from './node/node.component';
import { NodeNavigationComponent } from '../directives/node-navigation/node-navigation.component';
import { NodeStatusService } from '../services/nodeStatusService';
import { NotebookNotesComponent } from '../../../app/notebook/notebook-notes/notebook-notes.component';
import { NotebookReportComponent } from '../../../app/notebook/notebook-report/notebook-report.component';
import { NotebookService } from '../services/notebookService';
import { NotificationService } from '../services/notificationService';
Expand Down Expand Up @@ -49,7 +48,6 @@ import { BreakpointObserver } from '@angular/cdk/layout';
NavigationComponent,
NodeComponent,
NodeNavigationComponent,
NotebookNotesComponent,
NotebookReportComponent,
RunEndedAndLockedMessageComponent,
SafeUrl,
Expand All @@ -67,11 +65,10 @@ export class VLEComponent implements AfterViewInit {
protected chatbotVisible: boolean = false;
protected currentNode: Node;
@ViewChild('defaultVLETemplate') private defaultVLETemplate: TemplateRef<any>;
@ViewChild('drawer') public drawer: any;
protected initialized: boolean;
private isSurvey: boolean;
protected layoutState: string;
private mdScreen: boolean;
protected mdScreen: boolean;
protected notebookConfig: any;
protected notesEnabled: boolean = false;
protected notesVisible: boolean = false;
Expand Down Expand Up @@ -205,14 +202,9 @@ export class VLEComponent implements AfterViewInit {
return convertToPNGFile(canvas);
}

closeNotes(): void {
this.notebookService.closeNotes();
}

private initializeSubscriptions(): void {
this.subscribeToShowSessionWarning();
this.subscribeToCurrentNodeChanged();
this.subscribeToNotesVisible();
this.subscribeToReportFullScreen();
this.subscribeToViewCurrentAmbientNotification();
this.subscriptions.add(this.projectService.projectParsed$.subscribe(() => this.setProject()));
Expand Down Expand Up @@ -269,19 +261,6 @@ export class VLEComponent implements AfterViewInit {
);
}

private subscribeToNotesVisible(): void {
this.subscriptions.add(
this.notebookService.notesVisible$.subscribe((notesVisible: boolean) => {
this.notesVisible = notesVisible;
if (this.notesVisible) {
this.drawer.open();
} else {
this.drawer.close();
}
})
);
}

private subscribeToReportFullScreen(): void {
this.subscriptions.add(
this.notebookService.reportFullScreen$.subscribe((full: boolean) => {
Expand Down
6 changes: 3 additions & 3 deletions src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -7079,7 +7079,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
<source>Personal</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/notebook/notebook-notes/notebook-notes.component.ts</context>
<context context-type="linenumber">119</context>
<context context-type="linenumber">115</context>
</context-group>
</trans-unit>
<trans-unit id="4929778113156900100" datatype="html">
Expand Down Expand Up @@ -10666,7 +10666,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/vle/vle.component.ts</context>
<context context-type="linenumber">232</context>
<context context-type="linenumber">224</context>
</context-group>
</trans-unit>
<trans-unit id="537022937435161177" datatype="html">
Expand All @@ -10681,7 +10681,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/vle/vle.component.ts</context>
<context context-type="linenumber">233</context>
<context context-type="linenumber">225</context>
</context-group>
</trans-unit>
<trans-unit id="3407061818321766940" datatype="html">
Expand Down
Loading