diff --git a/frontend/__tests__/components/Common/DateRangeViewer/DateRangeViewer.test.tsx b/frontend/__tests__/components/Common/DateRangeViewer/DateRangeViewer.test.tsx index e8401ba659..9a3c22332f 100644 --- a/frontend/__tests__/components/Common/DateRangeViewer/DateRangeViewer.test.tsx +++ b/frontend/__tests__/components/Common/DateRangeViewer/DateRangeViewer.test.tsx @@ -1,10 +1,10 @@ import DateRangeViewer from '@src/components/Common/DateRangeViewer'; -import { TDateRange } from '@src/context/config/configSlice'; +import { DateRange } from '@src/context/config/configSlice'; import userEvent from '@testing-library/user-event'; import { render } from '@testing-library/react'; describe('DateRangeViewer', () => { - const setup = (dateRanges: TDateRange) => { + const setup = (dateRanges: DateRange) => { return render(); }; const mockDateRanges = [ diff --git a/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx b/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx index 0f8ae03d09..90033308b7 100644 --- a/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx +++ b/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx @@ -17,7 +17,7 @@ import { SHOW_MORE, } from '../../fixtures'; import { - TDateRange, + DateRange, updateDateRange, updateJiraVerifyResponse, updateMetrics, @@ -89,7 +89,7 @@ describe('Report Step', () => { reportHook.current.reportData = { ...MOCK_REPORT_RESPONSE, exportValidityTime: 30 }; }; const handleSaveMock = jest.fn(); - const setup = (params: string[], dateRange?: TDateRange) => { + const setup = (params: string[], dateRange?: DateRange) => { store = setupStore(); dateRange && store.dispatch(updateDateRange(dateRange)); store.dispatch( diff --git a/frontend/src/clients/board/dto/request.ts b/frontend/src/clients/board/dto/request.ts index ddc96f82ec..140d3657d9 100644 --- a/frontend/src/clients/board/dto/request.ts +++ b/frontend/src/clients/board/dto/request.ts @@ -1,4 +1,4 @@ -import { TDateRange } from '@src/context/config/configSlice'; +import { DateRange } from '@src/context/config/configSlice'; export interface BoardRequestDTO { token: string; @@ -20,6 +20,6 @@ export interface BoardInfoRequestDTO { } export interface BoardInfoConfigDTO extends BoardRequestDTO { - dateRanges: TDateRange | null; + dateRanges: DateRange | null; projectKey: string; } diff --git a/frontend/src/components/Common/DateRangeViewer/index.tsx b/frontend/src/components/Common/DateRangeViewer/index.tsx index a16ce8244e..d90e08e488 100644 --- a/frontend/src/components/Common/DateRangeViewer/index.tsx +++ b/frontend/src/components/Common/DateRangeViewer/index.tsx @@ -8,12 +8,12 @@ import { StyledExpandMoreIcon, } from './style'; import React, { useRef, useState, forwardRef, useEffect, useCallback } from 'react'; -import { TDateRange } from '@src/context/config/configSlice'; +import { DateRange } from '@src/context/config/configSlice'; import { formatDate } from '@src/utils/util'; import { theme } from '@src/theme'; type Props = { - dateRanges: TDateRange; + dateRanges: DateRange; expandColor?: string; expandBackgroundColor?: string; }; diff --git a/frontend/src/containers/ConfigStep/DateRangePicker/validation.ts b/frontend/src/containers/ConfigStep/DateRangePicker/validation.ts index ce0edf0666..56b83c25d7 100644 --- a/frontend/src/containers/ConfigStep/DateRangePicker/validation.ts +++ b/frontend/src/containers/ConfigStep/DateRangePicker/validation.ts @@ -1,12 +1,12 @@ import dayjsSameOrBeforePlugin from 'dayjs/plugin/isSameOrBefore'; import dayjsSameOrAfterPlugin from 'dayjs/plugin/isSameOrAfter'; -import { TDateRange } from '@src/context/config/configSlice'; +import { DateRange } from '@src/context/config/configSlice'; import dayjs, { Dayjs } from 'dayjs'; dayjs.extend(dayjsSameOrBeforePlugin); dayjs.extend(dayjsSameOrAfterPlugin); -export const calculateLastAvailableDate = (date: Dayjs, coveredRange: TDateRange) => { +export const calculateLastAvailableDate = (date: Dayjs, coveredRange: DateRange) => { let lastAvailableDate = dayjs(new Date()).startOf('date'); let minimumDiffDays = lastAvailableDate.diff(date, 'days'); @@ -24,7 +24,7 @@ export const calculateLastAvailableDate = (date: Dayjs, coveredRange: TDateRange return lastAvailableDate; }; -export const isDateDisabled = (coveredRange: TDateRange, date: Dayjs) => +export const isDateDisabled = (coveredRange: DateRange, date: Dayjs) => coveredRange.some( ({ startDate, endDate }) => date.isSameOrAfter(startDate, 'date') && date.isSameOrBefore(endDate, 'date'), ); diff --git a/frontend/src/context/config/configSlice.ts b/frontend/src/context/config/configSlice.ts index 2bcec116f8..01ae86d2d4 100644 --- a/frontend/src/context/config/configSlice.ts +++ b/frontend/src/context/config/configSlice.ts @@ -18,7 +18,7 @@ import merge from 'lodash/merge'; import { isArray } from 'lodash'; import dayjs from 'dayjs'; -export type TDateRange = { +export type DateRange = { startDate: string | null; endDate: string | null; }[]; @@ -28,7 +28,7 @@ export interface BasicConfigState { basic: { projectName: string; calendarType: string; - dateRange: TDateRange; + dateRange: DateRange; metrics: string[]; }; board: IBoardState; diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts index 3541cae1b0..3393e8d09f 100644 --- a/frontend/src/utils/util.ts +++ b/frontend/src/utils/util.ts @@ -4,7 +4,7 @@ import { ICycleTimeSetting, IPipelineConfig } from '@src/context/Metrics/metrics import { ITargetFieldType } from '@src/components/Common/MultiAutoComplete/styles'; import { BoardInfoResponse } from '@src/hooks/useGetBoardInfo'; import { DATE_FORMAT_TEMPLATE } from '@src/constants/template'; -import { TDateRange } from '@src/context/config/configSlice'; +import { DateRange } from '@src/context/config/configSlice'; import { includes, isEqual, sortBy, uniqBy } from 'lodash'; import duration from 'dayjs/plugin/duration'; import dayjs from 'dayjs'; @@ -102,7 +102,7 @@ export const formatDateToTimestampString = (date: string) => { return dayjs(date).valueOf().toString(); }; -export const sortDateRanges = (dateRanges: TDateRange, descending = true) => { +export const sortDateRanges = (dateRanges: DateRange, descending = true) => { const result = [...dateRanges].sort((a, b) => { return dayjs(b.startDate as string).diff(dayjs(a.startDate as string)); });