refactor(note_list): use object for constructor arg

This commit is contained in:
Elian Doran
2025-06-27 21:51:38 +03:00
parent bb0f384a39
commit f8e10f36db
2 changed files with 7 additions and 9 deletions

View File

@@ -12,14 +12,8 @@ export default class NoteListRenderer {
private viewType: ViewTypeOptions; private viewType: ViewTypeOptions;
public viewMode: ViewMode<any> | null; public viewMode: ViewMode<any> | null;
constructor($parent: JQuery<HTMLElement>, parentNote: FNote, noteIds: string[], showNotePath: boolean = false) { constructor(args: ViewModeArgs) {
this.viewType = this.#getViewType(parentNote); this.viewType = this.#getViewType(args.parentNote);
const args: ViewModeArgs = {
$parent,
parentNote,
noteIds,
showNotePath
};
switch (this.viewType) { switch (this.viewType) {
case "list": case "list":

View File

@@ -76,7 +76,11 @@ export default class NoteListWidget extends NoteContextAwareWidget {
} }
async renderNoteList(note: FNote) { async renderNoteList(note: FNote) {
const noteListRenderer = new NoteListRenderer(this.$content, note, note.getChildNoteIds()); const noteListRenderer = new NoteListRenderer({
$parent: this.$content,
parentNote: note,
noteIds: note.getChildNoteIds()
});
this.$widget.toggleClass("full-height", noteListRenderer.isFullHeight); this.$widget.toggleClass("full-height", noteListRenderer.isFullHeight);
await noteListRenderer.renderList(); await noteListRenderer.renderList();
this.viewMode = noteListRenderer.viewMode; this.viewMode = noteListRenderer.viewMode;