From e4a416ec2f4af21729368476f451a47770635eb2 Mon Sep 17 00:00:00 2001 From: Evan Fiordeliso Date: Mon, 30 Jun 2025 14:26:55 -0400 Subject: [PATCH] Reorganize utils dir --- src/main.ts | 7 +-- src/types.ts | 8 ---- .../ReadingLogCodeBlockView.svelte | 2 +- src/ui/modals/ReadingLogEntryEditModal.ts | 2 +- .../ReadingLogEntryEditModalView.svelte | 2 +- src/utils/{storage.ts => ReadingLog.ts} | 46 ++++--------------- src/utils/Storage.ts | 34 ++++++++++++++ src/utils/{templater.ts => Templater.ts} | 0 8 files changed, 51 insertions(+), 50 deletions(-) rename src/utils/{storage.ts => ReadingLog.ts} (65%) create mode 100644 src/utils/Storage.ts rename src/utils/{templater.ts => Templater.ts} (100%) diff --git a/src/main.ts b/src/main.ts index a443f35..eac44d1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,7 +5,7 @@ import { BookTrackerSettingTab, } from "@ui/settings"; import { getBookByLegacyId, type SearchResult } from "@data-sources/goodreads"; -import { Templater } from "@utils/templater"; +import { Templater } from "@utils/Templater"; import { GoodreadsSearchModal, GoodreadsSearchSuggestModal, @@ -18,7 +18,8 @@ import { READ_STATE, TO_BE_READ_STATE, } from "./const"; -import { ReadingLog, Storage } from "@utils/storage"; +import { Storage } from "@utils/Storage"; +import { ReadingLog } from "@utils/ReadingLog"; import { registerReadingLogCodeBlockProcessor } from "@ui/code-blocks"; export default class BookTrackerPlugin extends Plugin { @@ -32,7 +33,7 @@ export default class BookTrackerPlugin extends Plugin { this.templater = new Templater(this.app); this.storage = new Storage(this.app, this); - this.readingLog = new ReadingLog(this); + this.readingLog = new ReadingLog(this.storage); this.addCommand({ id: "search-goodreads", diff --git a/src/types.ts b/src/types.ts index d05c42e..193297f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -21,11 +21,3 @@ export interface Book { isbn: string; isbn13: string; } - -export interface ReadingLogEntry { - book: string; - pagesRead: number; - pagesReadTotal: number; - pagesRemaining: number; - createdAt: Date; -} diff --git a/src/ui/code-blocks/ReadingLogCodeBlockView.svelte b/src/ui/code-blocks/ReadingLogCodeBlockView.svelte index 09a6765..ae50d10 100644 --- a/src/ui/code-blocks/ReadingLogCodeBlockView.svelte +++ b/src/ui/code-blocks/ReadingLogCodeBlockView.svelte @@ -1,5 +1,5 @@