From 00cc1ffe746d9a3d41da56f3b81a4c1b7c71361c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Mon, 21 Jul 2025 14:49:13 +0300 Subject: [PATCH] feat(views/board): add into view type switcher --- .../src/translations/en/translation.json | 3 ++- .../widgets/ribbon_widgets/book_properties.ts | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 1ef41d3f0..073edc053 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.ts index 144491442..bcb39e6ca 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 = { + 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*/`
@@ -41,11 +51,9 @@ const TPL = /*html*/` ${t("book_properties.view_type")}:   
@@ -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 })); }