diff --git a/src/components/modals/JournalShelf.modal.vue b/src/components/modals/JournalShelf.modal.vue new file mode 100644 index 0000000..a788618 --- /dev/null +++ b/src/components/modals/JournalShelf.modal.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/src/settings/JournalSettingsDashboard.vue b/src/settings/JournalSettingsDashboard.vue index 5013aba..581ac77 100644 --- a/src/settings/JournalSettingsDashboard.vue +++ b/src/settings/JournalSettingsDashboard.vue @@ -58,7 +58,11 @@ function changeFirstWeekOfYear(value: number): void { - + diff --git a/src/settings/JournalSettingsEdit.vue b/src/settings/JournalSettingsEdit.vue index 428bd26..8439704 100644 --- a/src/settings/JournalSettingsEdit.vue +++ b/src/settings/JournalSettingsEdit.vue @@ -23,6 +23,7 @@ import RenameJournalModal from "../components/modals/RenameJournal.modal.vue"; import { today } from "@/calendar"; import NavigationBlockEditPreview from "@/code-blocks/navigation/NavigationBlockEditPreview.vue"; import EditNavBlockRowModal from "@/components/modals/EditNavBlockRow.modal.vue"; +import JournalShelfModal from "@/components/modals/JournalShelf.modal.vue"; const props = defineProps<{ journalName: string; @@ -48,6 +49,26 @@ function showRenameModal(): void { }).open(); } +function place(): void { + new VueModal("Place journal", JournalShelfModal, { + currentShelf: journal.value.shelves[0] ?? "", + onSave(shelfName: string) { + const currentShelf = journal.value.shelves[0]; + if (currentShelf) { + pluginSettings$.value.shelves[currentShelf].journals = pluginSettings$.value.shelves[ + currentShelf + ].journals.filter((name) => name !== props.journalName); + } + if (shelfName) { + pluginSettings$.value.shelves[shelfName].journals.push(props.journalName); + journal.value.shelves = [shelfName]; + } else { + journal.value.shelves = []; + } + }, + }).open(); +} + function addCommand(): void { new VueModal("Add command", EditCommandModal, { index: journal.value.commands.length, @@ -156,6 +177,12 @@ watch(
+ diff --git a/src/settings/JournalSettingsWithShelves.vue b/src/settings/JournalSettingsWithShelves.vue index 31627c2..958043d 100644 --- a/src/settings/JournalSettingsWithShelves.vue +++ b/src/settings/JournalSettingsWithShelves.vue @@ -7,8 +7,15 @@ import RemoveShelf from "@/components/modals/RemoveShelf.modal.vue"; import { plugin$ } from "@/stores/obsidian.store"; import { pluginSettings$ } from "@/stores/settings.store"; import { computed } from "vue"; +import JournalSettingsList from "./JournalSettingsList.vue"; +import CreateJournalModal from "@/components/modals/CreateJournal.modal.vue"; +import type { JournalSettings } from "@/types/settings.types"; -defineEmits<(event: "organize", shelfName: string) => void>(); +const emit = defineEmits<{ + (event: "organize", shelfName: string): void; + // eslint-disable-next-line @typescript-eslint/unified-signatures + (event: "edit", journalName: string): void; +}>(); const shelvesList = computed(() => Object.values(pluginSettings$.value.shelves).toSorted((a, b) => a.name.localeCompare(b.name)), @@ -36,6 +43,15 @@ function removeShelf(shelfName: string): void { }, }).open(); } + +function create(): void { + new VueModal("Add Journal", CreateJournalModal, { + onCreate(name: string, writing: JournalSettings["write"]) { + plugin$.value.createJournal(name, writing); + emit("edit", name); + }, + }).open(); +} - + + + +