From 5f96aafdc9b2a1f7a935a8dbbc55883df24eab72 Mon Sep 17 00:00:00 2001 From: Sergii Kostyrko Date: Sun, 22 Sep 2024 21:08:00 +0300 Subject: [PATCH] feat: add decorations for days --- src/components/calendar/CalendarDay.vue | 13 ++- .../calendar/CalendarMonthButton.vue | 4 +- .../calendar/CalendarQuarterButton.vue | 4 +- .../calendar/CalendarWeekNumber.vue | 4 +- .../calendar/CalendarYearButton.vue | 4 +- .../modals/EditDecoration.modal.vue | 2 +- src/composables/use-decorations.ts | 91 ++++++++++--------- src/journals/fixed-interval.ts | 10 ++ src/journals/journal.ts | 5 + src/stores/settings.store.ts | 20 ++++ src/types/journal.types.ts | 2 + 11 files changed, 107 insertions(+), 52 deletions(-) diff --git a/src/components/calendar/CalendarDay.vue b/src/components/calendar/CalendarDay.vue index cbfbc1e..88a07e9 100644 --- a/src/components/calendar/CalendarDay.vue +++ b/src/components/calendar/CalendarDay.vue @@ -1,13 +1,22 @@ diff --git a/src/components/calendar/CalendarMonthButton.vue b/src/components/calendar/CalendarMonthButton.vue index 47febc9..f495be4 100644 --- a/src/components/calendar/CalendarMonthButton.vue +++ b/src/components/calendar/CalendarMonthButton.vue @@ -2,7 +2,7 @@ import { useDecorations } from "@/composables/use-decorations"; import type { MomentDate } from "@/types/date.types"; import CalendarDecoration from "./CalendarDecoration.vue"; -import { journalsWithMonths$ } from "@/stores/settings.store"; +import { decorationsForMonths$, journalsWithMonths$ } from "@/stores/settings.store"; import ObsidianButton from "../obsidian/ObsidianButton.vue"; import { toRefs } from "vue"; @@ -12,7 +12,7 @@ const props = defineProps<{ const { date } = toRefs(props); const emit = defineEmits<(e: "select", event: MouseEvent, date: MomentDate) => void>(); -const decorationsStyles = useDecorations(date, journalsWithMonths$); +const decorationsStyles = useDecorations(date, decorationsForMonths$); function select(event: MouseEvent) { if (!journalsWithMonths$.value.length) { return; diff --git a/src/components/calendar/CalendarQuarterButton.vue b/src/components/calendar/CalendarQuarterButton.vue index 1e6d885..a9e2f97 100644 --- a/src/components/calendar/CalendarQuarterButton.vue +++ b/src/components/calendar/CalendarQuarterButton.vue @@ -2,7 +2,7 @@ import { useDecorations } from "@/composables/use-decorations"; import type { MomentDate } from "@/types/date.types"; import CalendarDecoration from "./CalendarDecoration.vue"; -import { journalsWithQuarters$ } from "@/stores/settings.store"; +import { decorationsForQuarters$, journalsWithQuarters$ } from "@/stores/settings.store"; import ObsidianButton from "../obsidian/ObsidianButton.vue"; import { toRefs } from "vue"; @@ -12,7 +12,7 @@ const props = defineProps<{ const { date } = toRefs(props); const emit = defineEmits<(e: "select", event: MouseEvent, date: MomentDate) => void>(); -const decorationsStyles = useDecorations(date, journalsWithQuarters$); +const decorationsStyles = useDecorations(date, decorationsForQuarters$); function select(event: MouseEvent) { if (!journalsWithQuarters$.value.length) { return; diff --git a/src/components/calendar/CalendarWeekNumber.vue b/src/components/calendar/CalendarWeekNumber.vue index 20e55be..59785fe 100644 --- a/src/components/calendar/CalendarWeekNumber.vue +++ b/src/components/calendar/CalendarWeekNumber.vue @@ -2,14 +2,14 @@ import { useDecorations } from "@/composables/use-decorations"; import type { MomentDate } from "@/types/date.types"; import CalendarDecoration from "./CalendarDecoration.vue"; -import { journalsWithWeeks$ } from "@/stores/settings.store"; +import { decorationsForWeeks$ } from "@/stores/settings.store"; import { toRefs } from "vue"; const props = defineProps<{ date: MomentDate; }>(); const { date } = toRefs(props); -const decorationsStyles = useDecorations(date, journalsWithWeeks$); +const decorationsStyles = useDecorations(date, decorationsForWeeks$);