From c3b6ce34ba52701404d9f9068dd8934cca30cd57 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 6 Aug 2023 17:19:59 +0200 Subject: [PATCH] Fix remaining dependencies from shlink-web-component into main app --- shlink-web-component/src/short-urls/ShortUrlsList.tsx | 6 +++++- .../src/short-urls/helpers/ShortUrlsRow.tsx | 2 +- .../test/domains/reducers/domainRedirects.test.ts | 3 +-- shlink-web-component/test/short-urls/ShortUrlForm.test.tsx | 3 +-- .../test/short-urls/helpers/CreateShortUrlResult.test.tsx | 2 +- .../test/short-urls/reducers/shortUrlDeletion.test.ts | 3 +-- .../test/visits/reducers/domainVisits.test.ts | 2 +- .../test/visits/reducers/nonOrphanVisits.test.ts | 2 +- .../test/visits/reducers/orphanVisits.test.ts | 2 +- .../test/visits/reducers/shortUrlVisits.test.ts | 2 +- shlink-web-component/test/visits/reducers/tagVisits.test.ts | 2 +- 11 files changed, 15 insertions(+), 14 deletions(-) diff --git a/shlink-web-component/src/short-urls/ShortUrlsList.tsx b/shlink-web-component/src/short-urls/ShortUrlsList.tsx index f2d4d01f..ad9d01b3 100644 --- a/shlink-web-component/src/short-urls/ShortUrlsList.tsx +++ b/shlink-web-component/src/short-urls/ShortUrlsList.tsx @@ -4,7 +4,6 @@ import { pipe } from 'ramda'; import { useEffect, useState } from 'react'; import { useLocation, useParams } from 'react-router-dom'; import { Card } from 'reactstrap'; -import { DEFAULT_SHORT_URLS_ORDERING } from '../../../src/settings/reducers/settings'; import type { ShlinkShortUrlsListParams, ShlinkShortUrlsOrder } from '../api-contract'; import { boundToMercureHub } from '../mercure/helpers/boundToMercureHub'; import { Topics } from '../mercure/helpers/Topics'; @@ -23,6 +22,11 @@ interface ShortUrlsListProps { listShortUrls: (params: ShlinkShortUrlsListParams) => void; } +const DEFAULT_SHORT_URLS_ORDERING: ShortUrlsOrder = { + field: 'dateCreated', + dir: 'DESC', +}; + export const ShortUrlsList = ( ShortUrlsTable: ShortUrlsTableType, ShortUrlsFilteringBar: ShortUrlsFilteringBarType, diff --git a/shlink-web-component/src/short-urls/helpers/ShortUrlsRow.tsx b/shlink-web-component/src/short-urls/helpers/ShortUrlsRow.tsx index 96441d8e..ca654432 100644 --- a/shlink-web-component/src/short-urls/helpers/ShortUrlsRow.tsx +++ b/shlink-web-component/src/short-urls/helpers/ShortUrlsRow.tsx @@ -1,9 +1,9 @@ import type { FC } from 'react'; import { useEffect, useRef } from 'react'; import { ExternalLink } from 'react-external-link'; -import type { TimeoutToggle } from '../../../../src/utils/helpers/hooks'; import { CopyToClipboardIcon } from '../../utils/components/CopyToClipboardIcon'; import { Time } from '../../utils/dates/Time'; +import type { TimeoutToggle } from '../../utils/helpers/hooks'; import type { ColorGenerator } from '../../utils/services/ColorGenerator'; import { useSetting } from '../../utils/settings'; import type { ShortUrl } from '../data'; diff --git a/shlink-web-component/test/domains/reducers/domainRedirects.test.ts b/shlink-web-component/test/domains/reducers/domainRedirects.test.ts index 8a7a42e0..40004a5d 100644 --- a/shlink-web-component/test/domains/reducers/domainRedirects.test.ts +++ b/shlink-web-component/test/domains/reducers/domainRedirects.test.ts @@ -1,6 +1,5 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; -import type { ShlinkDomainRedirects } from '../../../src/api-contract'; +import type { ShlinkApiClient, ShlinkDomainRedirects } from '../../../src/api-contract'; import { editDomainRedirects } from '../../../src/domains/reducers/domainRedirects'; describe('domainRedirectsReducer', () => { diff --git a/shlink-web-component/test/short-urls/ShortUrlForm.test.tsx b/shlink-web-component/test/short-urls/ShortUrlForm.test.tsx index 51b7d4bb..a8f56bcb 100644 --- a/shlink-web-component/test/short-urls/ShortUrlForm.test.tsx +++ b/shlink-web-component/test/short-urls/ShortUrlForm.test.tsx @@ -2,7 +2,6 @@ import { screen } from '@testing-library/react'; import type { UserEvent } from '@testing-library/user-event/setup/setup'; import { fromPartial } from '@total-typescript/shoehorn'; import { formatISO } from 'date-fns'; -import type { OptionalString } from '../../../src/utils/utils'; import type { Mode } from '../../src/short-urls/ShortUrlForm'; import { ShortUrlForm as createShortUrlForm } from '../../src/short-urls/ShortUrlForm'; import { parseDate } from '../../src/utils/dates/helpers/date'; @@ -12,7 +11,7 @@ import { renderWithEvents } from '../__helpers__/setUpTest'; describe('', () => { const createShortUrl = vi.fn(async () => Promise.resolve()); const ShortUrlForm = createShortUrlForm(() => TagsSelector, () => DomainSelector); - const setUp = (withDeviceLongUrls = false, mode: Mode = 'create', title?: OptionalString) => + const setUp = (withDeviceLongUrls = false, mode: Mode = 'create', title?: string | null) => renderWithEvents( ', () => { diff --git a/shlink-web-component/test/short-urls/reducers/shortUrlDeletion.test.ts b/shlink-web-component/test/short-urls/reducers/shortUrlDeletion.test.ts index 4762118c..f31b11b0 100644 --- a/shlink-web-component/test/short-urls/reducers/shortUrlDeletion.test.ts +++ b/shlink-web-component/test/short-urls/reducers/shortUrlDeletion.test.ts @@ -1,6 +1,5 @@ import { fromPartial } from '@total-typescript/shoehorn'; -import type { ShlinkApiClient } from '../../../../src/api/services/ShlinkApiClient'; -import type { ProblemDetailsError } from '../../../src/api-contract'; +import type { ProblemDetailsError, ShlinkApiClient } from '../../../src/api-contract'; import { deleteShortUrl as deleteShortUrlCreator, shortUrlDeletionReducerCreator, diff --git a/shlink-web-component/test/visits/reducers/domainVisits.test.ts b/shlink-web-component/test/visits/reducers/domainVisits.test.ts index 7942078b..7ed47994 100644 --- a/shlink-web-component/test/visits/reducers/domainVisits.test.ts +++ b/shlink-web-component/test/visits/reducers/domainVisits.test.ts @@ -1,11 +1,11 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { addDays, formatISO, subDays } from 'date-fns'; -import { rangeOf } from '../../../../src/utils/utils'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { RootState } from '../../../src/container/store'; import type { ShortUrl } from '../../../src/short-urls/data'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; +import { rangeOf } from '../../../src/utils/helpers'; import type { DomainVisits, LoadDomainVisits, } from '../../../src/visits/reducers/domainVisits'; diff --git a/shlink-web-component/test/visits/reducers/nonOrphanVisits.test.ts b/shlink-web-component/test/visits/reducers/nonOrphanVisits.test.ts index fc872af6..e81e7566 100644 --- a/shlink-web-component/test/visits/reducers/nonOrphanVisits.test.ts +++ b/shlink-web-component/test/visits/reducers/nonOrphanVisits.test.ts @@ -1,10 +1,10 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { addDays, formatISO, subDays } from 'date-fns'; -import { rangeOf } from '../../../../src/utils/utils'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { RootState } from '../../../src/container/store'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; +import { rangeOf } from '../../../src/utils/helpers'; import { getNonOrphanVisits as getNonOrphanVisitsCreator, nonOrphanVisitsReducerCreator, diff --git a/shlink-web-component/test/visits/reducers/orphanVisits.test.ts b/shlink-web-component/test/visits/reducers/orphanVisits.test.ts index 5dd1c530..e5f34daf 100644 --- a/shlink-web-component/test/visits/reducers/orphanVisits.test.ts +++ b/shlink-web-component/test/visits/reducers/orphanVisits.test.ts @@ -1,10 +1,10 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { addDays, formatISO, subDays } from 'date-fns'; -import { rangeOf } from '../../../../src/utils/utils'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { RootState } from '../../../src/container/store'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; +import { rangeOf } from '../../../src/utils/helpers'; import { getOrphanVisits as getOrphanVisitsCreator, orphanVisitsReducerCreator, diff --git a/shlink-web-component/test/visits/reducers/shortUrlVisits.test.ts b/shlink-web-component/test/visits/reducers/shortUrlVisits.test.ts index 89d15b0c..2edbdbcf 100644 --- a/shlink-web-component/test/visits/reducers/shortUrlVisits.test.ts +++ b/shlink-web-component/test/visits/reducers/shortUrlVisits.test.ts @@ -1,10 +1,10 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { addDays, formatISO, subDays } from 'date-fns'; -import { rangeOf } from '../../../../src/utils/utils'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { RootState } from '../../../src/container/store'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; +import { rangeOf } from '../../../src/utils/helpers'; import type { ShortUrlVisits } from '../../../src/visits/reducers/shortUrlVisits'; import { diff --git a/shlink-web-component/test/visits/reducers/tagVisits.test.ts b/shlink-web-component/test/visits/reducers/tagVisits.test.ts index b078fc7a..0688399c 100644 --- a/shlink-web-component/test/visits/reducers/tagVisits.test.ts +++ b/shlink-web-component/test/visits/reducers/tagVisits.test.ts @@ -1,10 +1,10 @@ import { fromPartial } from '@total-typescript/shoehorn'; import { addDays, formatISO, subDays } from 'date-fns'; -import { rangeOf } from '../../../../src/utils/utils'; import type { ShlinkApiClient, ShlinkVisits } from '../../../src/api-contract'; import type { RootState } from '../../../src/container/store'; import { formatIsoDate } from '../../../src/utils/dates/helpers/date'; import type { DateInterval } from '../../../src/utils/dates/helpers/dateIntervals'; +import { rangeOf } from '../../../src/utils/helpers'; import type { TagVisits } from '../../../src/visits/reducers/tagVisits'; import {