Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/image image component #164

Open
wants to merge 33 commits into
base: develop
Choose a base branch
from

Conversation

saramaenza
Copy link
Contributor

No description provided.

src/app/components/osd/osd.component.ts Outdated Show resolved Hide resolved
src/app/components/osd/osd.component.ts Outdated Show resolved Hide resolved
src/app/components/osd/osd.component.ts Outdated Show resolved Hide resolved
[manifestURL]="manifest">
[manifestURL]="manifest"
[page]="imageIndex"
(data)="eventHandler($event)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are vinding to page change event use that instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

page change event does not consider the page change through arrows

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make the buttons fire that event instead

src/app/panels/image-panel/image-panel.component.ts Outdated Show resolved Hide resolved
});
this._imageIndex = 0;
this.currentImg = this.images[this.page].label;
this.cdref.detectChanges();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you call explicitly change detection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually such errors is due to an improper initialisation.

}
}

isMsDescOpen(event: boolean){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be just this.msDescOpen why do you need the other lines?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check naming, of parameters, you call event boolean, strings and actual events

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be a setter

}

private initGridster() {
this.layoutOptions = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can put this at line 10.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to set layout options here or is it enough to set at construction time?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably move it in the constructor!

@saramaenza saramaenza force-pushed the feature/image-image-component branch from 96ab1fc to 3e05ba6 Compare January 5, 2022 18:46
@@ -112,12 +114,14 @@ export class OsdComponent implements AfterViewInit, OnDestroy {
@Input() set page(v: number) {
if (v !== this._page) {
this._page = v;
this.pageChange.next(this._page);
this.pageChange.next(this._page + 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the +1?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saramaenza can answer to @szenzaro? Why do you need the +1?

src/app/components/osd/osd.component.ts Outdated Show resolved Hide resolved
src/app/components/osd/osd.component.ts Outdated Show resolved Hide resolved
src/app/panels/image-panel/image-panel.component.ts Outdated Show resolved Hide resolved
src/app/panels/image-panel/image-panel.component.html Outdated Show resolved Hide resolved
@saramaenza saramaenza force-pushed the feature/image-image-component branch from 11ba834 to 8aeff48 Compare May 30, 2022 17:46
Copy link
Member

@ChiaraDipi ChiaraDipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@@ -112,12 +114,14 @@ export class OsdComponent implements AfterViewInit, OnDestroy {
@Input() set page(v: number) {
if (v !== this._page) {
this._page = v;
this.pageChange.next(this._page);
this.pageChange.next(this._page + 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saramaenza can answer to @szenzaro? Why do you need the +1?

@@ -174,4 +174,5 @@ export class OsdComponent implements AfterViewInit, OnDestroy {
ngOnDestroy(): void {
this.subscriptions.forEach((s) => s.unsubscribe());
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line

<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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move all these property before the contructor.

public imagePath;
public filename;

toggleImg(event){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add space before "{"

}
else {
this.currentImg = 'Error loading';
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

}

isMsDescOpen(event: boolean){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably move it in the constructor!

}

private initGridster() {
this.layoutOptions = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you move it at line 15 (15 is the new 10 XD), you can remove the method initGridster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants