feat: visible date range

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-29 21:41:27 -04:00
parent 18a96f5dab
commit 51bf195664
10 changed files with 214 additions and 68 deletions
+16 -1
View File
@@ -1,4 +1,4 @@
import { computed, ref } from 'vue'
import { computed, ref, shallowRef } from 'vue'
import { defineStore } from 'pinia'
import { CollectionObject } from '@ChronoManager/models/collection'
import { EntityObject } from '@ChronoManager/models/entity'
@@ -9,6 +9,7 @@ import { useCollectionsStore } from '@ChronoManager/stores/collectionsStore'
import { useEntitiesStore } from '@ChronoManager/stores/entitiesStore'
import { useServicesStore } from '@ChronoManager/stores/servicesStore'
import { useImportStore } from '@ChronoManager/stores/importStore'
import type { VisibleDateRange } from '@/types'
type ChronoEntityProperties = EventObject | TaskObject
@@ -19,6 +20,7 @@ export const useChronoOperationsStore = defineStore('chronoOperationsStore', ()
const importStore = useImportStore()
const loading = ref(false)
const visibleRange = shallowRef<VisibleDateRange | null>(null)
const collections = computed(() => collectionsStore.collections)
const entities = computed(() => entitiesStore.entities)
@@ -43,6 +45,17 @@ export const useChronoOperationsStore = defineStore('chronoOperationsStore', ()
})
const filteredTasks = computed(() => tasks.value)
function setVisibleRange(range: VisibleDateRange) {
if (
visibleRange.value?.startMs === range.startMs
&& visibleRange.value.endMs === range.endMs
) {
return
}
visibleRange.value = { ...range }
}
function prepareEntityProperties(entity: EntityObject): ChronoEntityProperties {
const properties = entity.properties as ChronoEntityProperties
const now = new Date().toISOString()
@@ -154,6 +167,7 @@ export const useChronoOperationsStore = defineStore('chronoOperationsStore', ()
return {
loading,
visibleRange,
collections,
entities,
calendars,
@@ -162,6 +176,7 @@ export const useChronoOperationsStore = defineStore('chronoOperationsStore', ()
tasks,
filteredEvents,
filteredTasks,
setVisibleRange,
saveEntity,
deleteEntity,
toggleCalendarVisibility,
+5
View File
@@ -30,6 +30,10 @@ export const useChronoUiStore = defineStore('chronoUiStore', () => {
viewMode.value = mode
}
function setCurrentDate(date: Date) {
currentDate.value = new Date(date)
}
function selectCalendar(calendar: CollectionObject) {
selectedCollection.value = calendar
}
@@ -214,6 +218,7 @@ export const useChronoUiStore = defineStore('chronoUiStore', () => {
collectionEditorType,
isTaskView,
setViewMode,
setCurrentDate,
selectCalendar,
selectTaskList,
openCreateCalendar,