diff --git a/src/settings/reducers/settings.ts b/src/settings/reducers/settings.ts index 7f66a67c..b707160c 100644 --- a/src/settings/reducers/settings.ts +++ b/src/settings/reducers/settings.ts @@ -1,7 +1,7 @@ import { createSlice, PayloadAction, PrepareAction } from '@reduxjs/toolkit'; import { mergeDeepRight } from 'ramda'; import { Theme } from '../../utils/theme'; -import { DateInterval } from '../../utils/dates/types'; +import { DateInterval } from '../../utils/helpers/dateIntervals'; import { TagsOrder } from '../../tags/data/TagsListChildrenProps'; import { ShortUrlsOrder } from '../../short-urls/data'; diff --git a/src/short-urls/ShortUrlsFilteringBar.tsx b/src/short-urls/ShortUrlsFilteringBar.tsx index 00c3e164..1a5ec29d 100644 --- a/src/short-urls/ShortUrlsFilteringBar.tsx +++ b/src/short-urls/ShortUrlsFilteringBar.tsx @@ -7,7 +7,7 @@ import classNames from 'classnames'; import { SearchField } from '../utils/SearchField'; import { DateRangeSelector } from '../utils/dates/DateRangeSelector'; import { formatIsoDate } from '../utils/helpers/date'; -import { DateRange, datesToDateRange } from '../utils/dates/types'; +import { DateRange, datesToDateRange } from '../utils/helpers/dateIntervals'; import { supportsAllTagsFiltering } from '../utils/helpers/features'; import { SelectedServer } from '../servers/data'; import { OrderDir } from '../utils/helpers/ordering'; diff --git a/src/utils/dates/DateIntervalDropdownItems.tsx b/src/utils/dates/DateIntervalDropdownItems.tsx index 57099496..bd2b8de4 100644 --- a/src/utils/dates/DateIntervalDropdownItems.tsx +++ b/src/utils/dates/DateIntervalDropdownItems.tsx @@ -1,6 +1,6 @@ import { DropdownItem } from 'reactstrap'; import { FC } from 'react'; -import { DATE_INTERVALS, DateInterval, rangeOrIntervalToString } from './types'; +import { DATE_INTERVALS, DateInterval, rangeOrIntervalToString } from '../helpers/dateIntervals'; export interface DateIntervalDropdownProps { active?: DateInterval; diff --git a/src/utils/dates/DateIntervalSelector.tsx b/src/utils/dates/DateIntervalSelector.tsx index 047fccf0..3f4bccb3 100644 --- a/src/utils/dates/DateIntervalSelector.tsx +++ b/src/utils/dates/DateIntervalSelector.tsx @@ -1,6 +1,6 @@ import { FC } from 'react'; import { DropdownBtn } from '../DropdownBtn'; -import { rangeOrIntervalToString } from './types'; +import { rangeOrIntervalToString } from '../helpers/dateIntervals'; import { DateIntervalDropdownItems, DateIntervalDropdownProps } from './DateIntervalDropdownItems'; export const DateIntervalSelector: FC = ({ onChange, active, allText }) => ( diff --git a/src/utils/dates/DateRangeRow.tsx b/src/utils/dates/DateRangeRow.tsx index d2cf1b8d..f5e33ff4 100644 --- a/src/utils/dates/DateRangeRow.tsx +++ b/src/utils/dates/DateRangeRow.tsx @@ -1,6 +1,6 @@ import { endOfDay } from 'date-fns'; import { DateInput } from './DateInput'; -import { DateRange } from './types'; +import { DateRange } from '../helpers/dateIntervals'; interface DateRangeRowProps extends DateRange { onStartDateChange: (date: Date | null) => void; diff --git a/src/utils/dates/DateRangeSelector.tsx b/src/utils/dates/DateRangeSelector.tsx index 1b2a89cd..72096c82 100644 --- a/src/utils/dates/DateRangeSelector.tsx +++ b/src/utils/dates/DateRangeSelector.tsx @@ -9,7 +9,7 @@ import { intervalToDateRange, rangeIsInterval, dateRangeIsEmpty, -} from './types'; +} from '../helpers/dateIntervals'; import { DateRangeRow } from './DateRangeRow'; import { DateIntervalDropdownItems } from './DateIntervalDropdownItems'; diff --git a/src/utils/dates/types/index.ts b/src/utils/helpers/dateIntervals.ts similarity index 97% rename from src/utils/dates/types/index.ts rename to src/utils/helpers/dateIntervals.ts index 905fbe8d..9e0f0f00 100644 --- a/src/utils/dates/types/index.ts +++ b/src/utils/helpers/dateIntervals.ts @@ -1,8 +1,6 @@ import { subDays, startOfDay, endOfDay } from 'date-fns'; import { cond, filter, isEmpty, T } from 'ramda'; -import { dateOrNull, DateOrString, formatInternational, isBeforeOrEqual, parseISO } from '../../helpers/date'; - -// TODO Rename this to src/utils/helpers/dateIntervals.ts +import { dateOrNull, DateOrString, formatInternational, isBeforeOrEqual, parseISO } from './date'; export interface DateRange { startDate?: Date | null; diff --git a/src/visits/VisitsStats.tsx b/src/visits/VisitsStats.tsx index f25dbfba..a6110bc4 100644 --- a/src/visits/VisitsStats.tsx +++ b/src/visits/VisitsStats.tsx @@ -27,7 +27,7 @@ import { DoughnutChartCard } from './charts/DoughnutChartCard'; import { SortableBarChartCard } from './charts/SortableBarChartCard'; import { VisitsInfo } from './reducers/types'; import { useVisitsQuery } from './helpers/hooks'; -import { DateInterval, DateRange, toDateRange } from '../utils/dates/types'; +import { DateInterval, DateRange, toDateRange } from '../utils/helpers/dateIntervals'; export type VisitsStatsProps = PropsWithChildren<{ getVisits: (params: VisitsParams, doIntervalFallback?: boolean) => void; diff --git a/src/visits/helpers/hooks.ts b/src/visits/helpers/hooks.ts index 6fd3375a..1538d63e 100644 --- a/src/visits/helpers/hooks.ts +++ b/src/visits/helpers/hooks.ts @@ -2,7 +2,7 @@ import { DeepPartial } from '@reduxjs/toolkit'; import { useLocation, useNavigate } from 'react-router-dom'; import { useMemo } from 'react'; import { isEmpty, mergeDeepRight, pipe } from 'ramda'; -import { DateRange, datesToDateRange } from '../../utils/dates/types'; +import { DateRange, datesToDateRange } from '../../utils/helpers/dateIntervals'; import { OrphanVisitType, VisitsFilter } from '../types'; import { parseQuery, stringifyQuery } from '../../utils/helpers/query'; import { formatIsoDate } from '../../utils/helpers/date'; diff --git a/src/visits/reducers/common.ts b/src/visits/reducers/common.ts index a5ae208f..f64078cd 100644 --- a/src/visits/reducers/common.ts +++ b/src/visits/reducers/common.ts @@ -2,7 +2,7 @@ import { flatten, prop, range, splitEvery } from 'ramda'; import { createAction, createSlice } from '@reduxjs/toolkit'; import { ShlinkPaginator, ShlinkVisits, ShlinkVisitsParams } from '../../api/types'; import { CreateVisit, Visit } from '../types'; -import { DateInterval, dateToMatchingInterval } from '../../utils/dates/types'; +import { DateInterval, dateToMatchingInterval } from '../../utils/helpers/dateIntervals'; import { LoadVisits, VisitsInfo, VisitsLoaded } from './types'; import { createAsyncThunk } from '../../utils/helpers/redux'; import { ShlinkState } from '../../container/types'; diff --git a/src/visits/reducers/types/index.ts b/src/visits/reducers/types/index.ts index b9dd1adf..f3e0e353 100644 --- a/src/visits/reducers/types/index.ts +++ b/src/visits/reducers/types/index.ts @@ -1,5 +1,5 @@ import { ShlinkVisitsParams } from '../../../api/types'; -import { DateInterval } from '../../../utils/dates/types'; +import { DateInterval } from '../../../utils/helpers/dateIntervals'; import { ProblemDetailsError } from '../../../api/types/errors'; import { Visit } from '../../types'; diff --git a/src/visits/types/index.ts b/src/visits/types/index.ts index cb0499aa..14b844f1 100644 --- a/src/visits/types/index.ts +++ b/src/visits/types/index.ts @@ -1,5 +1,5 @@ import { ShortUrl } from '../../short-urls/data'; -import { DateRange } from '../../utils/dates/types'; +import { DateRange } from '../../utils/helpers/dateIntervals'; export type OrphanVisitType = 'base_url' | 'invalid_short_url' | 'regular_404'; diff --git a/test/short-urls/ShortUrlsFilteringBar.test.tsx b/test/short-urls/ShortUrlsFilteringBar.test.tsx index 10adb9fc..d8f30942 100644 --- a/test/short-urls/ShortUrlsFilteringBar.test.tsx +++ b/test/short-urls/ShortUrlsFilteringBar.test.tsx @@ -4,7 +4,7 @@ import { endOfDay, formatISO, startOfDay } from 'date-fns'; import { MemoryRouter, useLocation, useNavigate } from 'react-router-dom'; import { ShortUrlsFilteringBar as filteringBarCreator } from '../../src/short-urls/ShortUrlsFilteringBar'; import { ReachableServer, SelectedServer } from '../../src/servers/data'; -import { DateRange } from '../../src/utils/dates/types'; +import { DateRange } from '../../src/utils/helpers/dateIntervals'; import { formatDate } from '../../src/utils/helpers/date'; import { renderWithEvents } from '../__helpers__/setUpTest'; diff --git a/test/utils/dates/DateIntervalDropdownItems.test.tsx b/test/utils/dates/DateIntervalDropdownItems.test.tsx index 0e9ec52f..66a909aa 100644 --- a/test/utils/dates/DateIntervalDropdownItems.test.tsx +++ b/test/utils/dates/DateIntervalDropdownItems.test.tsx @@ -1,6 +1,6 @@ import { screen, waitFor } from '@testing-library/react'; import { DateIntervalDropdownItems } from '../../../src/utils/dates/DateIntervalDropdownItems'; -import { DATE_INTERVALS, DateInterval, rangeOrIntervalToString } from '../../../src/utils/dates/types'; +import { DATE_INTERVALS, DateInterval, rangeOrIntervalToString } from '../../../src/utils/helpers/dateIntervals'; import { DropdownBtn } from '../../../src/utils/DropdownBtn'; import { renderWithEvents } from '../../__helpers__/setUpTest'; diff --git a/test/utils/dates/DateIntervalSelector.test.tsx b/test/utils/dates/DateIntervalSelector.test.tsx index ebff24a1..975159c7 100644 --- a/test/utils/dates/DateIntervalSelector.test.tsx +++ b/test/utils/dates/DateIntervalSelector.test.tsx @@ -1,5 +1,5 @@ import { screen, waitFor } from '@testing-library/react'; -import { DateInterval, rangeOrIntervalToString } from '../../../src/utils/dates/types'; +import { DateInterval, rangeOrIntervalToString } from '../../../src/utils/helpers/dateIntervals'; import { DateIntervalSelector } from '../../../src/utils/dates/DateIntervalSelector'; import { renderWithEvents } from '../../__helpers__/setUpTest'; diff --git a/test/utils/dates/DateRangeSelector.test.tsx b/test/utils/dates/DateRangeSelector.test.tsx index c776cec9..858d06c0 100644 --- a/test/utils/dates/DateRangeSelector.test.tsx +++ b/test/utils/dates/DateRangeSelector.test.tsx @@ -1,7 +1,7 @@ import { screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; import { DateRangeSelector, DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector'; -import { DateInterval } from '../../../src/utils/dates/types'; +import { DateInterval } from '../../../src/utils/helpers/dateIntervals'; import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { diff --git a/test/utils/dates/types/index.test.ts b/test/utils/dates/types/index.test.ts index 7d436bae..34dd22e5 100644 --- a/test/utils/dates/types/index.test.ts +++ b/test/utils/dates/types/index.test.ts @@ -6,7 +6,7 @@ import { intervalToDateRange, rangeIsInterval, rangeOrIntervalToString, -} from '../../../../src/utils/dates/types'; +} from '../../../../src/utils/helpers/dateIntervals'; import { parseDate } from '../../../../src/utils/helpers/date'; describe('date-types', () => { diff --git a/test/visits/reducers/domainVisits.test.ts b/test/visits/reducers/domainVisits.test.ts index da683d16..db52ba06 100644 --- a/test/visits/reducers/domainVisits.test.ts +++ b/test/visits/reducers/domainVisits.test.ts @@ -12,7 +12,7 @@ import { ShlinkVisits } from '../../../src/api/types'; import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; import { ShlinkState } from '../../../src/container/types'; import { formatIsoDate } from '../../../src/utils/helpers/date'; -import { DateInterval } from '../../../src/utils/dates/types'; +import { DateInterval } from '../../../src/utils/helpers/dateIntervals'; import { ShortUrl } from '../../../src/short-urls/data'; import { createNewVisits } from '../../../src/visits/reducers/visitCreation'; diff --git a/test/visits/reducers/nonOrphanVisits.test.ts b/test/visits/reducers/nonOrphanVisits.test.ts index 5ba44eed..e62a6d10 100644 --- a/test/visits/reducers/nonOrphanVisits.test.ts +++ b/test/visits/reducers/nonOrphanVisits.test.ts @@ -10,7 +10,7 @@ import { ShlinkVisits } from '../../../src/api/types'; import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; import { ShlinkState } from '../../../src/container/types'; import { formatIsoDate } from '../../../src/utils/helpers/date'; -import { DateInterval } from '../../../src/utils/dates/types'; +import { DateInterval } from '../../../src/utils/helpers/dateIntervals'; import { createNewVisits } from '../../../src/visits/reducers/visitCreation'; import { VisitsInfo } from '../../../src/visits/reducers/types'; diff --git a/test/visits/reducers/orphanVisits.test.ts b/test/visits/reducers/orphanVisits.test.ts index 0a58c3b9..0b728929 100644 --- a/test/visits/reducers/orphanVisits.test.ts +++ b/test/visits/reducers/orphanVisits.test.ts @@ -10,7 +10,7 @@ import { ShlinkVisits } from '../../../src/api/types'; import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; import { ShlinkState } from '../../../src/container/types'; import { formatIsoDate } from '../../../src/utils/helpers/date'; -import { DateInterval } from '../../../src/utils/dates/types'; +import { DateInterval } from '../../../src/utils/helpers/dateIntervals'; import { createNewVisits } from '../../../src/visits/reducers/visitCreation'; import { VisitsInfo } from '../../../src/visits/reducers/types'; diff --git a/test/visits/reducers/shortUrlVisits.test.ts b/test/visits/reducers/shortUrlVisits.test.ts index 01f87e30..4b65d351 100644 --- a/test/visits/reducers/shortUrlVisits.test.ts +++ b/test/visits/reducers/shortUrlVisits.test.ts @@ -11,7 +11,7 @@ import { ShlinkVisits } from '../../../src/api/types'; import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; import { ShlinkState } from '../../../src/container/types'; import { formatIsoDate } from '../../../src/utils/helpers/date'; -import { DateInterval } from '../../../src/utils/dates/types'; +import { DateInterval } from '../../../src/utils/helpers/dateIntervals'; import { createNewVisits } from '../../../src/visits/reducers/visitCreation'; describe('shortUrlVisitsReducer', () => { diff --git a/test/visits/reducers/tagVisits.test.ts b/test/visits/reducers/tagVisits.test.ts index 0b3573ca..fc94e980 100644 --- a/test/visits/reducers/tagVisits.test.ts +++ b/test/visits/reducers/tagVisits.test.ts @@ -11,7 +11,7 @@ import { ShlinkVisits } from '../../../src/api/types'; import { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient'; import { ShlinkState } from '../../../src/container/types'; import { formatIsoDate } from '../../../src/utils/helpers/date'; -import { DateInterval } from '../../../src/utils/dates/types'; +import { DateInterval } from '../../../src/utils/helpers/dateIntervals'; import { createNewVisits } from '../../../src/visits/reducers/visitCreation'; describe('tagVisitsReducer', () => {