mirror of
https://github.com/block-core/blockcore-notes.git
synced 2024-09-29 06:20:42 +00:00
Use a regular array for children for filtering (for now)
This commit is contained in:
parent
aff9368573
commit
bfef6026bf
@ -95,6 +95,24 @@ export class UIService {
|
||||
// return this.#eventsChanged.asObservable().pipe(map((data) => data.sort((a, b) => (a.created_at > b.created_at ? -1 : 1))));
|
||||
}
|
||||
|
||||
children(parentId: string): NostrEventDocument[] {
|
||||
// if (this.events.length > 4) {
|
||||
// console.log('PARENT ID:', parentId);
|
||||
// console.log(this.events);
|
||||
// }
|
||||
|
||||
const filtered = this.events.filter((d) => d.parentEventId === parentId);
|
||||
|
||||
// if (filtered.length > 0) {
|
||||
// console.log('filtered:', filtered);
|
||||
// }
|
||||
|
||||
// console.log(parentId);
|
||||
// console.log(this.events);
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
children$(parentId: string): Observable<NostrEventDocument[]> {
|
||||
// const filtered = this.events$.pipe(filter((item, index) => sorted.findIndex((e) => e.pubkey == item.pubkey) === index));
|
||||
return this.events$.pipe(
|
||||
@ -219,6 +237,7 @@ export class UIService {
|
||||
|
||||
if (eTags.length > 0) {
|
||||
event.rootEventId = eTags[0][1];
|
||||
event.parentEventId = eTags[eTags.length - 1][1];
|
||||
}
|
||||
|
||||
if (eTags.length < 2) {
|
||||
@ -226,10 +245,6 @@ export class UIService {
|
||||
event.replyEventId = eTags[1][1];
|
||||
}
|
||||
|
||||
if (eTags.length > 0) {
|
||||
event.parentEventId = eTags[eTags.length - 1][1];
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="thread-event" *ngFor="let event of ui.children$(event!.id!) | async" [ngClass]="{ 'no-lines': !optionsService.values.showLines, lines: optionsService.values.showLines }">
|
||||
<div class="thread-event" *ngFor="let event of ui.children(event!.id!)" [ngClass]="{ 'no-lines': !optionsService.values.showLines, lines: optionsService.values.showLines }">
|
||||
<!-- <span *ngIf="thread.getEvent(entry.id) as event"> -->
|
||||
<span>
|
||||
<div class="events-header">
|
||||
|
Loading…
Reference in New Issue
Block a user