Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(views/board): add into view type switcher
Elian Doran00cc1ffe746d
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 1ef41d3f09..073edc053a 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -762,7 +762,8 @@"invalid_view_type": "Invalid view type '{{type}}'","calendar": "Calendar","table": "Table",- "geo-map": "Geo Map"+ "geo-map": "Geo Map",+ "board": "Board"},"edited_notes": {"no_edited_notes_found": "No edited notes on this day yet...",diff --git a/apps/client/src/widgets/ribbon_widgets/book_properties.ts b/apps/client/src/widgets/ribbon_widgets/book_properties.tsindex 1444914423..bcb39e6cab 100644--- a/apps/client/src/widgets/ribbon_widgets/book_properties.ts+++ b/apps/client/src/widgets/ribbon_widgets/book_properties.ts@@ -5,6 +5,16 @@ import type FNote from "../../entities/fnote.js";import type { EventData } from "../../components/app_context.js";import { bookPropertiesConfig, BookProperty } from "./book_properties_config.js";import attributes from "../../services/attributes.js";+import type { ViewTypeOptions } from "../../services/note_list_renderer.js";++const VIEW_TYPE_MAPPINGS: Record<ViewTypeOptions, string> = {+ grid: t("book_properties.grid"),+ list: t("book_properties.list"),+ calendar: t("book_properties.calendar"),+ table: t("book_properties.table"),+ geoMap: t("book_properties.geo-map"),+ board: t("book_properties.board")+};const TPL = /*html*/`<div class="book-properties-widget">@@ -41,11 +51,9 @@ const TPL = /*html*/`<span style="white-space: nowrap">${t("book_properties.view_type")}: </span><select class="view-type-select form-select form-select-sm">- <option value="grid">${t("book_properties.grid")}</option>- <option value="list">${t("book_properties.list")}</option>- <option value="calendar">${t("book_properties.calendar")}</option>- <option value="table">${t("book_properties.table")}</option>- <option value="geoMap">${t("book_properties.geo-map")}</option>+ ${Object.entries(VIEW_TYPE_MAPPINGS).map(([type, label]) => `+ <option value="${type}">${label}</option>+ `).join("")}</select></div>@@ -115,7 +123,7 @@ export default class BookPropertiesWidget extends NoteContextAwareWidget {return;}- if (!["list", "grid", "calendar", "table", "geoMap"].includes(type)) {+ if (!VIEW_TYPE_MAPPINGS.hasOwnProperty(type)) {throw new Error(t("book_properties.invalid_view_type", { type }));}