From fef30f4bea847c59635635fba3c91799478454b1 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 30 Dec 2025 01:20:29 +0200 Subject: [PATCH] chore(client): fix typecheck --- apps/client/src/types-pdfjs.d.ts | 3 +++ apps/client/src/widgets/collections/NoteList.tsx | 5 +++-- apps/client/src/widgets/collections/view_mode_storage.ts | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 apps/client/src/types-pdfjs.d.ts diff --git a/apps/client/src/types-pdfjs.d.ts b/apps/client/src/types-pdfjs.d.ts new file mode 100644 index 000000000..54a440f16 --- /dev/null +++ b/apps/client/src/types-pdfjs.d.ts @@ -0,0 +1,3 @@ +interface Window { + TRILIUM_VIEW_HISTORY_STORE?: object; +} diff --git a/apps/client/src/widgets/collections/NoteList.tsx b/apps/client/src/widgets/collections/NoteList.tsx index 5626cc33c..ec80e6b19 100644 --- a/apps/client/src/widgets/collections/NoteList.tsx +++ b/apps/client/src/widgets/collections/NoteList.tsx @@ -11,7 +11,8 @@ import froca from "../../services/froca"; import { subscribeToMessages, unsubscribeToMessage as unsubscribeFromMessage } from "../../services/ws"; import { useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumEvent } from "../react/hooks"; import { allViewTypes, ViewModeMedia, ViewModeProps, ViewTypeOptions } from "./interface"; -import ViewModeStorage from "./view_mode_storage"; +import ViewModeStorage, { type ViewModeStorageType } from "./view_mode_storage"; + interface NoteListProps { note: FNote | null | undefined; notePath: string | null | undefined; @@ -215,7 +216,7 @@ export function useNoteIds(note: FNote | null | undefined, viewType: ViewTypeOpt return noteIds; } -export function useViewModeConfig(note: FNote | null | undefined, viewType: ViewTypeOptions | undefined) { +export function useViewModeConfig(note: FNote | null | undefined, viewType: ViewModeStorageType | undefined) { const [ viewConfig, setViewConfig ] = useState<{ config: T | undefined; storeFn: (data: T) => void; diff --git a/apps/client/src/widgets/collections/view_mode_storage.ts b/apps/client/src/widgets/collections/view_mode_storage.ts index 95c3ff800..b8c3b94f2 100644 --- a/apps/client/src/widgets/collections/view_mode_storage.ts +++ b/apps/client/src/widgets/collections/view_mode_storage.ts @@ -4,14 +4,16 @@ import { ViewTypeOptions } from "../collections/interface"; const ATTACHMENT_ROLE = "viewConfig"; +export type ViewModeStorageType = ViewTypeOptions | "pdfHistory"; + export default class ViewModeStorage { private note: FNote; private attachmentName: string; - constructor(note: FNote, viewType: ViewTypeOptions) { + constructor(note: FNote, viewType: ViewModeStorageType) { this.note = note; - this.attachmentName = viewType + ".json"; + this.attachmentName = `${viewType}.json`; } async store(data: T) {