feat(in_app_help): contextual help for book types

This commit is contained in:
Elian Doran
2025-02-16 18:09:01 +02:00
parent c17d10114f
commit e73ea36161
3 changed files with 27 additions and 7 deletions

View File

@@ -4,9 +4,11 @@ import ListOrGridView from "../widgets/view_widgets/list_or_grid_view.js";
import type { ViewModeArgs } from "../widgets/view_widgets/view_mode.js";
import type ViewMode from "../widgets/view_widgets/view_mode.js";
export type ViewTypeOptions = "list" | "grid" | "calendar";
export default class NoteListRenderer {
private viewType: string;
private viewType: ViewTypeOptions;
public viewMode: ViewMode | null;
constructor($parent: JQuery<HTMLElement>, parentNote: FNote, noteIds: string[], showNotePath: boolean = false) {
@@ -27,14 +29,14 @@ export default class NoteListRenderer {
}
}
#getViewType(parentNote: FNote): string {
#getViewType(parentNote: FNote): ViewTypeOptions {
const viewType = parentNote.getLabelValue("viewType");
if (!["list", "grid", "calendar"].includes(viewType || "")) {
// when not explicitly set, decide based on the note type
return parentNote.type === "search" ? "list" : "grid";
} else {
return viewType as string;
return viewType as ViewTypeOptions;
}
}