mirror of
https://github.com/block-core/blockcore-notes.git
synced 2024-09-29 06:20:42 +00:00
Add rendering of 7 last items on home
This commit is contained in:
parent
f719e613f3
commit
7a97afc98d
@ -135,3 +135,7 @@
|
|||||||
gap: 1em;
|
gap: 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.view-more-container {
|
||||||
|
text-align: center;
|
||||||
|
}
|
@ -112,7 +112,19 @@
|
|||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
<mat-card class="home-card">
|
<mat-card class="events clickable" (click)="navigation.openEvent($event, event)" *ngFor="let event of latestItems$ | async; trackBy: trackByFn">
|
||||||
|
<div class="events-header">
|
||||||
|
<app-event-header [pubkey]="event.pubkey"><span class="event-date" matTooltipPosition="below">{{ event.created_at | ago }}</span> <app-directory-icon [pubkey]="event.pubkey"></app-directory-icon></app-event-header>
|
||||||
|
<app-event-actions [event]="event"></app-event-actions>
|
||||||
|
</div>
|
||||||
|
<app-content [event]="event"></app-content>
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
<p class="view-more-container">
|
||||||
|
<button mat-button routerLink="/feed">View more notes...</button>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!-- <mat-card class="home-card">
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<img mat-card-avatar src="https://material.angular.io/assets/img/examples/shiba1.jpg" />
|
<img mat-card-avatar src="https://material.angular.io/assets/img/examples/shiba1.jpg" />
|
||||||
<mat-card-title>Shiba Inu</mat-card-title>
|
<mat-card-title>Shiba Inu</mat-card-title>
|
||||||
@ -126,7 +138,7 @@
|
|||||||
<button mat-button>Like</button>
|
<button mat-button>Like</button>
|
||||||
<button mat-button>Comments</button>
|
<button mat-button>Comments</button>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</mat-card>
|
</mat-card> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -22,6 +22,8 @@ import { animate, style, transition, trigger } from '@angular/animations';
|
|||||||
import { DataService } from '../services/data';
|
import { DataService } from '../services/data';
|
||||||
import { StorageService } from '../services/storage';
|
import { StorageService } from '../services/storage';
|
||||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||||
|
import { dexieToRx } from '../shared/utilities';
|
||||||
|
import { liveQuery } from 'dexie';
|
||||||
|
|
||||||
interface DefaultProfile {
|
interface DefaultProfile {
|
||||||
pubkey: string;
|
pubkey: string;
|
||||||
@ -130,6 +132,7 @@ export class HomeComponent {
|
|||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
public options: OptionsService,
|
public options: OptionsService,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
|
public navigation: NavigationService,
|
||||||
public profileService: ProfileService,
|
public profileService: ProfileService,
|
||||||
private validator: DataValidation,
|
private validator: DataValidation,
|
||||||
public navigationService: NavigationService,
|
public navigationService: NavigationService,
|
||||||
@ -311,12 +314,6 @@ export class HomeComponent {
|
|||||||
// this.cd.detectChanges();
|
// this.cd.detectChanges();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
optionsUpdated() {
|
|
||||||
// this.allComplete = this.task.subtasks != null && this.task.subtasks.every(t => t.completed);
|
|
||||||
// Parse existing content.
|
|
||||||
this.events = this.validator.filterEvents(this.events);
|
|
||||||
}
|
|
||||||
|
|
||||||
public trackByFn(index: number, item: NostrEvent) {
|
public trackByFn(index: number, item: NostrEvent) {
|
||||||
return item.id;
|
return item.id;
|
||||||
}
|
}
|
||||||
@ -329,11 +326,11 @@ export class HomeComponent {
|
|||||||
return item.id;
|
return item.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
events: NostrEvent[] = [];
|
latestItems$ = dexieToRx(liveQuery(() => this.db.events.orderBy('created_at').reverse().limit(7).toArray()));
|
||||||
|
|
||||||
sub: any;
|
sub: any;
|
||||||
relay?: Relay;
|
relay?: Relay;
|
||||||
initialLoad = true;
|
initialLoad = true;
|
||||||
|
|
||||||
details = false;
|
details = false;
|
||||||
|
|
||||||
toggleDetails() {
|
toggleDetails() {
|
||||||
|
Loading…
Reference in New Issue
Block a user