Conversation
| [manifestURL]="manifest"> | ||
| [manifestURL]="manifest" | ||
| [page]="imageIndex" | ||
| (data)="eventHandler($event)" |
There was a problem hiding this comment.
Since you are vinding to page change event use that instead.
There was a problem hiding this comment.
page change event does not consider the page change through arrows
There was a problem hiding this comment.
make the buttons fire that event instead
| }); | ||
| this._imageIndex = 0; | ||
| this.currentImg = this.images[this.page].label; | ||
| this.cdref.detectChanges(); |
There was a problem hiding this comment.
Why do you call explicitly change detection?
There was a problem hiding this comment.
I added change detection because otherwise the error "ERROR Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checking" would appear in the console, since every time the image name is updated without the page being refreshed
There was a problem hiding this comment.
Usually such errors is due to an improper initialisation.
| } | ||
| } | ||
|
|
||
| isMsDescOpen(event: boolean){ |
There was a problem hiding this comment.
This should be just this.msDescOpen why do you need the other lines?
There was a problem hiding this comment.
Weird to have a check on the internal state that depends on an event that is a boolean.
Check this function again, it is probably overcomplicated.
| } | ||
| } | ||
|
|
||
| setMsDescID(event: string){ |
There was a problem hiding this comment.
Check naming, of parameters, you call event boolean, strings and actual events
| } | ||
|
|
||
| private initGridster() { | ||
| this.layoutOptions = { |
There was a problem hiding this comment.
you can put this at line 10.
There was a problem hiding this comment.
If you move it at line 15 (15 is the new 10 XD), you can remove the method initGridster
| public imagePanel2Item: GridsterItem = { cols: 1, rows: 1, y: 0, x: 1 }; | ||
|
|
||
| ngOnInit() { | ||
| this.initGridster(); |
There was a problem hiding this comment.
Do you need to set layout options here or is it enough to set at construction time?
There was a problem hiding this comment.
You can probably move it in the constructor!
96ab1fc to
3e05ba6
Compare
| if (v !== this._page) { | ||
| this._page = v; | ||
| this.pageChange.next(this._page); | ||
| this.pageChange.next(this._page + 1); |
There was a problem hiding this comment.
@saramaenza can answer to @szenzaro? Why do you need the +1?
22265c0 to
43dc59f
Compare
43dc59f to
477c9a0
Compare
11ba834 to
8aeff48
Compare
ChiaraDipi
left a comment
There was a problem hiding this comment.
Since you added a new icon, you should update also the file evt-icons-project.json into src/assets/fonts, otherwise new future icons addition will override yours!
| if (v !== this._page) { | ||
| this._page = v; | ||
| this.pageChange.next(this._page); | ||
| this.pageChange.next(this._page + 1); |
There was a problem hiding this comment.
@saramaenza can answer to @szenzaro? Why do you need the +1?
| ngOnDestroy(): void { | ||
| this.subscriptions.forEach((s) => s.unsubscribe()); | ||
| } | ||
|
|
| <div header-left> | ||
| <!-- TODO: Add dropdowns for navigation --> | ||
| <evt-ms-desc-selector #msDesc (selectionChange)="setMsDescID($event)" (msDescOpen)="setMsDescOpen($event)"></evt-ms-desc-selector> | ||
| <ng-select |
There was a problem hiding this comment.
Can you restore the TODO comment?
| <div *ngIf="msDescOpen"> | ||
| <evt-ms-desc [data]="currentMsDesc$ | async"></evt-ms-desc> | ||
| <div *ngIf="(msDesc$ | async) as msDescs"> | ||
| <div *ngFor="let msDesc of msDescs"> |
There was a problem hiding this comment.
You can use the async binding directly in the loop:
<div *ngFor="let msDesc of msDescs$ | async">
FYI, if you need to add a level to handle logic (like you did here), but don't need additional HTML you can use ng-container.
| private _imageIndex: number; | ||
| public manifest; | ||
| public imagePath; | ||
| public filename; |
There was a problem hiding this comment.
Move all these property before the contructor.
| public imagePath; | ||
| public filename; | ||
|
|
||
| toggleImg(event){ |
| else { | ||
| this.currentImg = 'Error loading'; | ||
| } | ||
| } |
There was a problem hiding this comment.
All the logic here depends on viewerData. You can try to change the @Input prop into a setter/getter and move this logic inside it.
private _vd: ViewerDataType;
@Input() set viewerData(vd: ViewerDataType) {
// Your logic goes here
}
get viewerData() {
return this._vd;
}
NB: The getter is only needed if you access viewerData elsewhere, otherwise you can omit it.
| return this.showSecondaryContent; | ||
| } | ||
|
|
||
| isMsDescOpen(event: boolean){ |
There was a problem hiding this comment.
The name of this method suggests a return value. If you don't need a return value probably you should change the name of the method.
| public imagePanel2Item: GridsterItem = { cols: 1, rows: 1, y: 0, x: 1 }; | ||
|
|
||
| ngOnInit() { | ||
| this.initGridster(); |
There was a problem hiding this comment.
You can probably move it in the constructor!
| } | ||
|
|
||
| private initGridster() { | ||
| this.layoutOptions = { |
There was a problem hiding this comment.
If you move it at line 15 (15 is the new 10 XD), you can remove the method initGridster
No description provided.