From 6df12ce194e7495071e946123c85cac7985e84b6 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 23 Oct 2022 10:49:35 +0200 Subject: [PATCH] Moved date-time related utils to the proper folder --- src/short-urls/helpers/ShortUrlsRow.tsx | 2 +- src/utils/{ => dates}/DateInput.scss | 4 ++-- src/utils/{ => dates}/DateInput.tsx | 2 +- src/utils/dates/DateRangeRow.tsx | 2 +- src/utils/dates/DateTimeInput.tsx | 2 +- src/utils/{ => dates}/Time.tsx | 2 +- src/visits/ShortUrlVisitsHeader.tsx | 2 +- src/visits/VisitsTable.tsx | 2 +- test/utils/{ => dates}/DateInput.test.tsx | 4 ++-- test/utils/{ => dates}/Time.test.tsx | 4 ++-- 10 files changed, 13 insertions(+), 13 deletions(-) rename src/utils/{ => dates}/DateInput.scss (98%) rename src/utils/{ => dates}/DateInput.tsx (96%) rename src/utils/{ => dates}/Time.tsx (87%) rename test/utils/{ => dates}/DateInput.test.tsx (92%) rename test/utils/{ => dates}/Time.test.tsx (87%) diff --git a/src/short-urls/helpers/ShortUrlsRow.tsx b/src/short-urls/helpers/ShortUrlsRow.tsx index eed961af..de75968e 100644 --- a/src/short-urls/helpers/ShortUrlsRow.tsx +++ b/src/short-urls/helpers/ShortUrlsRow.tsx @@ -7,7 +7,7 @@ import { Tag } from '../../tags/helpers/Tag'; import { SelectedServer } from '../../servers/data'; import { CopyToClipboardIcon } from '../../utils/CopyToClipboardIcon'; import { ShortUrl } from '../data'; -import { Time } from '../../utils/Time'; +import { Time } from '../../utils/dates/Time'; import { ShortUrlVisitsCount } from './ShortUrlVisitsCount'; import { ShortUrlsRowMenuProps } from './ShortUrlsRowMenu'; import './ShortUrlsRow.scss'; diff --git a/src/utils/DateInput.scss b/src/utils/dates/DateInput.scss similarity index 98% rename from src/utils/DateInput.scss rename to src/utils/dates/DateInput.scss index bb795943..f68453dc 100644 --- a/src/utils/DateInput.scss +++ b/src/utils/dates/DateInput.scss @@ -1,5 +1,5 @@ -@import './mixins/vertical-align'; -@import './base'; +@import '../mixins/vertical-align'; +@import '../base'; .date-input-container { position: relative; diff --git a/src/utils/DateInput.tsx b/src/utils/dates/DateInput.tsx similarity index 96% rename from src/utils/DateInput.tsx rename to src/utils/dates/DateInput.tsx index 60d45959..15a95851 100644 --- a/src/utils/DateInput.tsx +++ b/src/utils/dates/DateInput.tsx @@ -4,7 +4,7 @@ import DatePicker, { ReactDatePickerProps } from 'react-datepicker'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faCalendarAlt as calendarIcon } from '@fortawesome/free-regular-svg-icons'; import classNames from 'classnames'; -import { STANDARD_DATE_FORMAT } from './helpers/date'; +import { STANDARD_DATE_FORMAT } from '../helpers/date'; import './DateInput.scss'; export type DateInputProps = ReactDatePickerProps; diff --git a/src/utils/dates/DateRangeRow.tsx b/src/utils/dates/DateRangeRow.tsx index 3712fb86..d2cf1b8d 100644 --- a/src/utils/dates/DateRangeRow.tsx +++ b/src/utils/dates/DateRangeRow.tsx @@ -1,5 +1,5 @@ import { endOfDay } from 'date-fns'; -import { DateInput } from '../DateInput'; +import { DateInput } from './DateInput'; import { DateRange } from './types'; interface DateRangeRowProps extends DateRange { diff --git a/src/utils/dates/DateTimeInput.tsx b/src/utils/dates/DateTimeInput.tsx index 75e16692..ddc45acb 100644 --- a/src/utils/dates/DateTimeInput.tsx +++ b/src/utils/dates/DateTimeInput.tsx @@ -1,6 +1,6 @@ import { ReactDatePickerProps } from 'react-datepicker'; import { FC } from 'react'; -import { DateInput } from '../DateInput'; +import { DateInput } from './DateInput'; import { STANDARD_DATE_AND_TIME_FORMAT } from '../helpers/date'; export type DateTimeInputProps = Omit; diff --git a/src/utils/Time.tsx b/src/utils/dates/Time.tsx similarity index 87% rename from src/utils/Time.tsx rename to src/utils/dates/Time.tsx index 9a395ac8..a06381df 100644 --- a/src/utils/Time.tsx +++ b/src/utils/dates/Time.tsx @@ -1,5 +1,5 @@ import { parseISO, format as formatDate, getUnixTime, formatDistance } from 'date-fns'; -import { isDateObject, STANDARD_DATE_AND_TIME_FORMAT } from './helpers/date'; +import { isDateObject, STANDARD_DATE_AND_TIME_FORMAT } from '../helpers/date'; export interface TimeProps { date: Date | string; diff --git a/src/visits/ShortUrlVisitsHeader.tsx b/src/visits/ShortUrlVisitsHeader.tsx index 96046d9f..bac9587f 100644 --- a/src/visits/ShortUrlVisitsHeader.tsx +++ b/src/visits/ShortUrlVisitsHeader.tsx @@ -1,7 +1,7 @@ import { UncontrolledTooltip } from 'reactstrap'; import { ExternalLink } from 'react-external-link'; import { ShortUrlDetail } from '../short-urls/reducers/shortUrlDetail'; -import { Time } from '../utils/Time'; +import { Time } from '../utils/dates/Time'; import { ShortUrlVisits } from './reducers/shortUrlVisits'; import { VisitsHeader } from './VisitsHeader'; import './ShortUrlVisitsHeader.scss'; diff --git a/src/visits/VisitsTable.tsx b/src/visits/VisitsTable.tsx index 39e30c48..16181b49 100644 --- a/src/visits/VisitsTable.tsx +++ b/src/visits/VisitsTable.tsx @@ -10,7 +10,7 @@ import { determineOrderDir, Order, sortList } from '../utils/helpers/ordering'; import { prettify } from '../utils/helpers/numbers'; import { supportsBotVisits } from '../utils/helpers/features'; import { SelectedServer } from '../servers/data'; -import { Time } from '../utils/Time'; +import { Time } from '../utils/dates/Time'; import { TableOrderIcon } from '../utils/table/TableOrderIcon'; import { MediaMatcher } from '../utils/types'; import { NormalizedOrphanVisit, NormalizedVisit } from './types'; diff --git a/test/utils/DateInput.test.tsx b/test/utils/dates/DateInput.test.tsx similarity index 92% rename from test/utils/DateInput.test.tsx rename to test/utils/dates/DateInput.test.tsx index dc809afc..525b0652 100644 --- a/test/utils/DateInput.test.tsx +++ b/test/utils/dates/DateInput.test.tsx @@ -1,8 +1,8 @@ import { screen, waitFor } from '@testing-library/react'; import { Mock } from 'ts-mockery'; import { parseISO } from 'date-fns'; -import { DateInput, DateInputProps } from '../../src/utils/DateInput'; -import { renderWithEvents } from '../__helpers__/setUpTest'; +import { DateInput, DateInputProps } from '../../../src/utils/dates/DateInput'; +import { renderWithEvents } from '../../__helpers__/setUpTest'; describe('', () => { const setUp = (props: Partial = {}) => renderWithEvents( diff --git a/test/utils/Time.test.tsx b/test/utils/dates/Time.test.tsx similarity index 87% rename from test/utils/Time.test.tsx rename to test/utils/dates/Time.test.tsx index cb1f9c8f..38b38a47 100644 --- a/test/utils/Time.test.tsx +++ b/test/utils/dates/Time.test.tsx @@ -1,6 +1,6 @@ import { render } from '@testing-library/react'; -import { TimeProps, Time } from '../../src/utils/Time'; -import { parseDate } from '../../src/utils/helpers/date'; +import { TimeProps, Time } from '../../../src/utils/dates/Time'; +import { parseDate } from '../../../src/utils/helpers/date'; describe('