diff --git a/manifest.json b/manifest.json
index b7b00f5..08d3ec9 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,9 +1,9 @@
{
"id": "obsidian-book-tracker",
"name": "Book Tracker",
- "version": "1.0.0",
+ "version": "1.1.0",
"minAppVersion": "0.15.0",
"description": "Simplifies tracking your reading progress and managing your book collection in Obsidian.",
"author": "FiFiTiDo",
"isDesktopOnly": false
-}
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index ed70d4f..cbde538 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "obsidian-book-tracker",
- "version": "1.0.0",
+ "version": "1.1.0",
"description": "Simplifies tracking your reading progress and managing your book collection in Obsidian.",
"main": "main.js",
"scripts": {
diff --git a/src/main.ts b/src/main.ts
index 917bba1..e83485c 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -24,6 +24,7 @@ import { Goodreads } from "@data-sources/Goodreads";
import { CreateBookFromGoodreadsUrlCommand } from "@commands/CreateBookFromGoodreadsUrlCommand";
import { registerShelfCodeBlockProcessor } from "@ui/code-blocks/ShelfCodeBlock";
import { ReloadReadingLogCommand } from "@commands/ReloadReadingLogCommand";
+import { registerReadingCalendarCodeBlockProcessor } from "@ui/code-blocks/ReadingCalendarCodeBlock";
export default class BookTrackerPlugin extends Plugin {
public settings: BookTrackerPluginSettings;
@@ -89,6 +90,7 @@ export default class BookTrackerPlugin extends Plugin {
registerReadingLogCodeBlockProcessor(this);
registerReadingStatsCodeBlockProcessor(this);
registerShelfCodeBlockProcessor(this);
+ registerReadingCalendarCodeBlockProcessor(this);
}
onunload() {}
diff --git a/src/ui/code-blocks/ReadingCalendarCodeBlock.ts b/src/ui/code-blocks/ReadingCalendarCodeBlock.ts
new file mode 100644
index 0000000..41a800a
--- /dev/null
+++ b/src/ui/code-blocks/ReadingCalendarCodeBlock.ts
@@ -0,0 +1,25 @@
+import { registerCodeBlockRenderer } from ".";
+import { SvelteCodeBlockRenderer } from "./SvelteCodeBlockRenderer";
+import ReadingCalendarCodeBlockView from "./ReadingCalendarCodeBlockView.svelte";
+import type BookTrackerPlugin from "@src/main";
+import z from "zod/v4";
+
+export function registerReadingCalendarCodeBlockProcessor(
+ plugin: BookTrackerPlugin
+): void {
+ registerCodeBlockRenderer(
+ plugin,
+ "readingcalendar",
+ (source, el) =>
+ new SvelteCodeBlockRenderer(
+ ReadingCalendarCodeBlockView,
+ plugin,
+ source,
+ el
+ )
+ );
+}
+
+export const ReadingCalendarSettingsSchema = z.object({
+ coverProperty: z.string(),
+});
diff --git a/src/ui/code-blocks/ReadingCalendarCodeBlockView.svelte b/src/ui/code-blocks/ReadingCalendarCodeBlockView.svelte
new file mode 100644
index 0000000..2593779
--- /dev/null
+++ b/src/ui/code-blocks/ReadingCalendarCodeBlockView.svelte
@@ -0,0 +1,400 @@
+
+
+
+
+
+
+
+
+
{monthNames[month]} {year}
+
+
+
+
+
+ {#each daysOfWeek as day}
+ {day} |
+ {/each}
+
+
+
+ {#each weeks as week}
+
+ {#each week as day}
+ {@const isThisMonth = day.month() === month}
+
+
+
+ {#if isThisMonth && bookMap.has(day.date())}
+ {@const data = bookMap.get(day.date())!}
+ {#each data.covers as cover}
+ {#if cover}
+ 
+ {/if}
+ {/each}
+ {/if}
+
+ |
+ {/each}
+
+ {/each}
+
+
+
+
+
diff --git a/src/ui/code-blocks/ReadingLogCodeBlock.ts b/src/ui/code-blocks/ReadingLogCodeBlock.ts
index 54e013b..710834f 100644
--- a/src/ui/code-blocks/ReadingLogCodeBlock.ts
+++ b/src/ui/code-blocks/ReadingLogCodeBlock.ts
@@ -9,16 +9,12 @@ export function registerReadingLogCodeBlockProcessor(
registerCodeBlockRenderer(
plugin,
"readinglog",
- (_source, el) => new ReadingLogCodeBlockRenderer(el, plugin)
+ (source, el) =>
+ new SvelteCodeBlockRenderer(
+ ReadingLogCodeBlockView,
+ plugin,
+ source,
+ el
+ )
);
}
-
-export class ReadingLogCodeBlockRenderer extends SvelteCodeBlockRenderer<
- typeof ReadingLogCodeBlockView
-> {
- constructor(contentEl: HTMLElement, plugin: BookTrackerPlugin) {
- super(contentEl, ReadingLogCodeBlockView, { props: { plugin } });
- }
-
- onunload() {}
-}
diff --git a/src/ui/code-blocks/ReadingLogCodeBlockView.svelte b/src/ui/code-blocks/ReadingLogCodeBlockView.svelte
index 4228865..ea9a2f5 100644
--- a/src/ui/code-blocks/ReadingLogCodeBlockView.svelte
+++ b/src/ui/code-blocks/ReadingLogCodeBlockView.svelte
@@ -2,18 +2,14 @@
import type { ReadingLogEntry } from "@utils/ReadingLog";
import { Edit, Trash, Plus } from "lucide-svelte";
import { ReadingLogEntryEditModal } from "@ui/modals";
- import type BookTrackerPlugin from "@src/main";
import { createReadingLog } from "@ui/stores/reading-log.svelte";
import { ALL_TIME } from "@ui/stores/date-filter.svelte";
import { onDestroy, onMount } from "svelte";
import OpenFileLink from "@ui/components/OpenFileLink.svelte";
import { setAppContext } from "@ui/stores/app";
+ import type { SvelteCodeBlockProps } from "./SvelteCodeBlockRenderer";
- interface Props {
- plugin: BookTrackerPlugin;
- }
-
- const { plugin }: Props = $props();
+ const { plugin }: SvelteCodeBlockProps = $props();
setAppContext(plugin.app);
const store = createReadingLog(plugin.readingLog);
@@ -32,7 +28,6 @@
const modal = new ReadingLogEntryEditModal(
plugin,
async (entry) => {
- modal.close();
await store.updateEntry(entry);
},
entry,
diff --git a/src/ui/code-blocks/ReadingStatsCodeBlock.ts b/src/ui/code-blocks/ReadingStatsCodeBlock.ts
index db759c6..939de04 100644
--- a/src/ui/code-blocks/ReadingStatsCodeBlock.ts
+++ b/src/ui/code-blocks/ReadingStatsCodeBlock.ts
@@ -11,7 +11,13 @@ export function registerReadingStatsCodeBlockProcessor(
registerCodeBlockRenderer(
plugin,
"readingstats",
- (source, el) => new ReadingStatsCodeBlockRenderer(source, el, plugin)
+ (source, el) =>
+ new SvelteCodeBlockRenderer(
+ ReadingStatsCodeBlockView,
+ plugin,
+ source,
+ el
+ )
);
}
@@ -98,19 +104,3 @@ export const ReadingStatsSectionSchema = z.object({
});
export type ReadingStatsSection = z.infer;
-
-export class ReadingStatsCodeBlockRenderer extends SvelteCodeBlockRenderer<
- typeof ReadingStatsCodeBlockView
-> {
- constructor(
- source: string,
- contentEl: HTMLElement,
- plugin: BookTrackerPlugin
- ) {
- super(contentEl, ReadingStatsCodeBlockView, {
- props: { plugin, source },
- });
- }
-
- onunload() {}
-}
diff --git a/src/ui/code-blocks/ReadingStatsCodeBlockView.svelte b/src/ui/code-blocks/ReadingStatsCodeBlockView.svelte
index 68c479d..1b710e4 100644
--- a/src/ui/code-blocks/ReadingStatsCodeBlockView.svelte
+++ b/src/ui/code-blocks/ReadingStatsCodeBlockView.svelte
@@ -20,7 +20,6 @@
createSettings,
setSettingsContext,
} from "@ui/stores/settings.svelte";
- import type BookTrackerPlugin from "@src/main";
import BookCountStat from "@ui/components/stats/BookCountStat.svelte";
import { ALL_TIME } from "@ui/stores/date-filter.svelte";
import {
@@ -28,13 +27,9 @@
setReadingLogContext,
} from "@ui/stores/reading-log.svelte";
import { setAppContext } from "@ui/stores/app";
+ import type { SvelteCodeBlockProps } from "./SvelteCodeBlockRenderer";
- interface Props {
- plugin: BookTrackerPlugin;
- source: string;
- }
-
- const { plugin, source }: Props = $props();
+ const { plugin, source }: SvelteCodeBlockProps = $props();
setAppContext(plugin.app);
const settingsStore = createSettings(plugin);
diff --git a/src/ui/code-blocks/ShelfCodeBlock.ts b/src/ui/code-blocks/ShelfCodeBlock.ts
index 09ae970..1593c04 100644
--- a/src/ui/code-blocks/ShelfCodeBlock.ts
+++ b/src/ui/code-blocks/ShelfCodeBlock.ts
@@ -11,7 +11,8 @@ export function registerShelfCodeBlockProcessor(
registerCodeBlockRenderer(
plugin,
"shelf",
- (source, el) => new ShelfCodeBlockRenderer(plugin, source, el)
+ (source, el) =>
+ new SvelteCodeBlockRenderer(ShelfCodeBockView, plugin, source, el)
);
}
@@ -33,17 +34,3 @@ export const ShelfSettingsSchema = z.object({
});
export type ShelfSettings = z.infer;
-
-export class ShelfCodeBlockRenderer extends SvelteCodeBlockRenderer<
- typeof ShelfCodeBockView
-> {
- constructor(
- plugin: BookTrackerPlugin,
- source: string,
- contentEl: HTMLElement
- ) {
- super(contentEl, ShelfCodeBockView, { props: { plugin, source } });
- }
-
- onunload() {}
-}
diff --git a/src/ui/code-blocks/ShelfCodeBlockView.svelte b/src/ui/code-blocks/ShelfCodeBlockView.svelte
index cf06213..f275d02 100644
--- a/src/ui/code-blocks/ShelfCodeBlockView.svelte
+++ b/src/ui/code-blocks/ShelfCodeBlockView.svelte
@@ -1,6 +1,5 @@