-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display error message when record not loaded (#27)
- Loading branch information
Showing
3 changed files
with
89 additions
and
76 deletions.
There are no files selected for viewing
161 changes: 85 additions & 76 deletions
161
apps/webcomponents/src/app/components/gn-record-view/gn-record-view.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 |
---|---|---|
@@ -1,88 +1,97 @@ | ||
<ng-container *ngrxLet="record$ as record"> | ||
<gn-ui-content-ghost | ||
ghostClass="w-full h-full" | ||
[showContent]="!!record?.title" | ||
> | ||
<div class="font-title text-[28px] line-clamp-3 mb-4"> | ||
{{ record.title }} | ||
</div> | ||
<ng-container *ngIf="record; else loadingOrError"> | ||
<gn-ui-content-ghost | ||
ghostClass="w-full h-full" | ||
[showContent]="!!record?.title" | ||
> | ||
<div class="font-title text-[28px] line-clamp-3 mb-4"> | ||
{{ record.title }} | ||
</div> | ||
|
||
<gn-ui-metadata-info [metadata]="record"></gn-ui-metadata-info> | ||
<div class="grid grid-cols-2 items-center mt-5"> | ||
<gn-ui-image-overlay-preview | ||
class="block h-[185px] mb-5 mr-2" | ||
*ngIf="record?.overviews?.length > 0" | ||
[imageUrl]="record?.overviews?.[0]?.url" | ||
> | ||
</gn-ui-image-overlay-preview> | ||
<gn-ui-metadata-info [metadata]="record"></gn-ui-metadata-info> | ||
<div class="grid grid-cols-2 items-center mt-5"> | ||
<gn-ui-image-overlay-preview | ||
class="block h-[185px] mb-5 mr-2" | ||
*ngIf="record?.overviews?.length > 0" | ||
[imageUrl]="record?.overviews?.[0]?.url" | ||
> | ||
</gn-ui-image-overlay-preview> | ||
|
||
<gn-ui-metadata-contact | ||
class="pl-2" | ||
[metadata]="record" | ||
></gn-ui-metadata-contact> | ||
</div> | ||
<div *ngIf="getDownloads(record?.onlineResources)?.length > 0"> | ||
<div | ||
class="font-title text-lg mt-4 mb-2 flex flex-row gap-4 items-center" | ||
> | ||
<span translate>record.metadata.download</span> | ||
<gn-ui-previous-next-buttons | ||
*ngIf="downloads?.pagesCount > 1" | ||
[listComponent]="downloads" | ||
></gn-ui-previous-next-buttons> | ||
<gn-ui-metadata-contact | ||
class="pl-2" | ||
[metadata]="record" | ||
></gn-ui-metadata-contact> | ||
</div> | ||
<div *ngIf="getDownloads(record?.onlineResources)?.length > 0"> | ||
<div | ||
class="font-title text-lg mt-4 mb-2 flex flex-row gap-4 items-center" | ||
> | ||
<span translate>record.metadata.download</span> | ||
<gn-ui-previous-next-buttons | ||
*ngIf="downloads?.pagesCount > 1" | ||
[listComponent]="downloads" | ||
></gn-ui-previous-next-buttons> | ||
</div> | ||
<gn-ui-block-list | ||
[pageSize]="4" | ||
containerClass="gap-4 pt-3 pb-6" | ||
#downloads | ||
> | ||
<gn-ui-download-item | ||
*ngFor="let otherLink of getDownloads(record?.onlineResources)" | ||
[link]="otherLink" | ||
></gn-ui-download-item> | ||
</gn-ui-block-list> | ||
</div> | ||
<gn-ui-block-list | ||
[pageSize]="4" | ||
containerClass="gap-4 pt-3 pb-6" | ||
#downloads | ||
> | ||
<gn-ui-download-item | ||
*ngFor="let otherLink of getDownloads(record?.onlineResources)" | ||
[link]="otherLink" | ||
></gn-ui-download-item> | ||
</gn-ui-block-list> | ||
</div> | ||
|
||
<div *ngIf="getLinks(record?.onlineResources)?.length > 0"> | ||
<div | ||
class="font-title text-lg mt-4 mb-2 flex flex-row gap-4 items-center" | ||
> | ||
<span translate>record.metadata.links</span> | ||
<gn-ui-previous-next-buttons | ||
*ngIf="links?.pagesCount > 1" | ||
[listComponent]="links" | ||
></gn-ui-previous-next-buttons> | ||
<div *ngIf="getLinks(record?.onlineResources)?.length > 0"> | ||
<div | ||
class="font-title text-lg mt-4 mb-2 flex flex-row gap-4 items-center" | ||
> | ||
<span translate>record.metadata.links</span> | ||
<gn-ui-previous-next-buttons | ||
*ngIf="links?.pagesCount > 1" | ||
[listComponent]="links" | ||
></gn-ui-previous-next-buttons> | ||
</div> | ||
<gn-ui-block-list | ||
[pageSize]="4" | ||
containerClass="gap-4 pt-3 pb-6" | ||
#links | ||
> | ||
<gn-ui-link-card | ||
*ngFor="let otherLink of getLinks(record?.onlineResources)" | ||
[link]="otherLink" | ||
[compact]="true" | ||
></gn-ui-link-card> | ||
</gn-ui-block-list> | ||
</div> | ||
<gn-ui-block-list [pageSize]="4" containerClass="gap-4 pt-3 pb-6" #links> | ||
<gn-ui-link-card | ||
*ngFor="let otherLink of getLinks(record?.onlineResources)" | ||
[link]="otherLink" | ||
[compact]="true" | ||
></gn-ui-link-card> | ||
</gn-ui-block-list> | ||
</div> | ||
|
||
<div *ngIf="getAPIs(record?.onlineResources)?.length > 0"> | ||
<div | ||
class="font-title text-lg mt-4 mb-2 flex flex-row gap-4 items-center" | ||
> | ||
<span translate>record.metadata.api</span> | ||
<gn-ui-previous-next-buttons | ||
*ngIf="apis?.pagesCount > 1" | ||
[listComponent]="apis" | ||
></gn-ui-previous-next-buttons> | ||
<div *ngIf="getAPIs(record?.onlineResources)?.length > 0"> | ||
<div | ||
class="font-title text-lg mt-4 mb-2 flex flex-row gap-4 items-center" | ||
> | ||
<span translate>record.metadata.api</span> | ||
<gn-ui-previous-next-buttons | ||
*ngIf="apis?.pagesCount > 1" | ||
[listComponent]="apis" | ||
></gn-ui-previous-next-buttons> | ||
</div> | ||
<gn-ui-block-list [pageSize]="4" containerClass="gap-4 pt-3 pb-6" #apis> | ||
<gn-ui-api-card | ||
*ngFor="let otherLink of getAPIs(record?.onlineResources)" | ||
[link]="otherLink" | ||
[currentLink]="otherLink" | ||
></gn-ui-api-card> | ||
</gn-ui-block-list> | ||
</div> | ||
<gn-ui-block-list [pageSize]="4" containerClass="gap-4 pt-3 pb-6" #apis> | ||
<gn-ui-api-card | ||
*ngFor="let otherLink of getAPIs(record?.onlineResources)" | ||
[link]="otherLink" | ||
[currentLink]="otherLink" | ||
></gn-ui-api-card> | ||
</gn-ui-block-list> | ||
</div> | ||
</gn-ui-content-ghost> | ||
</gn-ui-content-ghost> | ||
</ng-container> | ||
</ng-container> | ||
|
||
<ng-template #loadingOrError> | ||
<p *ngIf="(record$ | async) === null">No record found for the provided ID.</p> | ||
<gn-ui-error | ||
[type]="errorTypes.RECORD_NOT_FOUND" | ||
[recordId]="recordId" | ||
></gn-ui-error> | ||
</ng-template> |
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