mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-20 21:46:20 +00:00
Move date components and helpers to shlink-web-component
This commit is contained in:
@@ -4,8 +4,8 @@ import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { formatISO } from 'date-fns';
|
||||
import type { Mode } from '../../shlink-web-component/short-urls/ShortUrlForm';
|
||||
import { ShortUrlForm as createShortUrlForm } from '../../shlink-web-component/short-urls/ShortUrlForm';
|
||||
import { parseDate } from '../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { ReachableServer, SelectedServer } from '../../src/servers/data';
|
||||
import { parseDate } from '../../src/utils/helpers/date';
|
||||
import type { OptionalString } from '../../src/utils/utils';
|
||||
import { renderWithEvents } from '../__helpers__/setUpTest';
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { endOfDay, formatISO, startOfDay } from 'date-fns';
|
||||
import { MemoryRouter, useLocation, useNavigate } from 'react-router-dom';
|
||||
import { ShortUrlsFilteringBar as filteringBarCreator } from '../../shlink-web-component/short-urls/ShortUrlsFilteringBar';
|
||||
import { formatDate } from '../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { DateRange } from '../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import type { ReachableServer, SelectedServer } from '../../src/servers/data';
|
||||
import { formatDate } from '../../src/utils/helpers/date';
|
||||
import type { DateRange } from '../../src/utils/helpers/dateIntervals';
|
||||
import { renderWithEvents } from '../__helpers__/setUpTest';
|
||||
|
||||
vi.mock('react-router-dom', async () => ({
|
||||
|
||||
@@ -5,9 +5,9 @@ import { last } from 'ramda';
|
||||
import { MemoryRouter, useLocation } from 'react-router-dom';
|
||||
import type { ShortUrl, ShortUrlMeta } from '../../../shlink-web-component/short-urls/data';
|
||||
import { ShortUrlsRow as createShortUrlsRow } from '../../../shlink-web-component/short-urls/helpers/ShortUrlsRow';
|
||||
import { now, parseDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { ReachableServer } from '../../../src/servers/data';
|
||||
import type { Settings } from '../../../src/settings/reducers/settings';
|
||||
import { now, parseDate } from '../../../src/utils/helpers/date';
|
||||
import type { TimeoutToggle } from '../../../src/utils/helpers/hooks';
|
||||
import type { OptionalString } from '../../../src/utils/utils';
|
||||
import { renderWithEvents } from '../../__helpers__/setUpTest';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { parseISO } from 'date-fns';
|
||||
import type { DateInputProps } from '../../../src/utils/dates/DateInput';
|
||||
import { DateInput } from '../../../src/utils/dates/DateInput';
|
||||
import type { DateInputProps } from '../../../shlink-web-component/utils/dates/DateInput';
|
||||
import { DateInput } from '../../../shlink-web-component/utils/dates/DateInput';
|
||||
import { renderWithEvents } from '../../__helpers__/setUpTest';
|
||||
|
||||
describe('<DateInput />', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import type { DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import { DATE_INTERVALS, rangeOrIntervalToString } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import { DateIntervalDropdownItems } from '../../../src/utils/dates/DateIntervalDropdownItems';
|
||||
import { DropdownBtn } from '../../../src/utils/DropdownBtn';
|
||||
import type { DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { DATE_INTERVALS, rangeOrIntervalToString } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { renderWithEvents } from '../../__helpers__/setUpTest';
|
||||
|
||||
describe('<DateIntervalDropdownItems />', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import type { DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import { rangeOrIntervalToString } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import { DateIntervalSelector } from '../../../src/utils/dates/DateIntervalSelector';
|
||||
import type { DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { rangeOrIntervalToString } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { renderWithEvents } from '../../__helpers__/setUpTest';
|
||||
|
||||
describe('<DateIntervalSelector />', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { screen } from '@testing-library/react';
|
||||
import { DateRangeRow } from '../../../src/utils/dates/DateRangeRow';
|
||||
import { DateRangeRow } from '../../../shlink-web-component/utils/dates/DateRangeRow';
|
||||
import { renderWithEvents } from '../../__helpers__/setUpTest';
|
||||
|
||||
describe('<DateRangeRow />', () => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import type { DateRangeSelectorProps } from '../../../src/utils/dates/DateRangeSelector';
|
||||
import { DateRangeSelector } from '../../../src/utils/dates/DateRangeSelector';
|
||||
import type { DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
import type { DateRangeSelectorProps } from '../../../shlink-web-component/utils/dates/DateRangeSelector';
|
||||
import { DateRangeSelector } from '../../../shlink-web-component/utils/dates/DateRangeSelector';
|
||||
import type { DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import { renderWithEvents } from '../../__helpers__/setUpTest';
|
||||
|
||||
describe('<DateRangeSelector />', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import type { TimeProps } from '../../../src/utils/dates/Time';
|
||||
import { Time } from '../../../src/utils/dates/Time';
|
||||
import { parseDate } from '../../../src/utils/helpers/date';
|
||||
import { parseDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { TimeProps } from '../../../shlink-web-component/utils/dates/Time';
|
||||
import { Time } from '../../../shlink-web-component/utils/dates/Time';
|
||||
|
||||
describe('<Time />', () => {
|
||||
const setUp = (props: TimeProps) => render(<Time {...props} />);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { addDays, formatISO, subDays } from 'date-fns';
|
||||
import { formatDate, formatIsoDate, isBeforeOrEqual, isBetween, parseDate } from '../../../src/utils/helpers/date';
|
||||
import { formatDate, formatIsoDate, isBeforeOrEqual, isBetween, parseDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
|
||||
describe('date', () => {
|
||||
const now = new Date();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { endOfDay, format, formatISO, startOfDay, subDays } from 'date-fns';
|
||||
import { now, parseDate } from '../../../src/utils/helpers/date';
|
||||
import { now, parseDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type {
|
||||
DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import {
|
||||
dateRangeIsEmpty,
|
||||
dateToMatchingInterval,
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
rangeIsInterval,
|
||||
rangeOrIntervalToString,
|
||||
toDateRange,
|
||||
} from '../../../src/utils/helpers/dateIntervals';
|
||||
} from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
|
||||
describe('date-types', () => {
|
||||
const daysBack = (days: number) => subDays(now(), days);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { addDays, formatISO, subDays } from 'date-fns';
|
||||
import type { ShortUrl } from '../../../shlink-web-component/short-urls/data';
|
||||
import { formatIsoDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import type {
|
||||
DomainVisits, LoadDomainVisits,
|
||||
} from '../../../shlink-web-component/visits/reducers/domainVisits';
|
||||
@@ -14,8 +16,6 @@ import type { Visit } from '../../../shlink-web-component/visits/types';
|
||||
import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient';
|
||||
import type { ShlinkVisits } from '../../../src/api/types';
|
||||
import type { ShlinkState } from '../../../src/container/types';
|
||||
import { formatIsoDate } from '../../../src/utils/helpers/date';
|
||||
import type { DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { rangeOf } from '../../../src/utils/utils';
|
||||
|
||||
describe('domainVisitsReducer', () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { addDays, formatISO, subDays } from 'date-fns';
|
||||
import { formatIsoDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import {
|
||||
getNonOrphanVisits as getNonOrphanVisitsCreator,
|
||||
nonOrphanVisitsReducerCreator,
|
||||
@@ -10,8 +12,6 @@ import type { Visit } from '../../../shlink-web-component/visits/types';
|
||||
import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient';
|
||||
import type { ShlinkVisits } from '../../../src/api/types';
|
||||
import type { ShlinkState } from '../../../src/container/types';
|
||||
import { formatIsoDate } from '../../../src/utils/helpers/date';
|
||||
import type { DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { rangeOf } from '../../../src/utils/utils';
|
||||
|
||||
describe('nonOrphanVisitsReducer', () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { addDays, formatISO, subDays } from 'date-fns';
|
||||
import { formatIsoDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import {
|
||||
getOrphanVisits as getOrphanVisitsCreator,
|
||||
orphanVisitsReducerCreator,
|
||||
@@ -10,8 +12,6 @@ import type { Visit } from '../../../shlink-web-component/visits/types';
|
||||
import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient';
|
||||
import type { ShlinkVisits } from '../../../src/api/types';
|
||||
import type { ShlinkState } from '../../../src/container/types';
|
||||
import { formatIsoDate } from '../../../src/utils/helpers/date';
|
||||
import type { DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { rangeOf } from '../../../src/utils/utils';
|
||||
|
||||
describe('orphanVisitsReducer', () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { addDays, formatISO, subDays } from 'date-fns';
|
||||
import { formatIsoDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import type {
|
||||
ShortUrlVisits } from '../../../shlink-web-component/visits/reducers/shortUrlVisits';
|
||||
import {
|
||||
@@ -11,8 +13,6 @@ import type { Visit } from '../../../shlink-web-component/visits/types';
|
||||
import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient';
|
||||
import type { ShlinkVisits } from '../../../src/api/types';
|
||||
import type { ShlinkState } from '../../../src/container/types';
|
||||
import { formatIsoDate } from '../../../src/utils/helpers/date';
|
||||
import type { DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { rangeOf } from '../../../src/utils/utils';
|
||||
|
||||
describe('shortUrlVisitsReducer', () => {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { addDays, formatISO, subDays } from 'date-fns';
|
||||
import { formatIsoDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { DateInterval } from '../../../shlink-web-component/utils/dates/helpers/dateIntervals';
|
||||
import type {
|
||||
TagVisits } from '../../../shlink-web-component/visits/reducers/tagVisits';
|
||||
import {
|
||||
@@ -11,8 +13,6 @@ import type { Visit } from '../../../shlink-web-component/visits/types';
|
||||
import type { ShlinkApiClient } from '../../../src/api/services/ShlinkApiClient';
|
||||
import type { ShlinkVisits } from '../../../src/api/types';
|
||||
import type { ShlinkState } from '../../../src/container/types';
|
||||
import { formatIsoDate } from '../../../src/utils/helpers/date';
|
||||
import type { DateInterval } from '../../../src/utils/helpers/dateIntervals';
|
||||
import { rangeOf } from '../../../src/utils/utils';
|
||||
|
||||
describe('tagVisitsReducer', () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import { formatIsoDate, parseDate } from '../../../shlink-web-component/utils/dates/helpers/date';
|
||||
import type { CreateVisit, OrphanVisit, VisitsParams } from '../../../shlink-web-component/visits/types';
|
||||
import type { GroupedNewVisits } from '../../../shlink-web-component/visits/types/helpers';
|
||||
import { groupNewVisitsByType, toApiParams } from '../../../shlink-web-component/visits/types/helpers';
|
||||
import type { ShlinkVisitsParams } from '../../../src/api/types';
|
||||
import { formatIsoDate, parseDate } from '../../../src/utils/helpers/date';
|
||||
|
||||
describe('visitsTypeHelpers', () => {
|
||||
describe('groupNewVisitsByType', () => {
|
||||
|
||||
Reference in New Issue
Block a user