From ceb62c63d33e736e06fa4be108e54ddf703c8884 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 18 Feb 2026 22:33:24 +0100 Subject: [PATCH] refactor(gantt): extract GanttBarDateType as reusable type --- frontend/src/components/gantt/GanttChart.vue | 4 ++-- frontend/src/composables/useGanttBar.ts | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/gantt/GanttChart.vue b/frontend/src/components/gantt/GanttChart.vue index e4a08ad31..e415e43fd 100644 --- a/frontend/src/components/gantt/GanttChart.vue +++ b/frontend/src/components/gantt/GanttChart.vue @@ -75,7 +75,7 @@ import {getHexColor} from '@/models/task' import type {ITask, ITaskPartialWithId} from '@/modelTypes/ITask' import type {DateISO} from '@/types/DateISO' import type {GanttFilters} from '@/views/project/helpers/useGanttFilters' -import type {GanttBarModel} from '@/composables/useGanttBar' +import type {GanttBarModel, GanttBarDateType} from '@/composables/useGanttBar' import GanttChartBody from '@/components/gantt/GanttChartBody.vue' import GanttRow from '@/components/gantt/GanttRow.vue' @@ -164,7 +164,7 @@ function transformTaskToGanttBar(t: ITask): GanttBarModel { let startDate: Date let endDate: Date - let dateType: 'both' | 'startOnly' | 'endOnly' + let dateType: GanttBarDateType if (effectiveStartDate && effectiveEndDate) { // Both dates available diff --git a/frontend/src/composables/useGanttBar.ts b/frontend/src/composables/useGanttBar.ts index 6b3dffb1b..6d863c8e0 100644 --- a/frontend/src/composables/useGanttBar.ts +++ b/frontend/src/composables/useGanttBar.ts @@ -1,5 +1,7 @@ import { ref } from 'vue' +export type GanttBarDateType = 'both' | 'startOnly' | 'endOnly' + export interface GanttBarModel { id: string start: Date @@ -8,7 +10,7 @@ export interface GanttBarModel { label?: string color?: string hasActualDates?: boolean - dateType?: 'both' | 'startOnly' | 'endOnly' + dateType?: GanttBarDateType isDone?: boolean task?: unknown }