Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/collections): fix imports of ViewTypeOptions

Elian Doran5fb843268f87
diff --git a/apps/client/src/services/in_app_help.ts b/apps/client/src/services/in_app_help.ts
index 00bc712461..9e00f7e37d 100644
--- a/apps/client/src/services/in_app_help.ts
+++ b/apps/client/src/services/in_app_help.ts
@@ -1,6 +1,6 @@
import { NoteType } from "@triliumnext/commons";
-import { ViewTypeOptions } from "./note_list_renderer";
import FNote from "../entities/fnote";
+import { ViewTypeOptions } from "../widgets/collections/interface";
export const byNoteType: Record<Exclude<NoteType, "book">, string | null> = {
canvas: null,
diff --git a/apps/client/src/widgets/FloatingButtons.tsx b/apps/client/src/widgets/FloatingButtons.tsx
index ab62428ab7..42d5ee3493 100644
--- a/apps/client/src/widgets/FloatingButtons.tsx
+++ b/apps/client/src/widgets/FloatingButtons.tsx
@@ -6,7 +6,7 @@ import { ParentComponent } from "./react/react_utils";
import { EventData, EventNames } from "../components/app_context";
import { type FloatingButtonsList, type FloatingButtonContext } from "./FloatingButtonsDefinitions";
import ActionButton from "./react/ActionButton";
-import { ViewTypeOptions } from "../services/note_list_renderer";
+import { ViewTypeOptions } from "./collections/interface";
interface FloatingButtonsProps {
items: FloatingButtonsList;
diff --git a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx
index e03e6b6375..a423d0ccd1 100644
--- a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx
+++ b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx
@@ -19,7 +19,7 @@ import { getHelpUrlForNote } from "../services/in_app_help";
import froca from "../services/froca";
import NoteLink from "./react/NoteLink";
import RawHtml from "./react/RawHtml";
-import { ViewTypeOptions } from "../services/note_list_renderer";
+import { ViewTypeOptions } from "./collections/interface";
export interface FloatingButtonContext {
parentComponent: Component;
diff --git a/apps/client/src/widgets/collections/interface.ts b/apps/client/src/widgets/collections/interface.ts
new file mode 100644
index 0000000000..ea33be4464
--- /dev/null
+++ b/apps/client/src/widgets/collections/interface.ts
@@ -0,0 +1,5 @@
+import type { ViewModeArgs } from "../view_widgets/view_mode";
+
+const allViewTypes = ["list", "grid", "calendar", "table", "geoMap", "board"] as const;
+export type ArgsWithoutNoteId = Omit<ViewModeArgs, "noteIds">;
+export type ViewTypeOptions = typeof allViewTypes[number];
diff --git a/apps/client/src/widgets/collections/note_list_renderer.ts.bak b/apps/client/src/widgets/collections/note_list_renderer.ts.bak
index 19a089e480..9660883ea5 100644
--- a/apps/client/src/widgets/collections/note_list_renderer.ts.bak
+++ b/apps/client/src/widgets/collections/note_list_renderer.ts.bak
@@ -4,13 +4,8 @@ import CalendarView from "../view_widgets/calendar_view.js";
import GeoView from "../view_widgets/geo_view/index.js";
import ListOrGridView from "../view_widgets/list_or_grid_view.js";
import TableView from "../view_widgets/table_view/index.js";
-import type { ViewModeArgs } from "../view_widgets/view_mode.js";
import type ViewMode from "../view_widgets/view_mode.js";
-const allViewTypes = ["list", "grid", "calendar", "table", "geoMap", "board"] as const;
-export type ArgsWithoutNoteId = Omit<ViewModeArgs, "noteIds">;
-export type ViewTypeOptions = typeof allViewTypes[number];
-
export default class NoteListRenderer {
private viewType: ViewTypeOptions;
diff --git a/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx b/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx
index 760194bf3a..ebacd85d30 100644
--- a/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx
+++ b/apps/client/src/widgets/ribbon/CollectionPropertiesTab.tsx
@@ -1,6 +1,5 @@
import { useContext, useMemo } from "preact/hooks";
import { t } from "../../services/i18n";
-import { ViewTypeOptions } from "../../services/note_list_renderer";
import FormSelect, { FormSelectWithGroups } from "../react/FormSelect";
import { TabContext } from "./ribbon-interface";
import { mapToKeyValueArray } from "../../services/utils";
@@ -12,6 +11,7 @@ import FNote from "../../entities/fnote";
import FormCheckbox from "../react/FormCheckbox";
import FormTextBox from "../react/FormTextBox";
import { ComponentChildren } from "preact";
+import { ViewTypeOptions } from "../collections/interface";
const VIEW_TYPE_MAPPINGS: Record<ViewTypeOptions, string> = {
grid: t("book_properties.grid"),
diff --git a/apps/client/src/widgets/ribbon/collection-properties-config.ts b/apps/client/src/widgets/ribbon/collection-properties-config.ts
index fe54c25f58..6a0c74d04e 100644
--- a/apps/client/src/widgets/ribbon/collection-properties-config.ts
+++ b/apps/client/src/widgets/ribbon/collection-properties-config.ts
@@ -1,9 +1,9 @@
import { t } from "i18next";
import FNote from "../../entities/fnote";
import attributes from "../../services/attributes";
-import { ViewTypeOptions } from "../../services/note_list_renderer"
import NoteContextAwareWidget from "../note_context_aware_widget";
import { DEFAULT_MAP_LAYER_NAME, MAP_LAYERS, type MapLayer } from "../view_widgets/geo_view/map_layer";
+import { ViewTypeOptions } from "../collections/interface";
interface BookConfig {
properties: BookProperty[];
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 bb9917c679..9ab58bbbf6 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
@@ -6,7 +6,7 @@ import treeService from "../../services/tree.js";
import utils from "../../services/utils.js";
import type FNote from "../../entities/fnote.js";
import ViewMode, { type ViewModeArgs } from "./view_mode.js";
-import type { ViewTypeOptions } from "../../services/note_list_renderer.js";
+import { ViewTypeOptions } from "../collections/interface.js";
const TPL = /*html*/`
<div class="note-list">
diff --git a/apps/client/src/widgets/view_widgets/view_mode.ts b/apps/client/src/widgets/view_widgets/view_mode.ts
index 4755294f8a..2b7f02c9a5 100644
--- a/apps/client/src/widgets/view_widgets/view_mode.ts
+++ b/apps/client/src/widgets/view_widgets/view_mode.ts
@@ -2,7 +2,7 @@ import type { EventData } from "../../components/app_context.js";
import appContext from "../../components/app_context.js";
import Component from "../../components/component.js";
import type FNote from "../../entities/fnote.js";
-import type { ViewTypeOptions } from "../../services/note_list_renderer.js";
+import { ViewTypeOptions } from "../collections/interface.js";
import ViewModeStorage from "./view_mode_storage.js";
export interface ViewModeArgs {
diff --git a/apps/client/src/widgets/view_widgets/view_mode_storage.ts b/apps/client/src/widgets/view_widgets/view_mode_storage.ts
index b3bf6bda24..95c3ff8004 100644
--- a/apps/client/src/widgets/view_widgets/view_mode_storage.ts
+++ b/apps/client/src/widgets/view_widgets/view_mode_storage.ts
@@ -1,6 +1,6 @@
import type FNote from "../../entities/fnote";
-import type { ViewTypeOptions } from "../../services/note_list_renderer";
import server from "../../services/server";
+import { ViewTypeOptions } from "../collections/interface";
const ATTACHMENT_ROLE = "viewConfig";