diff --git a/apps/client/src/widgets/collections/legacy/ListView.tsx b/apps/client/src/widgets/collections/legacy/ListView.tsx index f6873aabf..f28f8c2bb 100644 --- a/apps/client/src/widgets/collections/legacy/ListView.tsx +++ b/apps/client/src/widgets/collections/legacy/ListView.tsx @@ -55,7 +55,10 @@ function NoteCard({ note, expand }: { note: FNote, expand?: boolean }) { - + {isExpanded && <> + + + } ) @@ -80,6 +83,20 @@ function NoteContent({ note, trim }: { note: FNote, trim?: boolean }) { return
; } +function NoteChildren({ note }: { note: FNote}) { + const imageLinks = note.getRelations("imageLink"); + const [ childNotes, setChildNotes ] = useState(); + + useEffect(() => { + note.getChildNotes().then(childNotes => { + const filteredChildNotes = childNotes.filter((childNote) => !imageLinks.find((rel) => rel.value === childNote.noteId)); + setChildNotes(filteredChildNotes); + }); + }, [ note ]); + + return childNotes?.map(childNote => ) +} + function usePagination(note: FNote, noteIds: string[]) { const [ page, setPage ] = useState(1); const [ pageNotes, setPageNotes ] = useState(); diff --git a/apps/client/src/widgets/view_widgets/list_or_grid_view.ts b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts index c61859f09..b028fbe42 100644 --- a/apps/client/src/widgets/view_widgets/list_or_grid_view.ts +++ b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts @@ -127,8 +127,6 @@ class ListOrGridView extends ViewMode<{}> { return; } - const $expander = $card.find("> .note-book-header .note-expander"); - if ((this.viewType === "grid")) { $card.append(await this.renderNoteContent(note)); } @@ -148,18 +146,6 @@ class ListOrGridView extends ViewMode<{}> { }); } } - - if (this.viewType === "list") { - const imageLinks = note.getRelations("imageLink"); - - const childNotes = (await note.getChildNotes()).filter((childNote) => !imageLinks.find((rel) => rel.value === childNote.noteId)); - - for (const childNote of childNotes) { - $content.append(await this.renderNote(childNote)); - } - } - - return $content; } }