-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d3c9cf
commit 22f1e0c
Showing
3 changed files
with
637 additions
and
429 deletions.
There are no files selected for viewing
90 changes: 46 additions & 44 deletions
90
src/app/_observation-feed/observation-feed/observation-feed.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,48 +1,50 @@ | ||
<div class="standard-container"> | ||
<div class="d-flex justify-content-between"> | ||
<h1 data-testid="title">{{ title() }}</h1> | ||
<app-filter-control [currentFilter]="filter()"></app-filter-control> | ||
</div> | ||
|
||
@for (item of _service.observations | async; track item.observationId) { | ||
@defer (on viewport) { | ||
<!-- <app-question-item [question]="question" (loaded)="loaded($event)"/> --> | ||
<app-observation-feed-item [observation]="item" (loaded)="loaded($event)"></app-observation-feed-item> | ||
} @placeholder { | ||
<div>loading...</div> | ||
} } | ||
<div class="d-flex justify-content-between"> | ||
<h1 data-testid="title">{{ title() }}</h1> | ||
<app-filter-control [currentFilter]="filter()"></app-filter-control> | ||
</div> | ||
|
||
<!-- @for (item of _service.observations | async; track $index) { | ||
<app-observation-feed-item [observation]="item"></app-observation-feed-item> | ||
} --> | ||
<!-- @defer (when _service.observations()) { --> | ||
<!-- --> | ||
@for (item of _service.observations(); track item.observationId) { | ||
<!-- --> | ||
@defer (on viewport) { | ||
<!-- --> | ||
<app-observation-feed-item | ||
[observation]="item" | ||
(loaded)="fetchMore($event)" | ||
></app-observation-feed-item> | ||
} @placeholder () { | ||
<!-- problem here to decide on --> | ||
<div>hello...........................</div> | ||
} } | ||
<!-- empty block not needed: isAllLoaded block below covers this scenario --> | ||
<!-- @empty { <p>this is empty...........................</p> } --> | ||
<!-- } --> | ||
|
||
<!-- <app-infinite-scroll (scrolled)="onScroll()"> | ||
@if (_service.allLoaded | async) { | ||
<div class="alert alert-info no-more-items" data-testid="all-loaded"> | ||
<strong>No more items</strong> You have reached the end of the feed. @if | ||
(filter() === 'network') { | ||
<p> | ||
Switch to the <a [routerLink]="['/feed-p/public']">public feed</a> to | ||
view more observations. | ||
</p> | ||
} | ||
</div> | ||
} | ||
<!-- --> | ||
|
||
@if (_service.isLoading | async) { | ||
<app-loading></app-loading> | ||
} @if (_service.isError | async) { | ||
<p class="alert alert-danger" data-testid="error"> | ||
<strong>Whoops!</strong> There was an error retrieving the data.<br /> | ||
<button | ||
type="button" | ||
class="btn btn-primary btn-sm btn-try-again" | ||
data-testid="reload-button" | ||
(click)="reload()" | ||
> | ||
Try Again | ||
</button> | ||
</p> | ||
} | ||
</app-infinite-scroll> --> | ||
@if (_service.isLoading()) { | ||
<app-loading></app-loading> | ||
} @if (_service.isAllLoaded()) { | ||
<div class="alert alert-info no-more-items" data-testid="all-loaded"> | ||
<strong>No more items</strong> You have reached the end of the feed. @if | ||
(filter() === 'network') { | ||
<p> | ||
Switch to the <a [routerLink]="['/feed-p/public']">public feed</a> to view | ||
more observations. | ||
</p> | ||
} | ||
</div> | ||
} @if (_service.isError()) { | ||
<p class="alert alert-danger" data-testid="error"> | ||
<strong>Whoops!</strong> There was an error retrieving the data.<br /> | ||
<button | ||
type="button" | ||
class="btn btn-primary btn-sm btn-try-again" | ||
data-testid="reload-button" | ||
(click)="reload()" | ||
> | ||
Try Again | ||
</button> | ||
</p> | ||
} |
Oops, something went wrong.